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


Python QAction.setShortcuts方法代码示例

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


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

示例1: ViewActions

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
class ViewActions(actioncollection.ActionCollection):
    name = "view"
    def createActions(self, parent=None):
        self.window_split_horizontal = QAction(parent)
        self.window_split_vertical = QAction(parent)
        self.window_close_view = QAction(parent)
        self.window_close_others = QAction(parent)
        self.window_next_view = QAction(parent)
        self.window_previous_view = QAction(parent)

        # icons
        self.window_split_horizontal.setIcon(icons.get('view-split-top-bottom'))
        self.window_split_vertical.setIcon(icons.get('view-split-left-right'))
        self.window_close_view.setIcon(icons.get('view-close'))
        self.window_next_view.setIcon(icons.get('go-next-view'))
        self.window_previous_view.setIcon(icons.get('go-previous-view'))

        # shortcuts
        self.window_close_view.setShortcut(Qt.CTRL + Qt.SHIFT + Qt.Key_W)
        self.window_next_view.setShortcuts(QKeySequence.NextChild)
        qutil.removeShortcut(self.window_next_view, "Ctrl+,")
        self.window_previous_view.setShortcuts(QKeySequence.PreviousChild)
        qutil.removeShortcut(self.window_previous_view, "Ctrl+.")

    def translateUI(self):
        self.window_split_horizontal.setText(_("Split &Horizontally"))
        self.window_split_vertical.setText(_("Split &Vertically"))
        self.window_close_view.setText(_("&Close Current View"))
        self.window_close_others.setText(_("Close &Other Views"))
        self.window_next_view.setText(_("&Next View"))
        self.window_previous_view.setText(_("&Previous View"))
开发者ID:brownian,项目名称:frescobaldi,代码行数:33,代码来源:viewmanager.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def __init__(self, parent=None):
        super(ClearHistoryDialog, self).__init__(parent)

        self.setWindowFlags(Qt.Dialog)

        self.setWindowTitle(tr("Clear Data"))

        closeWindowAction = QAction(self)
        closeWindowAction.setShortcuts(["Esc", "Ctrl+W", "Ctrl+Shift+Del"])
        closeWindowAction.triggered.connect(self.close)
        self.addAction(closeWindowAction)

        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        label = QLabel(tr("What to clear:"), self)
        self.layout.addWidget(label)
        self.dataType = QComboBox(self)
        self.dataType.addItem(tr("History"))
        self.dataType.addItem(tr("Cookies"))
        self.dataType.addItem(tr("Memory Caches"))
        self.dataType.addItem(tr("Persistent Storage"))
        self.dataType.addItem(tr("Everything"))
        self.layout.addWidget(self.dataType)
        self.toolBar = QToolBar(self)
        self.toolBar.setStyleSheet(common.blank_toolbar)
        self.toolBar.setMovable(False)
        self.toolBar.setContextMenuPolicy(Qt.CustomContextMenu)
        self.layout.addWidget(self.toolBar)
        self.clearHistoryButton = QPushButton(tr("Clear"), self)
        self.clearHistoryButton.clicked.connect(self.clearHistory)
        self.toolBar.addWidget(self.clearHistoryButton)
        self.closeButton = QPushButton(tr("Close"), self)
        self.closeButton.clicked.connect(self.close)
        self.toolBar.addWidget(self.closeButton)
开发者ID:ismlsmile,项目名称:nimbus,代码行数:36,代码来源:clear_history_dialog.py

示例3: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
 def __init__(self, parent=None):
     QListWidget.__init__(self, parent)
     self.setWindowTitle(tr("Saved Sessions"))
     self.setWindowFlags(Qt.Dialog)
     hideAction = QAction(self)
     hideAction.setShortcuts(["Esc", "Ctrl+W"])
     hideAction.triggered.connect(self.hide)
     self.addAction(hideAction)
     self.sessionList = QListWidget(self)
     self.sessionList.itemActivated.connect(self.loadSession)
     self.setCentralWidget(self.sessionList)
     self.toolBar = QToolBar(self)
     self.toolBar.setMovable(False)
     self.toolBar.setContextMenuPolicy(Qt.CustomContextMenu)
     self.addToolBar(Qt.BottomToolBarArea, self.toolBar)
     self.loadButton = QPushButton(tr("&Load"), self)
     self.loadButton.clicked.connect(lambda: self.loadSession(self.sessionList.currentItem()))
     self.toolBar.addWidget(self.loadButton)
     self.saveButton = QPushButton(tr("&Save"), self)
     self.saveButton.clicked.connect(saveSessionManually)
     self.saveButton.clicked.connect(self.refresh)
     self.toolBar.addWidget(self.saveButton)
     deleteAction = QAction(self)
     deleteAction.setShortcut("Del")
     deleteAction.triggered.connect(self.delete)
     self.addAction(deleteAction)
