From 650225e238a1a9db07d713cf202f0ed1e51a92e7 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 4 Jul 2019 19:13:12 +0200 Subject: [PATCH] crash reporter UX see #5483 --- electrum/constants.py | 4 ++++ electrum/gui/qt/exception_window.py | 15 +++++++++++---- electrum/gui/qt/main_window.py | 2 +- electrum/logging.py | 3 ++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/electrum/constants.py b/electrum/constants.py index 2a78d40ea..26504312c 100644 --- a/electrum/constants.py +++ b/electrum/constants.py @@ -39,6 +39,10 @@ def read_json(filename, default): return r +GIT_REPO_URL = "https://github.com/spesmilo/electrum" +GIT_REPO_ISSUES_URL = "https://github.com/spesmilo/electrum/issues" + + class AbstractNet: @classmethod diff --git a/electrum/gui/qt/exception_window.py b/electrum/gui/qt/exception_window.py index 4ea065cd0..49aeaa3c5 100644 --- a/electrum/gui/qt/exception_window.py +++ b/electrum/gui/qt/exception_window.py @@ -33,6 +33,8 @@ from electrum.i18n import _ from electrum.base_crash_reporter import BaseCrashReporter from electrum.logging import Logger +from electrum import constants + from .util import MessageBoxMixin, read_QIcon, WaitingDialog @@ -97,17 +99,22 @@ def __init__(self, main_window, exctype, value, tb): def send_report(self): def on_success(response): + # note: 'response' coming from (remote) crash reporter server. + # It contains a URL to the GitHub issue, so we allow rich text. self.show_message(parent=self, title=_("Crash report"), - msg=response) + msg=response, + rich_text=True) self.close() def on_failure(exc_info): e = exc_info[1] self.logger.error('There was a problem with the automatic reporting', exc_info=exc_info) self.show_critical(parent=self, - msg=(_('There was a problem with the automatic reporting:') + '\n' + - str(e) + '\n' + - _("Please report this issue manually."))) + msg=(_('There was a problem with the automatic reporting:') + '
' + + repr(e)[:120] + '
' + + _("Please report this issue manually") + + f' on GitHub.'), + rich_text=True) proxy = self.main_window.network.proxy task = lambda: BaseCrashReporter.send_report(self, self.main_window.network.asyncio_loop, proxy) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 72add77a1..cb98033ef 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -666,7 +666,7 @@ def show_update_check(self, version=None): def show_report_bug(self): msg = ' '.join([ _("Please report any bugs as issues on github:
"), - "https://github.com/spesmilo/electrum/issues

", + f'''{constants.GIT_REPO_ISSUES_URL}

''', _("Before reporting a bug, upgrade to the most recent version of Electrum (latest release or git HEAD), and include the version number in your report."), _("Try to explain not only what the bug is, but how it occurs.") ]) diff --git a/electrum/logging.py b/electrum/logging.py index bb3946485..84aea0b60 100644 --- a/electrum/logging.py +++ b/electrum/logging.py @@ -243,7 +243,8 @@ def configure_logging(config): logging.getLogger('kivy').propagate = False from . import ELECTRUM_VERSION - _logger.info(f"Electrum version: {ELECTRUM_VERSION} - https://electrum.org - https://github.com/spesmilo/electrum") + from .constants import GIT_REPO_URL + _logger.info(f"Electrum version: {ELECTRUM_VERSION} - https://electrum.org - {GIT_REPO_URL}") _logger.info(f"Python version: {sys.version}. On platform: {describe_os_version()}") _logger.info(f"Logging to file: {str(_logfile_path)}") _logger.info(f"Log filters: verbosity {repr(verbosity)}, verbosity_shortcuts {repr(verbosity_shortcuts)}")