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


Python QAction.setChecked方法代码示例

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


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

示例1: addDocument

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def addDocument(self, doc):
     a = QAction(self)
     a.setCheckable(True)
     if doc is self.mainwindow().currentDocument():
         a.setChecked(True)
     self._acts[doc] = a
     self.setDocumentStatus(doc)
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:9,代码来源:documentmenu.py

示例2: add_toggle_action_to_menu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def add_toggle_action_to_menu(self, menu, caption, checked, call):
     action = QAction(caption, menu)
     action.setCheckable(True)
     action.setChecked(checked)
     menu.addAction(action)
     action.toggled.connect(call)
     return action
开发者ID:Tinkerforge,项目名称:brickv,代码行数:9,代码来源:qhexedit.py

示例3: addShowActions

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
    def addShowActions(self):
        """Adds a submenu giving access to the (other)
        opened viewer documents"""
        mds = self._actionCollection.viewer_document_select
        docs = mds.viewdocs()
        document_actions = {}
        multi_docs = len(docs) > 1
        if self._panel.widget().currentViewdoc():
            current_doc_filename = self._panel.widget().currentViewdoc().filename()

        m = self._menu
        sm = QMenu(m)
        sm.setTitle(_("Show..."))
        sm.setEnabled(multi_docs)
        ag = QActionGroup(m)
        ag.triggered.connect(self._panel.slotShowViewdoc)

        for d in docs:
            action = QAction(sm)
            action.setText(d.name())
            action._document_filename = d.filename()
            # TODO: Tooltips aren't shown by Qt (it seems)
            action.setToolTip(d.filename())
            action.setCheckable(True)
            action.setChecked(d.filename() == current_doc_filename)

            ag.addAction(action)
            sm.addAction(action)

        m.addSeparator()
        m.addMenu(sm)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:33,代码来源:contextmenu.py

示例4: setupMenuBar

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 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)
     self.cellMenu = self.menuBar().addMenu("&Cell")
     self.cellMenu.addAction(self.cell_addAction)
     self.cellMenu.addAction(self.cell_subAction)
     self.cellMenu.addAction(self.cell_mulAction)
     self.cellMenu.addAction(self.cell_divAction)
     self.cellMenu.addAction(self.cell_sumAction)
     self.cellMenu.addSeparator()
     self.cellMenu.addAction(self.colorAction)
     self.cellMenu.addAction(self.fontAction)
     self.menuBar().addSeparator()
     self.aboutMenu = self.menuBar().addMenu("&Help")
     self.aboutMenu.addAction(self.aboutSpreadSheet)
开发者ID:death-finger,项目名称:Scripts,代码行数:28,代码来源:spreadsheet.py

示例5: add_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def add_action(self, name, shortcut, callback, **kwargs):
     """
     Ajoute une action au context menu et au widget navigation lui même.
     Créer une fonction à la volé pour fournir des arguments aux fonctions
     associé aux actions.
     """
     action = QAction(self.tr(name), self)
     if 'icon' in kwargs:
         action.setIcon(kwargs['icon'])
     if 'checkable' in kwargs and kwargs['checkable']:
         action.setCheckable(True)
         if 'checked' in kwargs:
             checked = True if kwargs['checked'] == 'true' else False
             action.setChecked(
                 checked
             )
     
     action.setShortcut(shortcut)
     action.setShortcutContext(Qt.WidgetWithChildrenShortcut)
     
     if 'wrapped' in kwargs and kwargs['wrapped'] is False:
         action.triggered.connect(callback)
     else:
         action.triggered.connect(self.__wrapper(callback))
     
     self.addAction(action)
     self.menu.addAction(action)
     self.editor_actions[name] = action
开发者ID:FlorianPerrot,项目名称:Mojuru,代码行数:30,代码来源:ace_editor.py

示例6: addCustomWidget

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
    def addCustomWidget(self, text, widget, group=None, defaultVisibility=True):
        """
        Adds a custom widget to the toolbar.

        `text` is the name that will displayed on the button to switch visibility.
        `widget` is the widget to control from the toolbar.
        `group` is an integer (or any hashable) if the current widget should not
            be displayed all the time. Call `collapsibleDockWidgets.setCurrentGroup`
            to switch to that group and hide other widgets.
        `defaultVisibility` is the default visibility of the item when it is added.
            This allows for the widget to be added to `collapsibleDockWidgets` after
            they've been created but before they are shown, and yet specify their
            desired visibility. Otherwise it creates troubles, see #167 on github:
            https://github.com/olivierkes/manuskript/issues/167.
        """
        a = QAction(text, self)
        a.setCheckable(True)
        a.setChecked(defaultVisibility)
        a.toggled.connect(widget.setVisible)
        widget.setVisible(defaultVisibility)
        # widget.installEventFilter(self)
        b = verticalButton(self)
        b.setDefaultAction(a)
        #b.setChecked(widget.isVisible())
        a2 = self.addWidget(b)
        self.otherWidgets.append((b, a2, widget, group))
