Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit 22730c0

Browse files
committed
Fix report issues functionality
1 parent 6aaf7bd commit 22730c0

File tree

3 files changed

+66
-31
lines changed

3 files changed

+66
-31
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Description
2+
{description}
3+
4+
## Stack
5+
```
6+
{description}
7+
```
8+
## Environment
9+
10+
- file: {file}
11+
- name: {name}
12+
- type: {type}
13+
14+
## Additional information
15+
16+
- app_version: {app_version}
17+
- os: {os}
18+
- wallet_type: {wallet_type}
19+
- locale: {locale}
File renamed without changes.

gui/qt/exception_window.py

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,29 @@
5353
<li>Locale: {locale}</li>
5454
</ul>
5555
"""
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"
5779

5880

5981
class Exception_Window(QWidget, MessageBoxMixin):
@@ -77,31 +99,29 @@ def __init__(self, main_window, exctype, value, tb):
7799
'information:')))
78100

79101
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()))
83103
main_box.addWidget(collapse_info)
84104

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):")))
86106

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)
90110

91111
main_box.addWidget(QLabel(_("Do you want to report this?")))
92112

93113
buttons = QHBoxLayout()
94114

95-
report_button = QPushButton(_('Create a Issue'))
115+
report_button = QPushButton(_('Report on Github'))
96116
report_button.clicked.connect(self.send_report)
97117
report_button.setIcon(QIcon(":icons/tab_send.png"))
98118
buttons.addWidget(report_button)
99119

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)
103123

104-
close_button = QPushButton(_('Not Now'))
124+
close_button = QPushButton(_('Do not report :('))
105125
close_button.clicked.connect(self.close)
106126
buttons.addWidget(close_button)
107127

@@ -111,26 +131,18 @@ def __init__(self, main_window, exctype, value, tb):
111131
self.show()
112132

113133
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+
120137
report = self.get_traceback_info()
121138
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()
134146

135147
def on_close(self):
136148
Exception_Window._active_window = None
@@ -185,6 +197,10 @@ def get_report_string(self):
185197
info["traceback"] = "".join(traceback.format_exception(*self.exc_args))
186198
return issue_template.format(**info)
187199

200+
def get_markdown_report(self, report):
201+
issue = automated_issue_template.format(**report)
202+
return issue
203+
188204
@staticmethod
189205
def get_git_version():
190206
dir = os.path.dirname(os.path.realpath(sys.argv[0]))

0 commit comments

Comments
 (0)