def setup_method(self, method): self.dialog = gaupol.DebugDialog() try: self.dialog.foo() except AttributeError: self.dialog.set_text(*sys.exc_info()) self.dialog.show()
def show_exception(exctype, value, tb): """A :class:`gaupol.DebugDialog` :attr`sys.excepthook`.""" traceback.print_exception(exctype, value, tb) if not isinstance(value, Exception): return try: # to avoid recursion. dialog = gaupol.DebugDialog() dialog.set_text(exctype, value, tb) response = dialog.run() dialog.destroy() if response == Gtk.ResponseType.NO: raise SystemExit(1) except Exception: traceback.print_exc()