Ejemplo n.º 1
0
    ui_dark_mode_activated = False

    try:
        # check in the user configured the ui dark mode in the default global settings; if so, apply it here
        # (before GUI is instantiated) to avoid flickering caused by switching from the default UI theme
        config_file = AppConfig.get_default_global_settings_file_name()
        if config_file and os.path.exists(config_file):
            cache = AppCache('0.0.0')
            cache.set_file_name(config_file)
            dark_mode = cache.get_value('UI_USE_DARK_MODE', False, bool)
            if dark_mode:
                app.setStyleSheet(qdarkstyle.load_stylesheet())
                ui_dark_mode_activated = True
            del cache

    except Exception:
        pass

    ui = main_dlg.MainWindow(app_dir, ui_dark_mode_activated)
    ui.show()

    try:
        ico_path = os.path.join(app_dir, 'img', 'dmt.ico')
        if os.path.exists(ico_path):
            app_icon = QIcon(ico_path)
            app.setWindowIcon(app_icon)
    except:
        pass

    sys.exit(app.exec_())
Ejemplo n.º 2
0
        traceback.print_tb(tback)
        for fh in logging.RootLogger.root.handlers:
            if isinstance(fh, logging.FileHandler):
                traceback.print_exception(type, value, tback, file=fh.stream)
                fh.flush()
        WndUtils.errorMsg(str(value))

    sys.excepthook = my_excepthook

    if getattr(sys, 'frozen', False):
        app_dir = base_path = sys._MEIPASS
    else:
        app_dir = os.path.dirname(__file__)
        path, tail = os.path.split(app_dir)
        if tail == 'src':
            app_dir = path

    app = qwi.QApplication(sys.argv)
    ui = main_dlg.MainWindow(app_dir)
    ui.show()

    try:
        ico_path = os.path.join(app_dir, 'img', 'dmt.ico')
        if os.path.exists(ico_path):
            app_icon = QIcon(ico_path)
            app.setWindowIcon(app_icon)
    except:
        pass

    sys.exit(app.exec_())
Ejemplo n.º 3
0
            if isinstance(fh, logging.FileHandler):
                traceback.print_exception(type, value, tback, file=fh.stream)
                fh.flush()
        WndUtils.errorMsg(str(value))

    sys.excepthook = my_excepthook

    if getattr(sys, 'frozen', False):
        app_path = base_path = sys._MEIPASS
        os.environ['SSL_CERT_FILE'] = os.path.join(sys._MEIPASS, 'certifi',
                                                   'cacert.pem')
    else:
        app_path = os.path.dirname(__file__)
        path, tail = os.path.split(app_path)
        if tail == 'src':
            app_path = path

    app = qwi.QApplication(sys.argv)
    ui = main_dlg.MainWindow(app_path)
    ui.show()

    try:
        ico_path = os.path.join(app_path, 'img', 'masternode-tool.ico')
        if os.path.exists(ico_path):
            app_icon = QIcon(ico_path)
            app.setWindowIcon(app_icon)
    except:
        pass

    sys.exit(app.exec_())