Example #1
0
File: App.py Project: mogigoma/nmap
    def excepthook(type, value, tb):
        import traceback

        traceback.print_exception(type, value, tb)

        # Cause an exception if PyGTK can't open a display. Normally this just
        # produces a warning, but the lack of a display eventually causes a
        # segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210.
        import warnings
        warnings.filterwarnings("error", module="gtk")
        import gtk
        warnings.resetwarnings()

        gtk.gdk.threads_enter()

        from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog
        from zenmapGUI.CrashReport import CrashReport
        if type == ImportError:
            d = HIGAlertDialog(type=gtk.MESSAGE_ERROR,
                message_format=_("Import error"),
                secondary_text=_("""A required module was not found.

""" + unicode(value)))
            d.run()
            d.destroy()
        else:
            c = CrashReport(type, value, tb)
            c.show_all()
            gtk.main()

        gtk.gdk.threads_leave()

        gtk.main_quit()
Example #2
0
    def excepthook(type, value, tb):
        import traceback

        traceback.print_exception(type, value, tb)

        # Cause an exception if PyGTK can't open a display. Normally this just
        # produces a warning, but the lack of a display eventually causes a
        # segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210.
        warnings.filterwarnings("error", module="gtk")
        import gtk
        warnings.resetwarnings()

        gtk.gdk.threads_enter()

        from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog
        from zenmapGUI.CrashReport import CrashReport
        if type == ImportError:
            d = HIGAlertDialog(
                type=gtk.MESSAGE_ERROR,
                message_format=_("Import error"),
                secondary_text=_("""A required module was not found.

""" + unicode(value)))
            d.run()
            d.destroy()
        else:
            c = CrashReport(type, value, tb)
            c.show_all()
            gtk.main()

        gtk.gdk.threads_leave()

        gtk.main_quit()
Example #3
0
    def excepthook(type, value, tb):
        import traceback

        traceback.print_exception(type, value, tb)

        # Cause an exception if PyGTK can't open a display. Normally this just
        # produces a warning, but the lack of a display eventually causes a
        # segmentation fault. See http://live.gnome.org/PyGTK/WhatsNew210.
        import warnings

        warnings.filterwarnings("error", module="gtk")
        import gtk

        warnings.resetwarnings()

        gtk.gdk.threads_enter()

        from zenmapCore.Version import VERSION
        from zenmapGUI.higwidgets.higdialogs import HIGAlertDialog
        from zenmapGUI.CrashReport import CrashReport

        if type == ImportError:
            d = HIGAlertDialog(
                type=gtk.MESSAGE_ERROR,
                message_format=_("Import error"),
                secondary_text=_(
                    """\
A required module was not found.

"""
                    + value.message
                ),
            )
            d.run()
            d.destroy()
        else:
            hook = "Type: %s\nValue: %s\n" % (type, value)
            outputs = (
                "CRASH REPORTED:\n\
SYS.PLATFORM: %s\n\
OS.NAME: %s\n\
%s Version: %s\n\
TRACEBACK:\n%s"
                % (
                    sys.platform,
                    os.name,
                    APP_DISPLAY_NAME,
                    VERSION,
                    "".join(traceback.format_exception(type, value, tb)),
                )
            )

            try:
                c = CrashReport("%s: %s" % (VERSION, value), outputs)
                c.show_all()
                gtk.main()
            except:
                d = HIGAlertDialog(
                    type=gtk.MESSAGE_ERROR,
                    message_format=_("Bug not reported"),
                    secondary_text=_(
                        """A critical error \
occurred during %s execution,
and it was not properly reported to our bug tracker. Please,
copy the error message bellow and report it on our bug tracker.

The following error message was NOT reported:
%s"""
                    )
                    % (APP_DISPLAY_NAME, outputs),
                )
                d.run()
                d.destroy()

        gtk.gdk.threads_leave()

        gtk.main_quit()