开发者ID:ismlsmile,项目名称:nimbus,代码行数:28,代码来源:session.py

示例4: action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def action(self, scheme):
        """Returns a new QAction that represents our item.

        The action contains the text, icon and current shortcut.

        """
        action = QAction(self.icon(0), self.text(0).replace('&', '&&'), None)
        action.setShortcuts(self._shortcuts[scheme][0])
        return action
开发者ID:19joho66,项目名称:frescobaldi,代码行数:11,代码来源:shortcuts.py

示例5: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def __init__(self, parent, *args, **kwargs):
        super(FileDialogShowHidden, self).__init__(parent, *args, **kwargs)
        self.setOption(self.DontUseNativeDialog, True)
        self.setOption(self.HideNameFilterDetails, True)

        showHiddenAction = QAction(self)
        showHiddenAction.setShortcuts([QKeySequence(Qt.CTRL + Qt.Key_H),])
        showHiddenAction.triggered.connect(self.toggleShowHidden)
        self.addAction(showHiddenAction)

        self.showHidden(hiddenFiles(parent))
开发者ID:Mechtilde,项目名称:backintime,代码行数:13,代码来源:qttools.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def __init__(self, parent=None):
        super(SearchEditor, self).__init__(parent)
        self.setWindowFlags(Qt.FramelessWindowHint | Qt.Popup)
        self.parent = parent
        self.setWindowTitle(tr('Search Editor'))
        self.styleSheet = "QMainWindow { background: palette(window); border: 1px solid palette(dark); }"
        self.setStyleSheet(self.styleSheet)
        try: self.setWindowIcon(common.app_icon)
        except: pass

        closeWindowAction = QAction(self)
        closeWindowAction.setShortcuts(["Ctrl+W", "Ctrl+Shift+K"])
        closeWindowAction.triggered.connect(self.close)
        self.addAction(closeWindowAction)

        self.entryBar = QToolBar(self)
        self.entryBar.setIconSize(QSize(16, 16))
        self.entryBar.setStyleSheet(common.blank_toolbar)
        self.entryBar.setContextMenuPolicy(Qt.CustomContextMenu)
        self.entryBar.setMovable(False)
        self.addToolBar(self.entryBar)

        eLabel = QLabel(" " + tr('New expression:'), self)
        self.entryBar.addWidget(eLabel)
        self.expEntry = custom_widgets.LineEdit(self)
        self.expEntry.returnPressed.connect(self.addSearch)
        self.entryBar.addWidget(self.expEntry)
        self.addSearchButton = QToolButton(self)
        self.addSearchButton.setText(tr("Add"))
        self.addSearchButton.setIcon(common.complete_icon("list-add"))
        self.addSearchButton.clicked.connect(self.addSearch)
        self.entryBar.addWidget(self.addSearchButton)

        self.engineList = QListWidget(self)
        self.engineList.setAlternatingRowColors(True)
        self.engineList.itemClicked.connect(self.applySearch)
        self.engineList.itemActivated.connect(self.applySearch)
        self.engineList.itemActivated.connect(self.close)
        self.setCentralWidget(self.engineList)

        self.takeSearchAction = QAction(self)
        self.takeSearchAction.triggered.connect(self.takeSearch)
        self.takeSearchAction.setShortcut("Del")
        self.addAction(self.takeSearchAction)

        self.hideAction = QAction(self)
        self.hideAction.triggered.connect(self.hide)
        self.hideAction.setShortcut("Esc")
        self.addAction(self.hideAction)

        self.reload_()
