当前位置: 首页>>代码示例>>Python>>正文


Python QAction.setSeparator方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QAction.setSeparator方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setSeparator方法的具体用法?Python QAction.setSeparator怎么用?Python QAction.setSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QAction的用法示例。


在下文中一共展示了QAction.setSeparator方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_context_menu_window

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def create_context_menu_window(self, tabWidget, window):
        ctrlMenu = QMenu("")


        title_action = QAction('Window menu', tabWidget)
        title_action.setDisabled(True)

        sep_action = QAction('',tabWidget)
        sep_action.setSeparator(True)
        sep_action2 = QAction('',tabWidget)
        sep_action2.setSeparator(True)

        dock_action = QAction('Dock Window',tabWidget)
        dock_action.triggered.connect(lambda ignore, area=tabWidget, window = window : self.cmenu_dock_window(area,window))

        rename_win_action = QAction('Rename Window',self.tabWidget)
        rename_win_action.triggered.connect(lambda ignore, window = window : self.cmenu_rename_wind(window))

        bg_action = QAction('Set background',tabWidget)
        bg_action.triggered.connect(lambda ignore, wind = window  : self.cmenu_set_bg_window(wind))

        ctrlMenu.addAction(title_action)
        ctrlMenu.addAction(sep_action)
        ctrlMenu.addAction(dock_action)
        ctrlMenu.addAction(sep_action2)
        ctrlMenu.addAction(rename_win_action)
        ctrlMenu.addAction(bg_action)
        return ctrlMenu
开发者ID:TUB-Control,项目名称:PaPI,代码行数:30,代码来源:PaPITabManger.py

示例2: _get_menu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
 def _get_menu(self):
     # main menu
     menu = QMenu()
     main_menu_action_group = QActionGroup(menu)
     main_menu_action_group.setObjectName("main")
     # character menu
     map_action = QAction(menu)
     map_action.setText("Toggle Map")
     main_menu_action_group.addAction(map_action)
     separator = QAction(menu)
     separator.setSeparator(True)
     main_menu_action_group.addAction(separator)
     characters_action = QAction(menu)
     characters_action.setText("Switch Characters")
     main_menu_action_group.addAction(characters_action)
     separator = QAction(menu)
     separator.setSeparator(True)
     main_menu_action_group.addAction(separator)
     settings_action = QAction(menu)
     settings_action.setText("Settings")
     main_menu_action_group.addAction(settings_action)
     quit_action = QAction(menu)
     quit_action.setText("Quit")
     main_menu_action_group.addAction(quit_action)
     menu.addActions(main_menu_action_group.actions())
     menu.triggered[QAction].connect(self._menu_actions)
     return menu
开发者ID:nomns,项目名称:Parse99,代码行数:29,代码来源:parse99.py

示例3: add_context_separator

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def add_context_separator(cls, cue_class=Cue):
        separator = QAction(None)
        separator.setSeparator(True)

        if cue_class not in cls._context_items:
            cls._context_items[cue_class] = [separator]
        else:
            cls._context_items[cue_class].append(separator)

        return separator
开发者ID:tornel,项目名称:linux-show-player,代码行数:12,代码来源:cue_layout.py

