Пример #1
0
def main():
    """Main entry point for qutebrowser."""
    parser = get_argparser()
    args = parser.parse_args()
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    import PyQt5.QtWidgets as QtWidgets
    app = app.Application(args)

    def qt_mainloop():
        """Simple wrapper to get a nicer stack trace for segfaults.

        WARNING: misc/crashdialog.py checks the stacktrace for this function
        name, so if this is changed, it should be changed there as well!
        """
        return app.exec_()  # pylint: disable=maybe-no-member

    # We set qApp explicitely here to reduce the risk of segfaults while
    # quitting.
    # See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7
    # While this is a workaround for PyQt4 which should be fixed in PyQt, it
    # seems this still reduces segfaults.
    # FIXME: We should do another attempt at contacting upstream about this.
    QtWidgets.qApp = app
    ret = qt_mainloop()
    QtWidgets.qApp = None
    return ret
Пример #2
0
def main():
    """Main entry point for qutebrowser."""
    parser = get_argparser()
    args = parser.parse_args()
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    import PyQt5.QtWidgets as QtWidgets
    app = app.Application(args)

    def qt_mainloop():
        """Simple wrapper to get a nicer stack trace for segfaults."""
        return app.exec_()  # pylint: disable=maybe-no-member

    # We set qApp explicitely here to reduce the risk of segfaults while
    # quitting.
    # See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7
    # While this is a workaround for PyQt4 which should be fixed in PyQt, it
    # seems this still reduces segfaults.
    # FIXME: We should do another attempt at contacting upstream about this.
    QtWidgets.qApp = app
    ret = qt_mainloop()
    QtWidgets.qApp = None
    return ret
Пример #3
0
def main():
    parser = get_argparser()
    argv = sys.argv[1:]
    args = parser.parse_args(argv)
    if args.json_args is not None:
        # Restoring after a restart.
        # When restarting, we serialize the argparse namespace into json, and
        # construct a "fake" argparse.Namespace here based on the data loaded
        # from json.
        data = json.loads(args.json_args)
        args = argparse.Namespace(**data)
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    return app.run(args)
Пример #4
0
def main():
    """Main entry point for qutebrowser."""
    parser = get_argparser()
    if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
        # Ignore Mac OS X' idiotic -psn_* argument...
        # http://stackoverflow.com/questions/19661298/
        # http://sourceforge.net/p/cx-freeze/mailman/message/31041783/
        argv = [arg for arg in sys.argv[1:] if not arg.startswith('-psn_0_')]
    else:
        argv = sys.argv[1:]
    args = parser.parse_args(argv)
    if args.json_args is not None:
        # Restoring after a restart.
        # When restarting, we serialize the argparse namespace into json, and
        # construct a "fake" argparse.Namespace here based on the data loaded
        # from json.
        data = json.loads(args.json_args)
        args = argparse.Namespace(**data)
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    import PyQt5.QtWidgets as QtWidgets
    app = app.Application(args)

    def qt_mainloop():
        """Simple wrapper to get a nicer stack trace for segfaults.

        WARNING: misc/crashdialog.py checks the stacktrace for this function
        name, so if this is changed, it should be changed there as well!
        """
        return app.exec_()

    # We set qApp explicitly here to reduce the risk of segfaults while
    # quitting.
    # See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7
    # While this is a workaround for PyQt4 which should be fixed in PyQt, it
    # seems this still reduces segfaults.
    # FIXME: We should do another attempt at contacting upstream about this.
    QtWidgets.qApp = app
    ret = qt_mainloop()
    QtWidgets.qApp = None
    return ret
Пример #5
0
def main():
    parser = get_argparser()
    if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
        # Ignore Mac OS X' idiotic -psn_* argument...
        # http://stackoverflow.com/questions/19661298/
        # http://sourceforge.net/p/cx-freeze/mailman/message/31041783/
        argv = [arg for arg in sys.argv[1:] if not arg.startswith('-psn_0_')]
    else:
        argv = sys.argv[1:]
    args = parser.parse_args(argv)
    if args.json_args is not None:
        # Restoring after a restart.
        # When restarting, we serialize the argparse namespace into json, and
        # construct a "fake" argparse.Namespace here based on the data loaded
        # from json.
        data = json.loads(args.json_args)
        args = argparse.Namespace(**data)
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    return app.run(args)
Пример #6
0
def main():
    parser = get_argparser()
    if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
        # Ignore Mac OS X' idiotic -psn_* argument...
        # http://stackoverflow.com/questions/19661298/
        # http://sourceforge.net/p/cx-freeze/mailman/message/31041783/
        argv = [arg for arg in sys.argv[1:] if not arg.startswith('-psn_0_')]
    else:
        argv = sys.argv[1:]
    args = parser.parse_args(argv)
    if args.json_args is not None:
        # Restoring after a restart.
        # When restarting, we serialize the argparse namespace into json, and
        # construct a "fake" argparse.Namespace here based on the data loaded
        # from json.
        data = json.loads(args.json_args)
        args = argparse.Namespace(**data)
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    return app.run(args)
Пример #7
0
def main():
    """Main entry point for qutebrowser."""
    parser = get_argparser()
    args = parser.parse_args()
    if args.json_args is not None:
        # Restoring after a restart.
        # When restarting, we serialize the argparse namespace into json, and
        # construct a "fake" argparse.Namespace here based on the data loaded
        # from json.
        data = json.loads(args.json_args)
        args = argparse.Namespace(**data)
    earlyinit.earlyinit(args)
    # We do this imports late as earlyinit needs to be run first (because of
    # the harfbuzz fix and version checking).
    from qutebrowser import app
    import PyQt5.QtWidgets as QtWidgets
    app = app.Application(args)

    def qt_mainloop():
        """Simple wrapper to get a nicer stack trace for segfaults.

        WARNING: misc/crashdialog.py checks the stacktrace for this function
        name, so if this is changed, it should be changed there as well!
        """
        return app.exec_()

    # We set qApp explicitly here to reduce the risk of segfaults while
    # quitting.
    # See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/561303/comments/7
    # While this is a workaround for PyQt4 which should be fixed in PyQt, it
    # seems this still reduces segfaults.
    # FIXME: We should do another attempt at contacting upstream about this.
    QtWidgets.qApp = app
    ret = qt_mainloop()
    QtWidgets.qApp = None
    return ret