开发者ID:olivierkes,项目名称:manuskript,代码行数:28,代码来源:collapsibleDockWidgets.py

示例7: addAction

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
        def addAction(name, checked=False):
            action = QAction(name, self)
            action.setText(name)
            action.setCheckable(True)
            action.setChecked(checked)
            action.setActionGroup(self.lyricGroup)

            return action
开发者ID:xcution,项目名称:pyrics,代码行数:10,代码来源:qpyrics.py

示例8: addBranch

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def addBranch(self, branch):
     a = QAction(self)
     a.setCheckable(True)
     if branch == vcs.app_repo.current_branch():
         a.setChecked(True)
         a.setEnabled(False)
     self._acts[branch] = a
     self.setBranchStatus(branch)
开发者ID:dliessi,项目名称:frescobaldi,代码行数:10,代码来源:menu.py

示例9: generateViewMenu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
    def generateViewMenu(self):

        values = [
            (self.tr("Nothing"), "Nothing"),
            (self.tr("POV"), "POV"),
            (self.tr("Label"), "Label"),
            (self.tr("Progress"), "Progress"),
            (self.tr("Compile"), "Compile"),
        ]

        menus = [
            (self.tr("Tree"), "Tree"),
            (self.tr("Index cards"), "Cork"),
            (self.tr("Outline"), "Outline")
        ]

        submenus = {
            "Tree": [
                (self.tr("Icon color"), "Icon"),
                (self.tr("Text color"), "Text"),
                (self.tr("Background color"), "Background"),
            ],
            "Cork": [
                (self.tr("Icon"), "Icon"),
                (self.tr("Text"), "Text"),
                (self.tr("Background"), "Background"),
                (self.tr("Border"), "Border"),
                (self.tr("Corner"), "Corner"),
            ],
            "Outline": [
                (self.tr("Icon color"), "Icon"),
                (self.tr("Text color"), "Text"),
                (self.tr("Background color"), "Background"),
            ],
        }

        self.menuView.clear()
        self.menuView.addMenu(self.menuMode)
        self.menuView.addSeparator()

        # print("Generating menus with", settings.viewSettings)

        for mnu, mnud in menus:
            m = QMenu(mnu, self.menuView)
            for s, sd in submenus[mnud]:
                m2 = QMenu(s, m)
                agp = QActionGroup(m2)
                for v, vd in values:
                    a = QAction(v, m)
                    a.setCheckable(True)
                    a.setData("{},{},{}".format(mnud, sd, vd))
                    if settings.viewSettings[mnud][sd] == vd:
                        a.setChecked(True)
                    a.triggered.connect(self.setViewSettingsAction, AUC)
                    agp.addAction(a)
                    m2.addAction(a)
                m.addMenu(m2)
            self.menuView.addMenu(m)
开发者ID:TenKeyAngle,项目名称:manuskript,代码行数:60,代码来源:mainWindow.py