示例4: bag_setup

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def bag_setup(self, widget, name):
        widget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
        # TODO: still issues with drag drop between tables
        widget.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
        widget.cellChanged.connect(self.set_edited)

        item_edit = getattr(self, "new_" + name + "_item_edit")

        widget.cellDoubleClicked.connect(lambda: item_edit(False))

        sortable = ("main_bag", "tile_bag", "object_bag")
        clearable = ("wieldable", "action_bar", "essentials")

        edit_action = QAction("Edit...", widget)
        edit_action.triggered.connect(lambda: item_edit(False))
        widget.addAction(edit_action)
        edit_json_action = QAction("Edit JSON...", widget)
        edit_json_action.triggered.connect(lambda: item_edit(False, True))
        widget.addAction(edit_json_action)
        import_json = QAction("Import...", widget)
        import_json.triggered.connect(lambda: item_edit(True))
        widget.addAction(import_json)
        trash_action = QAction("Trash", widget)
        trash_slot = lambda: self.trash_slot(self.window, widget, True)
        trash_action.triggered.connect(trash_slot)
        widget.addAction(trash_action)

        if name in sortable or name in clearable:
            sep_action = QAction(widget)
            sep_action.setSeparator(True)
            widget.addAction(sep_action)
            if name in clearable:
                clear_action = QAction("Clear Held Items", widget)
                clear_action.triggered.connect(self.clear_held_slots)
                widget.addAction(clear_action)
            if name in sortable:
                sort_name = QAction("Sort By Name", widget)
                sort_name.triggered.connect(lambda: self.sort_bag(name, "name"))
                widget.addAction(sort_name)
                sort_type = QAction("Sort By Type", widget)
                sort_type.triggered.connect(lambda: self.sort_bag(name, "category"))
                widget.addAction(sort_type)
                sort_count = QAction("Sort By Count", widget)
                sort_count.triggered.connect(lambda: self.sort_bag(name, "count"))
                widget.addAction(sort_count)
开发者ID:Flagowy,项目名称:starcheat,代码行数:47,代码来源:mainwindow.py

示例5: _create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
 def _create_action(self, action_name, icon_file, text, shortcuts):
     if action_name == '*separator*':
         action = QAction(self.window)
         action.setSeparator(True)
     else:
         if icon_file:
             action = QAction(QIcon(utils.resource_path(icon_file)),
                              text, self.window)
         else:
             action = QAction(text, self.window)
     if shortcuts:
         sequences = [QKeySequence(s) for s in shortcuts]
         action.setShortcuts(sequences)
     if action_name.startswith('+'):
         action.setCheckable(True)
         if action_name.startswith('++'):
             action.setChecked(True)
     return action
开发者ID:jfisteus,项目名称:eyegrade,代码行数:20,代码来源:gui.py

示例6: create_context_menu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def create_context_menu(self):
        ctrlMenu = QMenu("")


        title_action = QAction('Area menu', self.tabWidget)
        title_action.setDisabled(True)

        sep_action = QAction('',self.tabWidget)
        sep_action.setSeparator(True)
        sep_action2 = QAction('',self.tabWidget)
        sep_action2.setSeparator(True)
        sep_action3 = QAction('',self.tabWidget)
        sep_action3.setSeparator(True)

        new_tab_action = QAction('New Tab',self.tabWidget)
        new_tab_action.triggered.connect(self.cmenu_new_tab)

        new_tab_action_cust_name = QAction('New Tab with name',self.tabWidget)
        new_tab_action_cust_name.triggered.connect(self.cmenu_new_tab_custom_name)

        detach_tab_action_cust_name = QAction('Detach > new window',self.tabWidget)
        detach_tab_action_cust_name.triggered.connect(self.detach_tab)

        close_tab_action = QAction('Close Tab',self.tabWidget)
        close_tab_action.triggered.connect(self.cmenu_close_tab)

        rename_tab_action = QAction('Rename Tab',self.tabWidget)
        rename_tab_action.triggered.connect(self.cmenu_rename_tab)

        bg_action = QAction('Set background',self.tabWidget)
        bg_action.triggered.connect(self.cmenu_set_bg)

        wind_action = QAction('New Window',self.tabWidget)
        wind_action.triggered.connect(self.cmenu_new_window)


        if self.tabWidget.count() > 0:
            ctrlMenu.addAction(title_action)

            ctrlMenu.addAction(sep_action)
            ctrlMenu.addAction(new_tab_action)
            ctrlMenu.addAction(new_tab_action_cust_name)

            ctrlMenu.addAction(sep_action2)
            ctrlMenu.addAction(close_tab_action)
            ctrlMenu.addAction(rename_tab_action)
            ctrlMenu.addAction(bg_action)

            ctrlMenu.addAction(sep_action3)
            ctrlMenu.addAction(wind_action)
            ctrlMenu.addAction(detach_tab_action_cust_name)
        else:
            ctrlMenu.addAction(title_action)
            ctrlMenu.addAction(sep_action)
            ctrlMenu.addAction(new_tab_action)
            ctrlMenu.addAction(new_tab_action_cust_name)
            ctrlMenu.addAction(sep_action2)
            ctrlMenu.addAction(wind_action)

        return ctrlMenu
