Skip to content

run

Functions:

Name Description
run

Run DCSpy Qt6 GUI.

run

run(cli_args: Namespace = Namespace()) -> None

Run DCSpy Qt6 GUI.

Source code in src/dcspy/run.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def run(cli_args: Namespace = Namespace()) -> None:
    """Run DCSpy Qt6 GUI."""
    signal.signal(signal.SIGTERM, signal.SIG_DFL)
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    app = QApplication(sys.argv)
    app.setStyle('fusion')

    splash_pixmap = QPixmap((Path(__file__) / '..' / 'img' / 'splash.png').resolve())
    splash_screen = QSplashScreen(splash_pixmap, Qt.WindowType.WindowStaysOnTopHint)
    splash_screen.showMessage('Loading... Please wait.', Qt.AlignmentFlag.AlignCenter | Qt.AlignmentFlag.AlignBottom, Qt.GlobalColor.black)
    progress_bar = QProgressBar(splash_screen)
    progress_bar.setGeometry(50, splash_pixmap.height() - 40, splash_pixmap.width() - 100, 20)
    progress_bar.setTextVisible(False)
    splash_screen.show()

    try:
        window = DcsPyQtGui(cli_args)
        QTimer.singleShot(5, partial(_update_progress, progress_bar))
        splash_screen.finish(window)
        if get_config_yaml_item('show_gui', True):
            window.show()
        app.aboutToQuit.connect(window.event_set)
        unlink(Path(gettempdir()) / f'onefile_{environ["NUITKA_ONEFILE_PARENT"]}_splash_feedback.tmp')
    except (KeyError, FileNotFoundError):
        pass
    except Exception as exp:
        LOG.exception(f'Critical error: {exp}', exc_info=True)
    finally:
        sys.exit(app.exec())