开发者ID:ismlsmile,项目名称:nimbus,代码行数:53,代码来源:search_manager.py

示例7: createaction

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
 def createaction (self, text, slot=None, shortcuts=None, icon=None,
                  tip=None, checkable=False):
     action = QAction(text, self)
     if icon is not None:
         action.setIcon(QIcon.fromTheme(icon))
     if shortcuts is not None:
         action.setShortcuts(shortcuts)
     if tip is not None:
         action.setToolTip(tip)
         action.setStatusTip(tip)
     if slot is not None:
         action.triggered.connect(slot)
     if checkable:
         action.setCheckable(True)
     return action
开发者ID:bucaneer,项目名称:flint,代码行数:17,代码来源:editorwindow.py

示例8: editShortcut

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
 def editShortcut(self):
     """Edit our shortcut."""
     from widgets import shortcuteditdialog
     mainwindow = self.parent().mainwindow()
     action = QAction(self.defaultAction().icon(), self.defaultAction().text(), None)
     action.setShortcuts(self.actionCollection().shortcuts(self.objectName()) or [])
     default = self.actionCollection().defaults().get(self.objectName())
     mgr = actioncollectionmanager.manager(mainwindow)
     skip = (self.actionCollection(), self.objectName())
     cb = mgr.findShortcutConflict
     
     dlg = shortcuteditdialog.ShortcutEditDialog(self, cb, skip)
     if dlg.editAction(action, default):
         mgr.removeShortcuts(action.shortcuts())
         self.actionCollection().setShortcuts(self.objectName(), action.shortcuts())
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:17,代码来源:buttongroup.py

