Improve crashdialog result codes

This commit is contained in:
Florian Bruhin 2017-09-27 11:46:51 +02:00
parent 6573888dc6
commit fac322058e
2 changed files with 8 additions and 4 deletions

View File

@ -35,12 +35,16 @@ from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QDialogButtonBox, QApplication)
import qutebrowser
from qutebrowser.utils import version, log, utils, objreg
from qutebrowser.utils import version, log, utils, objreg, usertypes
from qutebrowser.misc import (miscwidgets, autoupdate, msgbox, httpclient,
pastebin)
from qutebrowser.config import config, configfiles
Result = usertypes.enum('Result', ['restore', 'no_restore'], is_int=True,
start=QDialog.Accepted + 1)
def parse_fatal_stacktrace(text):
"""Get useful information from a fatal faulthandler stacktrace.
@ -443,9 +447,9 @@ class ExceptionCrashDialog(_CrashDialog):
def finish(self):
self._save_contact_info()
if self._chk_restore.isChecked():
self.accept()
self.done(Result.restore)
else:
self.reject()
self.done(Result.no_restore)
class FatalCrashDialog(_CrashDialog):

View File

@ -258,7 +258,7 @@ class CrashHandler(QObject):
self._args.debug, info.pages, info.cmd_history, exc,
info.objects)
ret = self._crash_dialog.exec_()
if ret == QDialog.Accepted: # restore
if ret == crashdialog.Result.restore:
self._quitter.restart(info.pages)
# We might risk a segfault here, but that's better than continuing to