コード例 #1
0
ファイル: ide.py プロジェクト: JonasT/Blitwizard-IDE-Py
    def __init__(self, arguments=[]):
        super(BlitwizardIDE, self).__init__(arguments)
        # show splashscreen:
        self.splash = SplashScreen()
        self.splash.show()
        self.splash.force_repaint(self)
        
        # wait a very small amount of time to show the splash:
        time.sleep(0.4)

        # load icon theme:
        if QIcon.themeName() == "":
            paths = QIcon.themeSearchPaths()
            paths.append(os.path.abspath("icons"))
            QIcon.setThemeSearchPaths(paths)
            assert(os.path.abspath("icons") in QIcon.themeSearchPaths())
            QIcon.setThemeName("Tango")
            assert(QIcon.themeName() == "Tango")
        assert(len(QIcon.themeName()) > 0)
        self.splash.setPercentage(10)

        # scan for blitwizard instances:
        self.splash.setText(l(\
            "splashscreen_scanning_for_blitwizard_instances"))
        self.splash.force_repaint(self)
        # ... do stuff here
        self.splash.setPercentage(80)
        self.splash.force_repaint(self)

        # load settings:
        self.settings = EditorSettings()
        self.open_project_window()
コード例 #2
0
ファイル: ide.py プロジェクト: JonasT/Blitwizard-IDE-Py
class BlitwizardIDE(QApplication):
    windows = []
    
    def __init__(self, arguments=[]):
        super(BlitwizardIDE, self).__init__(arguments)
        # show splashscreen:
        self.splash = SplashScreen()
        self.splash.show()
        self.splash.force_repaint(self)
        
        # wait a very small amount of time to show the splash:
        time.sleep(0.4)

        # load icon theme:
        if QIcon.themeName() == "":
            paths = QIcon.themeSearchPaths()
            paths.append(os.path.abspath("icons"))
            QIcon.setThemeSearchPaths(paths)
            assert(os.path.abspath("icons") in QIcon.themeSearchPaths())
            QIcon.setThemeName("Tango")
            assert(QIcon.themeName() == "Tango")
        assert(len(QIcon.themeName()) > 0)
        self.splash.setPercentage(10)

        # scan for blitwizard instances:
        self.splash.setText(l(\
            "splashscreen_scanning_for_blitwizard_instances"))
        self.splash.force_repaint(self)
        # ... do stuff here
        self.splash.setPercentage(80)
        self.splash.force_repaint(self)

        # load settings:
        self.settings = EditorSettings()
        self.open_project_window()
        
    def open_project_window(self, project=None):
        new_window = ProjectWindow(self, project)
        new_window.show()
        if self.splash:
            self.splash.finish(new_window)
            self.splash = None
        self.windows.append(new_window)

    def update_language(self):
        self.update_language_canceled = False
        for w in self.windows:
            w.update_language()
        if self.update_language_canceled:
            msgBox = QMessageBox()
            msgBox.setIcon(QMessageBox.Warning)
            msgBox.setWindowTitle("Language change incomplete")
            msgBox.setText("Language change incomplete: " + \
                "one or more windows are still " + \
                "occupied with a modal dialog")
            msgBox.exec_()
    def close_all(self):
        self.close_canceled = False
        for w in self.windows:
            w.close()
            if self.close_canceled:
                break
        if self.close_canceled:
            msgBox = QMessageBox()
            msgBox.setIcon(QMessageBox.Warning)
            msgBox.setWindowTitle("Exit aborted")
            msgBox.setText("Exit aborted: one or more windows are still " + \
                "occupied with a modal dialog")
            msgBox.exec_()
    def run(self):
        
        self.exec_()
        sys.exit(0)