示例9: _create_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [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

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def __init__(self, parent=None, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)

        app = QApplication.instance()
        self._layerSet = app.currentFont().layers

        self.setDragDropMode(QAbstractItemView.InternalMove)

        model = self.model()
        model.rowsMoved.connect(self._reordered)
        self.itemChanged.connect(self._itemChanged)

        self.setContextMenuPolicy(Qt.ActionsContextMenu)

        action = QAction("Add Layer…", self)
        action.setShortcuts(QKeySequence.New)
        action.triggered.connect(self._addLayer)
        self.addAction(action)

        action = QAction("Change &Name", self)
        action.setShortcuts(QKeySequence('n'))
        action.triggered.connect(lambda: self.editItem(self.currentItem()))
        self.addAction(action)

        action = QAction("Change &Color", self)
        action.setShortcuts(QKeySequence('c'))
        action.triggered.connect(self._changeColor)
        self.addAction(action)

        action = QAction("Reset Color to &Default", self)
        action.setShortcuts(QKeySequence('d'))
        action.triggered.connect(self._resetColor)
        self.addAction(action)

        action = QAction("Delete", self)
        action.setShortcuts(QKeySequence.Delete)
        action.triggered.connect(self._deleteLayer)
        self.addAction(action)

        self._layerSet.addObserver(self, '_update', 'LayerSet.Changed')
        self._update()

        app.currentFontChanged.connect(self.updateFont)
开发者ID:n7s,项目名称:trufont,代码行数:45,代码来源:layerSetList.py

示例11: editShortcuts

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
    def editShortcuts(self):
        from widgets import shortcuteditdialog
        ac = self.parent().parent().snippetActions
        action = QAction(None)
        if self._name:
            action.setShortcuts(self.shortcuts())
            action.setIcon(snippets.icon(self._name) or QIcon())
            default = ac.defaults().get(self._name)
            text = snippets.title(self._name)
        else:
            default = None
            text = self.titleEntry.text() or _("Untitled")
        action.setText(text.replace('&', '&&'))

        cb = self.actionManager().findShortcutConflict
        skip = (self.parent().parent().snippetActions, self._name)
        dlg = shortcuteditdialog.ShortcutEditDialog(self, cb, skip)

        if dlg.editAction(action, default):
            self.setShortcuts(action.shortcuts())
开发者ID:19joho66,项目名称:frescobaldi,代码行数:22,代码来源:edit.py

示例12: action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
def action(name, parent=None, collection=None):
    """Returns a QAction with text and icon for the given snippet name.

    Returns None is no such snippet is available.
    If collection is provided, it is used to set shortcuts to the action.
    """
    title = snippets.title(name)
    if not title:
        return
    a = QAction(parent)
    a.setObjectName(name)
    a.setText(title.replace('&', '&&'))
    icon = snippets.icon(name)
    if icon:
        a.setIcon(icon)
    if collection:
        shortcuts = collection.shortcuts(name)
        if shortcuts:
            a.setShortcuts(shortcuts)
    return a
开发者ID:19joho66,项目名称:frescobaldi,代码行数:22,代码来源:actions.py

示例13: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
 def __init__(self, parent=None):
     super(LicenseDialog, self).__init__(parent)
     self.resize(420, 320)
     self.setWindowTitle(tr("Credits & Licensing"))
     self.setWindowFlags(Qt.Dialog)
     self.readme = ""
     self.license = ""
     self.thanks = ""
     self.authors = ""
     self.tabWidget = QTabWidget(self)
     self.setCentralWidget(self.tabWidget)
     for folder in (app_folder, os.path.dirname(app_folder)):
         for fname in os.listdir(folder):
             if fname.startswith("LICENSE"):
                 try: f = open(os.path.join(folder, fname), "r")
                 except: pass
                 else:
                     self.license = f.read()
                     f.close()
             elif fname.startswith("THANKS"):
                 try: f = open(os.path.join(folder, fname), "r")
                 except: pass
                 else:
                     self.thanks = f.read()
                     f.close()
             elif fname.startswith("AUTHORS"):
                 try: f = open(os.path.join(folder, fname), "r")
                 except: pass
                 else:
                     self.authors = f.read()
                     f.close()
             elif fname.startswith("README"):
                 try: f = open(os.path.join(folder, fname), "r")
                 except: pass
                 else:
                     self.readme = f.read()
                     f.close()
     self.readmeView = ReadOnlyTextEdit(self)
     self.readmeView.setText(self.readme)
     self.tabWidget.addTab(self.readmeView, tr("&README"))
     self.authorsView = ReadOnlyTextEdit(self)
     self.authorsView.setText(self.authors)
     self.tabWidget.addTab(self.authorsView, tr("&Authors"))
     self.thanksView = ReadOnlyTextEdit(self)
     self.thanksView.setText(self.thanks)
     self.tabWidget.addTab(self.thanksView, tr("&Thanks"))
     self.licenseView = ReadOnlyTextEdit(self)
     self.licenseView.setText(self.license)
     self.tabWidget.addTab(self.licenseView, tr("&License"))
     closeAction = QAction(self)
     closeAction.setShortcuts(["Esc", "Ctrl+W"])
     closeAction.triggered.connect(self.hide)
     self.addAction(closeAction)
     self.toolBar = QToolBar(self)
     self.toolBar.setStyleSheet(blank_toolbar)
     self.toolBar.setMovable(False)
     self.toolBar.setContextMenuPolicy(Qt.CustomContextMenu)
     self.addToolBar(Qt.BottomToolBarArea, self.toolBar)
     self.toolBar.addWidget(HorizontalExpander(self))
     self.closeButton = QPushButton(tr("&OK"), self)
     self.closeButton.clicked.connect(self.close)
     self.toolBar.addWidget(self.closeButton)
     self.closeButton.setFocus()
开发者ID:ismlsmile,项目名称:nimbus,代码行数:65,代码来源:custom_widgets.py

示例14: MainWindow

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

#.........这里部分代码省略.........
        self.statusBar().addPermanentWidget(self.cw.actions, 1)
        self.statusBar().show()

        self.updateStatusBar('')

        self.cw.selectionStatusChanged[str].connect(self.updateStatusBar)
        self.cw.updatingStatus.connect(self.statusWaiting)

    def initializeActions(self):
        self.initializeOperationActions()

    def initializeOperationActions(self):

        self.showAllAction = QAction(QIcon.fromTheme("media-optical"), _translate("Packaga Manager","All Packages"), self)
        self.showAllAction.triggered.connect(lambda:self.cw.switchState(StateManager.ALL))
        self.cw.stateTab.addTab(QWidget(), QIcon.fromTheme("media-optical"), _translate("Packaga Manager","All Packages"))

        self.showInstallAction = QAction(QIcon.fromTheme("list-remove"), _translate("Packaga Manager","Installable Packages"), self)
        self.showInstallAction.triggered.connect(lambda:self.cw.switchState(StateManager.INSTALL))
        self.cw.stateTab.addTab(QWidget(), QIcon.fromTheme("list-add"), _translate("Packaga Manager","Installable Packages"))

        self.showRemoveAction = QAction(QIcon.fromTheme("list-add"), _translate("Packaga Manager","Installed Packages"), self)
        self.showRemoveAction.triggered.connect(lambda:self.cw.switchState(StateManager.REMOVE))
        self.cw.stateTab.addTab(QWidget(), QIcon.fromTheme("list-remove"), _translate("Packaga Manager","Installed Packages"))

        self.showUpgradeAction = QAction(QIcon.fromTheme("system-software-update"), _translate("Packaga Manager","Updates"), self)
        self.showUpgradeAction.triggered.connect(lambda:self.cw.switchState(StateManager.UPGRADE))
        self.cw.stateTab.addTab(QWidget(), QIcon("/usr/share/package-manager/data/star_1.svg"), _translate("Packaga Manager","Updates"))

        self.showPreferences = QAction(QIcon.fromTheme("preferences-system"), _translate("Packaga Manager","Settings"), self)
        self.showPreferences.triggered.connect(self.settingsDialog.show_)

        self.actionHelp = QAction(QIcon.fromTheme("help-about"), _translate("Packaga Manager","Help"), self)
        self.actionHelp.setShortcuts(QKeySequence.HelpContents)
        self.actionHelp.triggered.connect(self.showHelp)

        self.actionQuit = QAction(QIcon.fromTheme("media-eject"), _translate("Packaga Manager","Quit"), self)
        self.actionQuit.setShortcuts(QKeySequence.Quit)
        self.actionQuit.triggered.connect(qApp.exit)

        self.cw.menuButton.setMenu(QMenu('MainMenu', self.cw.menuButton))
        self.cw.menuButton.setIcon(QIcon.fromTheme("preferences-system"))
        self.cw.menuButton.menu().clear()

        self.cw.contentHistory.hide()

        self.cw.menuButton.menu().addAction(self.showPreferences)
        self.cw.menuButton.menu().addSeparator()
        self.cw.menuButton.menu().addAction(self.actionHelp)
        self.cw.menuButton.menu().addAction(self.actionQuit)

        self.cw._states = {self.cw.state.ALL    :(0, self.showAllAction),
                           self.cw.state.INSTALL:(1, self.showInstallAction),
                           self.cw.state.REMOVE :(2, self.showRemoveAction),
                           self.cw.state.UPGRADE:(3, self.showUpgradeAction)}

        self.showAllAction.setChecked(True)
        self.cw.checkUpdatesButton.hide()
        self.cw.checkUpdatesButton.setIcon(QIcon.fromTheme("system-reboot"))
        self.cw.showBasketButton.clicked.connect(self.cw.showBasket)

        # Little time left for the new ui
        self.menuBar().setVisible(False)
        self.cw.switchState(self.cw.state.ALL)

    def statusWaiting(self):
开发者ID:PisiLinuxNew,项目名称:package-manager,代码行数:70,代码来源:mainwindow.py

示例15: ActionCollection

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setShortcuts [as 别名]
class ActionCollection(actioncollection.ActionCollection):
    name = "main"
    def createActions(self, parent=None):
        self.file_new = QAction(parent)
        self.file_open = QAction(parent)
        self.file_open_recent = QAction(parent)
        self.file_insert_file = QAction(parent)
        self.file_open_current_directory = QAction(parent)
        self.file_open_command_prompt = QAction(parent)
        self.file_save = QAction(parent)
        self.file_save_as = QAction(parent)
        self.file_save_copy_as = QAction(parent)
        self.file_save_all = QAction(parent)
        self.file_reload = QAction(parent)
        self.file_reload_all = QAction(parent)
        self.file_external_changes = QAction(parent)
        self.file_print_source = QAction(parent)
        self.file_close = QAction(parent)
        self.file_close_other = QAction(parent)
        self.file_close_all = QAction(parent)
        self.file_quit = QAction(parent)
        self.file_restart = QAction(parent)

        self.export_colored_html = QAction(parent)

        self.edit_undo = QAction(parent)
        self.edit_redo = QAction(parent)
        self.edit_cut = QAction(parent)
        self.edit_copy = QAction(parent)
        self.edit_copy_colored_html = QAction(parent)
        self.edit_paste = QAction(parent)
        self.edit_select_all = QAction(parent)
        self.edit_select_current_toplevel = QAction(parent)
        self.edit_select_none = QAction(parent)
        self.edit_select_full_lines_up = QAction(parent)
        self.edit_select_full_lines_down = QAction(parent)
        self.edit_find = QAction(parent)
        self.edit_find_next = QAction(parent)
        self.edit_find_previous = QAction(parent)
        self.edit_replace = QAction(parent)
        self.edit_preferences = QAction(parent)

        self.view_next_document = QAction(parent)
        self.view_previous_document = QAction(parent)
        self.view_wrap_lines = QAction(parent, checkable=True)
        self.view_scroll_up = QAction(parent)
        self.view_scroll_down = QAction(parent)

        self.window_new = QAction(parent)
        self.window_fullscreen = QAction(parent)
        self.window_fullscreen.setCheckable(True)

        self.help_manual = QAction(parent)
        self.help_whatsthis = QWhatsThis.createAction(parent)
        self.help_about = QAction(parent)
        self.help_bugreport = QAction(parent)

        # icons
        self.file_new.setIcon(icons.get('document-new'))
        self.file_open.setIcon(icons.get('document-open'))
        self.file_open_recent.setIcon(icons.get('document-open-recent'))
        self.file_open_current_directory.setIcon(icons.get('folder-open'))
        self.file_open_command_prompt.setIcon(icons.get('utilities-terminal'))
        self.file_save.setIcon(icons.get('document-save'))
        self.file_save_as.setIcon(icons.get('document-save-as'))
        self.file_save_copy_as.setIcon(icons.get('document-save-as'))
        self.file_save_all.setIcon(icons.get('document-save-all'))
        self.file_reload.setIcon(icons.get('reload'))
        self.file_reload_all.setIcon(icons.get('reload-all'))
        self.file_print_source.setIcon(icons.get('document-print'))
        self.file_close.setIcon(icons.get('document-close'))
        self.file_quit.setIcon(icons.get('application-exit'))

        self.edit_undo.setIcon(icons.get('edit-undo'))
        self.edit_redo.setIcon(icons.get('edit-redo'))
        self.edit_cut.setIcon(icons.get('edit-cut'))
        self.edit_copy.setIcon(icons.get('edit-copy'))
        self.edit_paste.setIcon(icons.get('edit-paste'))
        self.edit_select_all.setIcon(icons.get('edit-select-all'))
        self.edit_select_current_toplevel.setIcon(icons.get('edit-select'))
        self.edit_find.setIcon(icons.get('edit-find'))
        self.edit_find_next.setIcon(icons.get('go-down-search'))
        self.edit_find_previous.setIcon(icons.get('go-up-search'))
        self.edit_replace.setIcon(icons.get('edit-find-replace'))
        self.edit_preferences.setIcon(icons.get('preferences-system'))

        self.view_next_document.setIcon(icons.get('go-next'))
        self.view_previous_document.setIcon(icons.get('go-previous'))

        self.window_new.setIcon(icons.get('window-new'))
        self.window_fullscreen.setIcon(icons.get('view-fullscreen'))

        self.help_manual.setIcon(icons.get('help-contents'))
        self.help_whatsthis.setIcon(icons.get('help-contextual'))
        self.help_bugreport.setIcon(icons.get('tools-report-bug'))
        self.help_about.setIcon(icons.get('help-about'))

        # shortcuts
        self.file_new.setShortcuts(QKeySequence.New)
        self.file_open.setShortcuts(QKeySequence.Open)
#.........这里部分代码省略.........
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:103,代码来源:mainwindow.py


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