disable auto crash reports

This commit is contained in:
zebra-lucky 2018-06-12 17:43:37 +03:00
parent d1dfd1695f
commit ef7f6a28e8
2 changed files with 18 additions and 5 deletions

View File

@ -136,7 +136,8 @@ class Exception_Window(QWidget, MessageBoxMixin):
self.close()
def show_never(self):
self.main_window.config.set_key("show_crash_reporter", False)
self.main_window._auto_crash_reports.setChecked(False)
self.main_window.auto_crash_reports(False)
self.close()
def closeEvent(self, event):
@ -201,9 +202,12 @@ class Exception_Hook(QObject):
def __init__(self, main_window, *args, **kwargs):
super(Exception_Hook, self).__init__(*args, **kwargs)
if not main_window.config.get("show_crash_reporter", default=True):
if not main_window.config.get("show_crash_reporter", default=False):
if main_window._old_excepthook:
sys.excepthook = main_window._old_excepthook
return
self.main_window = main_window
main_window._old_excepthook = sys.excepthook
sys.excepthook = self.handler
self._report_exception.connect(_show_window)

View File

@ -101,6 +101,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.gui_object = gui_object
self.config = config = gui_object.config
self._old_excepthook = None
self.setup_exception_hook()
self.network = gui_object.daemon.network
@ -540,15 +541,23 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
help_menu = menubar.addMenu(_("&Help"))
help_menu.addAction(_("&About"), self.show_about)
help_menu.addAction(_("&Official website"), lambda: webbrowser.open("https://github.com/zebra-lucky/electrum-zcash"))
#help_menu.addAction(_("&Official website"), lambda: webbrowser.open("https://github.com/zebra-lucky/electrum-zcash"))
help_menu.addSeparator()
help_menu.addAction(_("&Documentation"), lambda: webbrowser.open("http://github.com/zebra-lucky/electrum-zcash")).setShortcut(QKeySequence.HelpContents)
#help_menu.addAction(_("&Documentation"), lambda: webbrowser.open("http://github.com/zebra-lucky/electrum-zcash")).setShortcut(QKeySequence.HelpContents)
#self._auto_crash_reports = QAction(_("&Automated Crash Reports"), self, checkable=True)
#self._auto_crash_reports.setChecked(self.config.get("show_crash_reporter", default=False))
#self._auto_crash_reports.triggered.connect(self.auto_crash_reports)
#help_menu.addAction(self._auto_crash_reports)
help_menu.addAction(_("&Report Bug"), self.show_report_bug)
help_menu.addSeparator()
help_menu.addAction(_("&Donate to server"), self.donate_to_server)
self.setMenuBar(menubar)
def auto_crash_reports(self, state):
self.config.set_key("show_crash_reporter", state)
self.setup_exception_hook()
def donate_to_server(self):
d = self.network.get_donation_address()
if d:
@ -566,7 +575,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def show_report_bug(self):
msg = ' '.join([
_("Please report any bugs as issues on github:<br/>"),
"<a href=\"https://github.com/spesmilo/electrum/issues\">https://github.com/spesmilo/electrum/issues</a><br/><br/>",
"<a href=\"https://github.com/zebra-lucky/electrum-zcash/issues\">https://github.com/zebra-lucky/electrum-zcash/issues</a><br/><br/>",
_("Before reporting a bug, upgrade to the most recent version of Electrum-Zcash (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.")
])