开发者ID:TUB-Control,项目名称:PaPI,代码行数:62,代码来源:PaPITabManger.py

示例7: make_context_menu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def make_context_menu(self):
        self.ui.variant.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        edit_action = QAction("Edit...", self.ui.variant)
        edit_action.triggered.connect(lambda: self.new_item_edit_options(False))
        self.ui.variant.addAction(edit_action)

        edit_raw_action = QAction("Edit Raw JSON...", self.ui.variant)
        edit_raw_action.triggered.connect(lambda: self.new_item_edit_options(False, True))
        self.ui.variant.addAction(edit_raw_action)

        remove_action = QAction("Remove", self.ui.variant)
        remove_action.triggered.connect(self.remove_option)
        self.ui.variant.addAction(remove_action)

        sep_action = QAction(self.ui.variant)
        sep_action.setSeparator(True)
        self.ui.variant.addAction(sep_action)

        remove_action = QAction("Remove All", self.ui.variant)
        remove_action.triggered.connect(self.clear_item_options)
        self.ui.variant.addAction(remove_action)
开发者ID:Flagowy,项目名称:starcheat,代码行数:24,代码来源:itemedit.py

示例8: _onCurrentDocumentChanged

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
    def _onCurrentDocumentChanged(self, old, new):
        """Change current directory, if current file changed
        """
        if(new and
           new.filePath() is not None and
           os.path.exists(os.path.dirname(new.filePath()))):
            try:
                os.chdir(os.path.dirname(new.filePath()))
            except OSError as ex:  # directory might be deleted
                print('Failed to change directory:', str(ex), file=sys.stderr)

        if old is not None:
            for path, name in self._QUTEPART_ACTIONS:
                core.actionManager().removeAction(path)

        if new is not None:
            for path, name in self._QUTEPART_ACTIONS:
                if name is not None:
                    core.actionManager().addAction(path, getattr(new.qutepart, name))
                else:
                    act = QAction(self)
                    act.setSeparator(True)
                    core.actionManager().addAction(path, act)
开发者ID:freason,项目名称:enki,代码行数:25,代码来源:workspace.py

示例9: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]

#.........这里部分代码省略.........
                                     statusTip="Reveal Project in Finder",
                                     triggered=self.openFolder)

        self.exitAct = QAction("E&xit", self, shortcut=QKeySequence.Quit,
                               statusTip="Exit the application",
                               triggered=QApplication.instance().closeAllWindows)

        self.closeAct = QAction("Cl&ose", self,
                                statusTip="Close the active window",
                                triggered=self.mdiArea.closeActiveSubWindow)

        self.outputsAct = QAction("Outputs", self,
                                  statusTip="Open the outputs panel",
                                  triggered=self.openOutputsPanel)

        self.scenarioAct = QAction("Scenario", self,
                                   statusTip="Open the scenario panel",
                                   triggered=self.openScenarioPanel)

        self.closeAllAct = QAction("Close &All", self,
                                   statusTip="Close all the windows",
                                   triggered=self.mdiArea.closeAllSubWindows)

        self.nextAct = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
                               statusTip="Move the focus to the next window",
                               triggered=self.mdiArea.activateNextSubWindow)

        self.previousAct = QAction("Pre&vious", self,
                                   shortcut=QKeySequence.PreviousChild,
                                   statusTip="Move the focus to the previous window",
                                   triggered=self.mdiArea.activatePreviousSubWindow)

        self.separatorAct = QAction(self)
        self.separatorAct.setSeparator(True)

        self.aboutAct = QAction("&About", self,
                                statusTip="Show the application's About box",
                                triggered=self.about)

    def createMenus(self):
        """create all menus"""
        self.fileMenu = self.menuBar().addMenu("&File")
        self.fileMenu.addAction(self.newAct)
        self.fileMenu.addAction(self.openAct)
        self.fileMenu.addAction(self.saveAct)
        self.fileMenu.addAction(self.saveAsAct)
        self.fileMenu.addSeparator()
        self.fileMenu.addAction(self.openFolderAct)
        self.fileMenu.addAction(self.exitAct)

        self.viewMenu = self.menuBar().addMenu("&View")
        self.viewMenu.addAction(self.outputsAct)
        self.viewMenu.addAction(self.scenarioAct)

        self.windowMenu = self.menuBar().addMenu("&Window")
        self.updateWindowMenu()
        self.windowMenu.aboutToShow.connect(self.updateWindowMenu)

        self.menuBar().addSeparator()

        self.helpMenu = self.menuBar().addMenu("&Help")
        self.helpMenu.addAction(self.aboutAct)

    def createStatusBar(self):
        """create the status bar"""
        self.statusBar().showMessage("Ready")
