예제 #1
0
def show_dialog(app):
    """
    Show the main loader dialog
    
    :param app:    The parent App
    """
    # defer imports so that the app works gracefully in batch modes
    from .dialog import AppDialog

    # Create and display the splash screen
    splash_pix = QtGui.QPixmap(":/res/splash.png")
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    QtCore.QCoreApplication.processEvents()

    # create the action manager for the Loader UI:
    from .loader_action_manager import LoaderActionManager
    action_manager = LoaderActionManager()

    # start ui
    ui_title = app.get_setting("title_name")
    w = app.engine.show_dialog(ui_title, app, AppDialog, action_manager)

    # attach splash screen to the main window to help GC
    w.__splash_screen = splash

    # hide splash screen after loader UI show
    splash.finish(w.window())

    # pop up help screen
    if w.is_first_launch():
        # wait a bit before show window
        QtCore.QTimer.singleShot(1400, w.show_help_popup)
예제 #2
0
    def closeEvent(self, event):
        """
        Executed when the main dialog is closed.
        All worker threads and other things which need a proper shutdown
        need to be called here.
        """
        # display exit splash screen
        splash_pix = QtGui.QPixmap(":/res/exit_splash.png")
        splash = QtGui.QSplashScreen(splash_pix,
                                     QtCore.Qt.WindowStaysOnTopHint)
        splash.setMask(splash_pix.mask())
        splash.show()
        QtCore.QCoreApplication.processEvents()

        self.ep.model.destroy()

        # close splash
        splash.close()

        # okay to close dialog
        event.accept()