53
53
<li>Locale: {locale}</li>
54
54
</ul>
55
55
"""
56
- report_server = "https://crashhub.electrum.org/crash"
56
+
57
+ automated_issue_template = """## Description
58
+ {description}
59
+
60
+ ## Stack
61
+ ```
62
+ {stack}
63
+ ```
64
+ ## Environment
65
+
66
+ - file: {id[file]}
67
+ - name: {id[name]}
68
+ - type: {id[type]}
69
+
70
+ ## Additional information
71
+
72
+ - app_version: {app_version}
73
+ - os: {os}
74
+ - wallet_type: {wallet_type}
75
+ - locale: {locale}
76
+ """
77
+
78
+ report_url = "https://github.com/SmartCash/electrum-smart/issues/new"
57
79
58
80
59
81
class Exception_Window (QWidget , MessageBoxMixin ):
@@ -77,31 +99,29 @@ def __init__(self, main_window, exctype, value, tb):
77
99
'information:' )))
78
100
79
101
collapse_info = QPushButton (_ ("Show report contents" ))
80
- collapse_info .clicked .connect (
81
- lambda : self .msg_box (QMessageBox .NoIcon ,
82
- self , "Report contents" , self .get_report_string ()))
102
+ collapse_info .clicked .connect (lambda : self .msg_box (QMessageBox .NoIcon , self , "Report contents" , self .get_report_string ()))
83
103
main_box .addWidget (collapse_info )
84
104
85
- # main_box.addWidget(QLabel(_("Please briefly describe what led to the error (optional):")))
105
+ main_box .addWidget (QLabel (_ ("Please describe the steps to reproduce this error (optional):" )))
86
106
87
- # self.description_textfield = QTextEdit()
88
- # self.description_textfield.setFixedHeight(50)
89
- # main_box.addWidget(self.description_textfield)
107
+ self .description_textfield = QTextEdit ()
108
+ self .description_textfield .setFixedHeight (50 )
109
+ main_box .addWidget (self .description_textfield )
90
110
91
111
main_box .addWidget (QLabel (_ ("Do you want to report this?" )))
92
112
93
113
buttons = QHBoxLayout ()
94
114
95
- report_button = QPushButton (_ ('Create a Issue ' ))
115
+ report_button = QPushButton (_ ('Report on Github ' ))
96
116
report_button .clicked .connect (self .send_report )
97
117
report_button .setIcon (QIcon (":icons/tab_send.png" ))
98
118
buttons .addWidget (report_button )
99
119
100
- never_button = QPushButton (_ ('Never' ))
101
- never_button .clicked .connect (self .show_never )
102
- buttons .addWidget (never_button )
120
+ # never_button = QPushButton(_('Never'))
121
+ # never_button.clicked.connect(self.show_never)
122
+ # buttons.addWidget(never_button)
103
123
104
- close_button = QPushButton (_ ('Not Now ' ))
124
+ close_button = QPushButton (_ ('Do not report :( ' ))
105
125
close_button .clicked .connect (self .close )
106
126
buttons .addWidget (close_button )
107
127
@@ -111,26 +131,18 @@ def __init__(self, main_window, exctype, value, tb):
111
131
self .show ()
112
132
113
133
def send_report (self ):
114
- if constants .net .GENESIS [- 4 :] not in ["4943" , "e26f" ] and ".electrum.org" in report_server :
115
- # Gah! Some kind of altcoin wants to send us crash reports.
116
- import webbrowser
117
- webbrowser .open ('https://github.com/SmartCash/electrum-smart/issues/new' )
118
- #self.main_window.show_critical(_("Please report this issue manually."))
119
- return
134
+ import webbrowser
135
+ import urllib
136
+
120
137
report = self .get_traceback_info ()
121
138
report .update (self .get_additional_info ())
122
- report = json .dumps (report )
123
- try :
124
- response = requests .post (report_server , data = report , timeout = 20 )
125
- except BaseException as e :
126
- traceback .print_exc (file = sys .stderr )
127
- self .main_window .show_critical (_ ('There was a problem with the automatic reporting:' ) + '\n ' +
128
- str (e ) + '\n ' +
129
- _ ("Please report this issue manually." ))
130
- return
131
- else :
132
- QMessageBox .about (self , "Crash report" , response .text )
133
- self .close ()
139
+ report_querystring = self .get_markdown_report (report )
140
+
141
+ url = '{}?title=Automated+bug+report: {}&body={}' .format (report_url , urllib .parse .quote_plus (report .get ('exc_string' )), urllib .parse .quote_plus (report_querystring ))
142
+
143
+ webbrowser .open (url )
144
+
145
+ self .close ()
134
146
135
147
def on_close (self ):
136
148
Exception_Window ._active_window = None
@@ -185,6 +197,10 @@ def get_report_string(self):
185
197
info ["traceback" ] = "" .join (traceback .format_exception (* self .exc_args ))
186
198
return issue_template .format (** info )
187
199
200
+ def get_markdown_report (self , report ):
201
+ issue = automated_issue_template .format (** report )
202
+ return issue
203
+
188
204
@staticmethod
189
205
def get_git_version ():
190
206
dir = os .path .dirname (os .path .realpath (sys .argv [0 ]))
0 commit comments