开发者ID:PixelStereo,项目名称:lekture,代码行数:70,代码来源:window.py

示例10: DocumentWindow

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]

#.........这里部分代码省略.........
        self.path_color_panel = ColorPanel()
        self.path_graphics_view.toolbar = self.path_color_panel  # HACK for customqgraphicsview
        self.pathscene.addItem(self.path_color_panel)
        self.path_tool_manager = PathToolManager(self, self.path_toolbar)
        self.slice_tool_manager.path_tool_manager = self.path_tool_manager
        self.path_tool_manager.slice_tool_manager = self.slice_tool_manager

        # set the selection filter default
        doc.documentSelectionFilterChangedSignal.emit(["endpoint", "scaffold", "staple", "xover"])

        self.path_graphics_view.setupGL()
        self.slice_graphics_view.setupGL()
        if GL:
            pass
            # self.slicescene.drawBackground = self.drawBackgroundGL
            # self.pathscene.drawBackground = self.drawBackgroundGL

        # Edit menu setup
        self.actionUndo = doc_ctrlr.undoStack().createUndoAction(self)
        self.actionRedo = doc_ctrlr.undoStack().createRedoAction(self)
        self.actionUndo.setText(QApplication.translate(
                                            "MainWindow", "Undo",
                                            None))
        self.actionUndo.setShortcut(QApplication.translate(
                                            "MainWindow", "Ctrl+Z",
                                            None))
        self.actionRedo.setText(QApplication.translate(
                                            "MainWindow", "Redo",
                                            None))
        self.actionRedo.setShortcut(QApplication.translate(
                                            "MainWindow", "Ctrl+Shift+Z",
                                            None))
        self.sep = QAction(self)
        self.sep.setSeparator(True)
        self.menu_edit.insertAction(self.action_modify, self.sep)
        self.menu_edit.insertAction(self.sep, self.actionRedo)
        self.menu_edit.insertAction(self.actionRedo, self.actionUndo)
        self.main_splitter.setSizes([250, 550])  # balance main_splitter size
        self.statusBar().showMessage("")

    ### ACCESSORS ###
    def undoStack(self):
        return self.controller.undoStack()

    def selectedPart(self):
        return self.controller.document().selectedPart()

    def activateSelection(self, isActive):
        self.path_graphics_view.activateSelection(isActive)
        self.slice_graphics_view.activateSelection(isActive)
    # end def

    ### EVENT HANDLERS ###
    def focusInEvent(self):
        app().undoGroup.setActiveStack(self.controller.undoStack())

    def moveEvent(self, event):
        """Reimplemented to save state on move."""
        self.settings.beginGroup("MainWindow")
        self.settings.setValue("pos", self.pos())
        self.settings.endGroup()

    def resizeEvent(self, event):
        """Reimplemented to save state on resize."""
        self.settings.beginGroup("MainWindow")
        self.settings.setValue("size", self.size())
开发者ID:Rebelofold,项目名称:cadnano2.5,代码行数:70,代码来源:documentwindow.py

