def add_actions(self, s: LayoutStack, MainWindow):
        tr = self.tr
        # Setup actions
        self.actionOpen = QAction(MainWindow)
        self.actionSave = QAction(MainWindow)
        self.actionNew = QAction(MainWindow)
        self.actionSaveAs = QAction(MainWindow)
        self.actionExit = QAction(MainWindow)
        self.actionPreview = QAction(MainWindow)
        self.actionRender = QAction(MainWindow)

        self.actionWebsite = create_element(QAction,
                                            MainWindow,
                                            text=tr("corrscope Website"))
        self.actionHelp = create_element(QAction, MainWindow, text=tr("Help"))

        self.action_separate_render_dir = create_element(
            QAction,
            MainWindow,
            text=tr("&Separate Render Folder"),
            checkable=True)
        self.action_open_config_dir = create_element(
            QAction, MainWindow, text=tr("Open &Config Folder"))

        # Setup menu_bar
        assert s.widget is MainWindow
        with set_menu_bar(s) as self.menuBar:
            with append_menu(s) as self.menuFile:
                w = self.menuFile
                w.addAction(self.actionNew)
                w.addAction(self.actionOpen)
                w.addAction(self.actionSave)
                w.addAction(self.actionSaveAs)
                w.addSeparator()
                w.addAction(self.actionPreview)
                w.addAction(self.actionRender)
                w.addSeparator()
                w.addAction(self.actionExit)

            with append_menu(s) as self.menuTools:
                w = self.menuTools
                w.addAction(self.action_separate_render_dir)
                w.addSeparator()
                w.addAction(self.action_open_config_dir)

            with append_menu(s, title=tr("&Help")) as self.menuHelp:
                w = self.menuHelp
                w.addAction(self.actionWebsite)
                w.addAction(self.actionHelp)

        # Setup toolbar
        with add_toolbar(s, Qt.TopToolBarArea) as self.toolBar:
            w = self.toolBar
            w.addAction(self.actionNew)
            w.addAction(self.actionOpen)
            w.addAction(self.actionSave)
            w.addAction(self.actionSaveAs)
            w.addSeparator()
            w.addAction(self.actionPreview)
            w.addAction(self.actionRender)
Beispiel #2
0
    def add_actions(self, s: LayoutStack, MainWindow):
        tr = self.tr
        # Setup actions
        self.actionOpen = QAction(MainWindow)
        self.actionSave = QAction(MainWindow)
        self.actionNew = QAction(MainWindow)
        self.actionSaveAs = QAction(MainWindow)
        self.actionExit = QAction(MainWindow)
        self.actionPreview = QAction(MainWindow)
        self.actionRender = QAction(MainWindow)
        self.actionHelp = create_element(QAction, MainWindow, text=tr("Help"))
        self.action_separate_render_dir = QAction(MainWindow)
        self.action_separate_render_dir.setCheckable(True)

        # Setup menu_bar
        assert s.widget is MainWindow
        with set_menu_bar(s) as self.menuBar:
            with append_menu(s) as self.menuFile:
                self.menuFile.addAction(self.actionNew)
                self.menuFile.addAction(self.actionOpen)
                self.menuFile.addAction(self.actionSave)
                self.menuFile.addAction(self.actionSaveAs)
                self.menuFile.addSeparator()
                self.menuFile.addAction(self.actionPreview)
                self.menuFile.addAction(self.actionRender)
                self.menuFile.addSeparator()
                self.menuFile.addAction(self.actionExit)

            with append_menu(s) as self.menuTools:
                self.menuTools.addAction(self.action_separate_render_dir)

            with append_menu(s, title=tr("&Help")) as w:
                self.menuHelp = w
                w.addAction(self.actionHelp)

        # Setup toolbar
        with add_toolbar(s, Qt.TopToolBarArea) as self.toolBar:
            self.toolBar.addAction(self.actionNew)
            self.toolBar.addAction(self.actionOpen)
            self.toolBar.addAction(self.actionSave)
            self.toolBar.addAction(self.actionSaveAs)
            self.toolBar.addSeparator()
            self.toolBar.addAction(self.actionPreview)
            self.toolBar.addAction(self.actionRender)