示例10: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
    def initUI(self):
        # statusbar
        self.statusB = self.statusBar()
        self.statusB.showMessage('Ready')

        # setup window
        self.setGeometry(50, 50, 800, 600)
        self.setWindowTitle('GoGote')
        self.setWindowIcon(QIcon('png/icon.png'))

        # Initialize central Game Widget and make a new Game
        initialGame = Game()
        self.gameW = GameWidget(self, initialGame)
        self.setCentralWidget(self.gameW)
        # self.statusB.showMessage(self.statusText())

        # define Actions
        exitAct = QAction('&Exit', self)
        exitAct.setShortcut('Ctrl+Q')
        exitAct.setStatusTip('Exit GoGote')
        exitAct.triggered.connect(qApp.quit)

        newGameAct = QAction('&New Game', self)
        newGameAct.setShortcut('Ctrl+N')
        newGameAct.setStatusTip('Start a new Game')
        newGameAct.triggered.connect(self.newGameD)

        closeGameAct = QAction('&Close Game', self)
        closeGameAct.setShortcut('Ctrl+C')
        closeGameAct.setStatusTip('Close current Game')
        closeGameAct.triggered.connect(self.closeGame)

        saveSgfAct = QAction('&Save Game SGF', self)
        saveSgfAct.setShortcut('Ctrl+S')
        saveSgfAct.setStatusTip('Save current game as SGF.')
        saveSgfAct.triggered.connect(self.saveFileDialog)

        viewCoordsAct = QAction('View Coordinates', self, checkable=True)
        viewCoordsAct.setChecked(True)
        viewCoordsAct.triggered.connect(self.gameW.toggleCoords)

        # create a menubar
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(newGameAct)
        fileMenu.addAction(closeGameAct)
        fileMenu.addSeparator()
        fileMenu.addAction(saveSgfAct)
        fileMenu.addSeparator()
        fileMenu.addAction(exitAct)

        viewMenu = menubar.addMenu('&View')
        viewMenu.setStatusTip('Viewmenu')
        viewMenu.addAction(viewCoordsAct)
开发者ID:drseilzug,项目名称:GoGote,代码行数:56,代码来源:GUI.py

示例11: __init__

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

    def __init__(self, app) -> None:
        self._app = app
        self._make_actions()

    def _make_actions(self):
        self.enable_filesystem = QAction(QIcon.fromTheme("drive-harddisk"),
                                         "Allow file manipulation", checkable=True)
        self.enable_filesystem.setChecked(False)
        self.enable_filesystem.triggered.connect(self._app.set_filesystem_enabled)
开发者ID:Grumbel,项目名称:dirtool,代码行数:13,代码来源:application_actions.py

示例12: addCustomWidget

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def addCustomWidget(self, text, widget, group=None):
     a = QAction(text, self)
     a.setCheckable(True)
     a.setChecked(widget.isVisible())
     a.toggled.connect(widget.setVisible)
     # widget.installEventFilter(self)
     b = verticalButton(self)
     b.setDefaultAction(a)
     #b.setChecked(widget.isVisible())
     a2 = self.addWidget(b)
     self.otherWidgets.append((b, a2, widget, group))
开发者ID:georgehank,项目名称:manuskript,代码行数:13,代码来源:collapsibleDockWidgets.py

示例13: updateDevices

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def updateDevices(self):
     for action in self.deviceGroup.actions():
         self.deviceGroup.removeAction(action)
         self.menuDevice.removeAction(action)
     for device in self.devices:
         action = QAction(device.name, self.menuDevice)
         action.setCheckable(True)
         action.setData(device)
         self.menuDevice.addAction(action)
         self.deviceGroup.addAction(action)
     action.setChecked(True)
     self.device = device
开发者ID:sonejostudios,项目名称:superboucle,代码行数:14,代码来源:gui.py

示例14: setup_terrain_display_toggles

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
 def setup_terrain_display_toggles(self):
     for mode, name in ((SHOW_TERRAIN_REGULAR, "Show Heightmap"),
                         (SHOW_TERRAIN_LIGHT, "Show Lightmap")):
         toggle = self.make_terrain_toggle(mode)
         toggle_action = QAction(name, self)
         toggle_action.setCheckable(True)
         if mode == SHOW_TERRAIN_REGULAR:
             toggle_action.setChecked(True)
         else:
             toggle_action.setChecked(False)
         toggle_action.triggered.connect(toggle)
         self.terrain_menu.addAction(toggle_action)
         self.terrain_display_actions.append((toggle_action, toggle, mode))
开发者ID:RenolY2,项目名称:battalion-tools-gui,代码行数:15,代码来源:bw_level_edit.py

示例15: updateMenuDict

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setChecked [as 别名]
    def updateMenuDict(self):

        if not enchant:
            return

        self.menuDict.clear()
        for i in enchant.list_dicts():
            a = QAction(str(i[0]), self)
            a.setCheckable(True)
            if settings.dict is None:
                settings.dict = enchant.get_default_language()
            if str(i[0]) == settings.dict:
                a.setChecked(True)
            a.triggered.connect(self.setDictionary, AUC)
            self.menuDictGroup.addAction(a)
            self.menuDict.addAction(a)
开发者ID:tdannecy,项目名称:manuskript,代码行数:18,代码来源:mainWindow.py


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