示例11: SpreadSheet

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
class SpreadSheet(QMainWindow):

    dateFormats = ["dd/M/yyyy", "yyyy/M/dd", "dd.MM.yyyy"]

    currentDateFormat = dateFormats[0]

    def __init__(self, rows, cols, parent = None):
        super(SpreadSheet, self).__init__(parent)

        self.toolBar = QToolBar()
        self.addToolBar(self.toolBar)
        self.formulaInput = QLineEdit()
        self.cellLabel = QLabel(self.toolBar)
        self.cellLabel.setMinimumSize(80, 0)
        self.toolBar.addWidget(self.cellLabel)
        self.toolBar.addWidget(self.formulaInput)
        self.table = QTableWidget(rows, cols, self)
        for c in range(cols):
            character = chr(ord('A') + c)
            self.table.setHorizontalHeaderItem(c, QTableWidgetItem(character))

        self.table.setItemPrototype(self.table.item(rows - 1, cols - 1))
        self.table.setItemDelegate(SpreadSheetDelegate(self))
        self.createActions()
        self.updateColor(0)
        self.setupMenuBar()
        self.setupContents()
        self.setupContextMenu()
        self.setCentralWidget(self.table)
        self.statusBar()
        self.table.currentItemChanged.connect(self.updateStatus)
        self.table.currentItemChanged.connect(self.updateColor)
        self.table.currentItemChanged.connect(self.updateLineEdit)
        self.table.itemChanged.connect(self.updateStatus)
        self.formulaInput.returnPressed.connect(self.returnPressed)
        self.table.itemChanged.connect(self.updateLineEdit)
        self.setWindowTitle("Spreadsheet")

    def createActions(self):
        self.cell_sumAction = QAction("Sum", self)
        self.cell_sumAction.triggered.connect(self.actionSum)

        self.cell_addAction = QAction("&Add", self)
        self.cell_addAction.setShortcut(Qt.CTRL | Qt.Key_Plus)
        self.cell_addAction.triggered.connect(self.actionAdd)

        self.cell_subAction = QAction("&Subtract", self)
        self.cell_subAction.setShortcut(Qt.CTRL | Qt.Key_Minus)
        self.cell_subAction.triggered.connect(self.actionSubtract)

        self.cell_mulAction = QAction("&Multiply", self)
        self.cell_mulAction.setShortcut(Qt.CTRL | Qt.Key_multiply)
        self.cell_mulAction.triggered.connect(self.actionMultiply)

        self.cell_divAction = QAction("&Divide", self)
        self.cell_divAction.setShortcut(Qt.CTRL | Qt.Key_division)
        self.cell_divAction.triggered.connect(self.actionDivide)

        self.fontAction = QAction("Font...", self)
        self.fontAction.setShortcut(Qt.CTRL | Qt.Key_F)
        self.fontAction.triggered.connect(self.selectFont)

        self.colorAction = QAction(QIcon(QPixmap(16, 16)), "Background &Color...", self)
        self.colorAction.triggered.connect(self.selectColor)

        self.clearAction = QAction("Clear", self)
        self.clearAction.setShortcut(Qt.Key_Delete)
        self.clearAction.triggered.connect(self.clear)

        self.aboutSpreadSheet = QAction("About Spreadsheet", self)
        self.aboutSpreadSheet.triggered.connect(self.showAbout)

        self.exitAction = QAction("E&xit", self)
        self.exitAction.setShortcut(QKeySequence.Quit)
        self.exitAction.triggered.connect(QApplication.instance().quit)

        self.printAction = QAction("&Print", self)
        self.printAction.setShortcut(QKeySequence.Print)
        self.printAction.triggered.connect(self.print_)

        self.firstSeparator = QAction(self)
        self.firstSeparator.setSeparator(True)

        self.secondSeparator = QAction(self)
        self.secondSeparator.setSeparator(True)

    def setupMenuBar(self):
        self.fileMenu = self.menuBar().addMenu("&File")
        self.dateFormatMenu = self.fileMenu.addMenu("&Date format")
        self.dateFormatGroup = QActionGroup(self)
        for f in self.dateFormats:
            action = QAction(f, self, checkable=True,
                    triggered=self.changeDateFormat)
            self.dateFormatGroup.addAction(action)
            self.dateFormatMenu.addAction(action)
            if f == self.currentDateFormat:
                action.setChecked(True)
                
        self.fileMenu.addAction(self.printAction)
        self.fileMenu.addAction(self.exitAction)
