コード例 #1
0
    def exception_hook(self, ex_type: type, ex_value: BaseException,
                       tb: traceback) -> None:
        # noinspection PyTypeChecker
        sys.__excepthook__(ex_type, ex_value, tb)

        # first manage case of not being an exception (e.g., keyboard interrupts)
        if not issubclass(ex_type, Exception):
            msg = str(ex_value)
            if not msg:
                msg = ex_value.__class__.__name__
            logger.info(msg)
            self.close()
            return

        dlg = ExceptionDialog(app_info=app_info,
                              lib_info=lib_info,
                              ex_type=ex_type,
                              ex_value=ex_value,
                              tb=tb)
        ret = dlg.exec_()
        if ret == QtWidgets.QDialog.Rejected:
            if not dlg.user_triggered:
                self.close()
        else:
            logger.warning("ignored exception")
コード例 #2
0
    def test_visibility(self):

        if not QtWidgets.QApplication.instance():
            QtWidgets.QApplication([])

        d = ExceptionDialog(lib_info=LibInfo(), app_info=AppInfo())
        d.show()
コード例 #3
0
    def test_visibility(self):

        if not qApp:
            QApplication([])

        d = ExceptionDialog(lib_info=LibInfo(), app_info=AppInfo())
        d.show()
コード例 #4
0
    def show_exception_dialog(self, params):
        _app_info, _lib_info, ex_type, ex_value, tb = params

        dlg = ExceptionDialog(app_info=_app_info,
                              lib_info=_lib_info,
                              ex_type=ex_type,
                              ex_value=ex_value,
                              tb=tb)
        ret = dlg.exec_()
        if ret == QtWidgets.QDialog.Rejected:
            if not dlg.user_triggered:
                self.close()
        else:
            logger.warning("ignored exception")
コード例 #5
0
import sys
import logging

from PySide2 import QtWidgets

from hyo2.abc.app.dialogs.exception.exception_dialog import ExceptionDialog
from hyo2.abc.lib.lib_info import LibInfo
from hyo2.abc.app.app_info import AppInfo
from hyo2.abc.lib.logging import set_logging

logger = logging.getLogger(__name__)
set_logging(ns_list=["hyo2.abc"])

app = QtWidgets.QApplication([])

d = ExceptionDialog(lib_info=LibInfo(), app_info=AppInfo())
d.show()

sys.exit(app.exec_())