#.........这里部分代码省略.........
开发者ID:death-finger,项目名称:Scripts,代码行数:103,代码来源:spreadsheet.py

示例12: _createUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
 def _createUI(self):
   '''
   Create a menubar with file and about menu and a central widget with its
   own layout.
   Creates the preferences window opened by omonimous entry in file menu.
   '''
   # menubar
   self.menubar = self.menuBar()
   
   ## file
   file_menu = self.menubar.addMenu('&File')
   
   self.save_act = QAction(QIcon.fromTheme('document-save'),
       '&Save settings', self)
   self.save_act.setShortcut('Ctrl+S')
   self.save_act.triggered.connect(self._save_config)
   file_menu.addAction(self.save_act)
   
   self.rst_act = QAction(QIcon.fromTheme('document-revert'),
       '&Reset settings', self)
   self.rst_act.setShortcut('Ctrl+R')
   self.rst_act.triggered.connect(self._reset_config)
   file_menu.addAction(self.rst_act)
   
   sep_act1 = QAction(self)
   sep_act1.setSeparator(True)
   file_menu.addAction(sep_act1)
   
   self.enc_act = QAction(QIcon(), 'S&treaming', self)
   self.enc_act.setShortcut('Ctrl+T')
   self.enc_act.setCheckable(True)
   self.enc_act.setChecked(False)
   self.enc_act.toggled.connect(self._toggleEncoding)
   file_menu.addAction(self.enc_act)
   
   self.route_act = QAction(QIcon.fromTheme('configure'),
       'Add static rout&e', self)
   self.route_act.setShortcut('Ctrl+E')
   self.route_act.triggered.connect(self._show_route)
   file_menu.addAction(self.route_act)
   
   self.dev_act = QAction(QIcon.fromTheme('configure'),
       'Change capture &board', self)
   self.dev_act.setShortcut('Ctrl+Alt+B')
   self.dev_act.triggered.connect(self._show_device)
   file_menu.addAction(self.dev_act)
   
   self.pref_act = QAction(QIcon.fromTheme('configure'), '&Preferences', self)
   self.pref_act.setShortcut('Ctrl+Alt+P')
   self.pref_act.triggered.connect(self._show_preferences)
   file_menu.addAction(self.pref_act)
   
   sep_act2 = QAction(self)
   sep_act2.setSeparator(True)
   file_menu.addAction(sep_act2)
   
   close_act = QAction(QIcon.fromTheme('application-exit'), '&Quit', self)
   close_act.setShortcut('Ctrl+Q')
   close_act.triggered.connect(self.close)
   file_menu.addAction(close_act)
   
   ## about
   about_menu = self.menubar.addMenu('&About')
   
   wiki_act = QAction(QIcon.fromTheme('help-browser'),
       'Go to wiki...', self)
   wiki_act.triggered.connect(
     lambda:
       QDesktopServices.openUrl(QUrl('https://github.com/datasoftsrl/'
           'v4lcapture/wiki', QUrl.TolerantMode))
   )
   about_menu.addAction(wiki_act)
   
   sep_act3 = QAction(self)
   sep_act3.setSeparator(True)
   about_menu.addAction(sep_act3)
   
   ds_act = QAction(QIcon.fromTheme('applications-internet'),
       'DataSoft Srl', self)
   ds_act.triggered.connect(
     lambda:
       QDesktopServices.openUrl(QUrl('http://www.datasoftweb.com/',
           QUrl.TolerantMode))
   )
   about_menu.addAction(ds_act)
   
   qt_act = QAction(QIcon(':/qt-project.org/qmessagebox/images/qtlogo-64.png'),
       'About Qt', self)
   qt_act.triggered.connect(QApplication.aboutQt)
   about_menu.addAction(qt_act)
   
   self.sb_perm = QLabel()
   self.sb = self.statusBar()
   self.sb.setStyleSheet('''
     QStatusBar QLabel {
       margin-right: 5px;
     }
   ''')
   self.sb.addPermanentWidget(self.sb_perm)
   self.sb.setSizeGripEnabled(False)
#.........这里部分代码省略.........
开发者ID:datasoftsrl,项目名称:v4lcapture,代码行数:103,代码来源:window.py

示例13: DocumentWindow

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]
class DocumentWindow(QMainWindow, ui_mainwindow.Ui_MainWindow):
    """DocumentWindow subclasses QMainWindow and Ui_MainWindow. It performs
    some initialization operations that must be done in code rather than
    using Qt Creator.

    Attributes:
        controller (DocumentController):
    """
    def __init__(self, parent=None, doc_ctrlr=None):
        super(DocumentWindow, self).__init__(parent)
        self.controller = doc_ctrlr
        doc = doc_ctrlr.document()
        self.setupUi(self)
        self.settings = QSettings()
        self._readSettings()
        # self.setCentralWidget(self.slice_graphics_view)
        # Appearance pref
        if not app().prefs.show_icon_labels:
            self.main_toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)

        # Outliner & PropertyEditor setup
        self.outliner_widget.configure(window=self, document=doc)
        self.property_widget.configure(window=self, document=doc)
        self.property_buttonbox.setVisible(False)

        self.tool_managers = None  # initialize

        # Slice setup
        self.slicescene = QGraphicsScene(parent=self.slice_graphics_view)
        self.sliceroot = SliceRootItem(rect=self.slicescene.sceneRect(),
                                       parent=None,
                                       window=self,
                                       document=doc)
        self.sliceroot.setFlag(QGraphicsItem.ItemHasNoContents)
        self.slicescene.addItem(self.sliceroot)
        self.slicescene.setItemIndexMethod(QGraphicsScene.NoIndex)
        assert self.sliceroot.scene() == self.slicescene
        self.slice_graphics_view.setScene(self.slicescene)
        self.slice_graphics_view.scene_root_item = self.sliceroot
        self.slice_graphics_view.setName("SliceView")
        self.slice_tool_manager = SliceToolManager(self, self.sliceroot)
        # Path setup
        self.pathscene = QGraphicsScene(parent=self.path_graphics_view)
        self.pathroot = PathRootItem(rect=self.pathscene.sceneRect(),
                                     parent=None,
                                     window=self,
                                     document=doc)
        self.pathroot.setFlag(QGraphicsItem.ItemHasNoContents)
        self.pathscene.addItem(self.pathroot)
        self.pathscene.setItemIndexMethod(QGraphicsScene.NoIndex)
        assert self.pathroot.scene() == self.pathscene
        self.path_graphics_view.setScene(self.pathscene)
        self.path_graphics_view.scene_root_item = self.pathroot
        self.path_graphics_view.setScaleFitFactor(0.9)
        self.path_graphics_view.setName("PathView")

        # Path toolbar
        self.path_color_panel = ColorPanel()
        self.path_graphics_view.toolbar = self.path_color_panel  # HACK for customqgraphicsview
        self.pathscene.addItem(self.path_color_panel)
        self.path_tool_manager = PathToolManager(self, self.pathroot)
        self.slice_tool_manager.path_tool_manager = self.path_tool_manager
        self.path_tool_manager.slice_tool_manager = self.slice_tool_manager
        self.tool_managers = (self.path_tool_manager, self.slice_tool_manager)

        self.insertToolBarBreak(self.main_toolbar)

        self.path_graphics_view.setupGL()
        self.slice_graphics_view.setupGL()

        # Edit menu setup
        self.actionUndo = doc_ctrlr.undoStack().createUndoAction(self)
        self.actionRedo = doc_ctrlr.undoStack().createRedoAction(self)
        self.actionUndo.setText(QApplication.translate("MainWindow", "Undo", None))
        self.actionUndo.setShortcut(QApplication.translate("MainWindow", "Ctrl+Z", None))
        self.actionRedo.setText(QApplication.translate("MainWindow", "Redo", None))
        self.actionRedo.setShortcut(QApplication.translate("MainWindow", "Ctrl+Shift+Z", None))
        self.sep = QAction(self)
        self.sep.setSeparator(True)
        self.menu_edit.insertAction(self.sep, self.actionRedo)
        self.menu_edit.insertAction(self.actionRedo, self.actionUndo)
        self.main_splitter.setSizes([400, 400, 180])  # balance main_splitter size
        self.statusBar().showMessage("")

        doc.setViewNames(['slice', 'path'])
    # end def

    def document(self):
        return self.controller.document()
    # end def

    def destroyWin(self):
        for mgr in self.tool_managers:
            mgr.destroy()
        self.controller = None
    # end def

    ### ACCESSORS ###
    def undoStack(self):
        return self.controller.undoStack()
#.........这里部分代码省略.........
开发者ID:hadim,项目名称:cadnano2.5,代码行数:103,代码来源:documentwindow.py

示例14: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setSeparator [as 别名]

#.........这里部分代码省略.........
                statusTip="Copy the current selection's contents to the clipboard",
                triggered=self.copy)

        self.pasteAct = QAction(QIcon(':/images/paste.png'), "&Paste", self,
                shortcut=QKeySequence.Paste,
                statusTip="Paste the clipboard's contents into the current selection",
                triggered=self.paste)

        self.closeAct = QAction("Cl&ose", self,
                statusTip="Close the active window",
                triggered=self.mdiArea.closeActiveSubWindow)

        self.closeAllAct = QAction("Close &All", self,
                statusTip="Close all the windows",
                triggered=self.mdiArea.closeAllSubWindows)

        self.tileAct = QAction("&Tile", self, statusTip="Tile the windows",
                triggered=self.mdiArea.tileSubWindows)

        self.cascadeAct = QAction("&Cascade", self,
                statusTip="Cascade the windows",
                triggered=self.mdiArea.cascadeSubWindows)

        self.nextAct = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
                statusTip="Move the focus to the next window",
                triggered=self.mdiArea.activateNextSubWindow)

        self.previousAct = QAction("Pre&vious", self,
                shortcut=QKeySequence.PreviousChild,
                statusTip="Move the focus to the previous window",
                triggered=self.mdiArea.activatePreviousSubWindow)

        self.separatorAct = QAction(self)
        self.separatorAct.setSeparator(True)

        self.aboutAct = QAction("&About", self,
                statusTip="Show the application's About box",
                triggered=self.about)

        self.aboutQtAct = QAction("About &Qt", self,
                statusTip="Show the Qt library's About box",
                triggered=QApplication.instance().aboutQt)

    def createMenus(self):
        self.fileMenu = self.menuBar().addMenu("&File")
        self.fileMenu.addAction(self.newAct)
        self.fileMenu.addAction(self.openAct)
        self.fileMenu.addAction(self.saveAct)
        self.fileMenu.addAction(self.saveAsAct)
        self.fileMenu.addSeparator()
        action = self.fileMenu.addAction("Switch layout direction")
        action.triggered.connect(self.switchLayoutDirection)
        self.fileMenu.addAction(self.exitAct)

        self.editMenu = self.menuBar().addMenu("&Edit")
        self.editMenu.addAction(self.cutAct)
        self.editMenu.addAction(self.copyAct)
        self.editMenu.addAction(self.pasteAct)

        self.windowMenu = self.menuBar().addMenu("&Window")
        self.updateWindowMenu()
        self.windowMenu.aboutToShow.connect(self.updateWindowMenu)

        self.menuBar().addSeparator()

        self.helpMenu = self.menuBar().addMenu("&Help")
开发者ID:skyballoon,项目名称:PyQtTest,代码行数:70,代码来源:main.py


注:本文中的PyQt5.QtWidgets.QAction.setSeparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。