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


Python QtGui.QAction方法代码示例

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


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

示例1: onListImageFilesContextMenuRequested

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def onListImageFilesContextMenuRequested(self, point):
        current_item = self.ui.listWidgetImageFiles.currentItem()
        if current_item is None:
            return

        pop_menu = QtGui.QMenu()
        delete_action = QtGui.QAction(u'删除', self)
        pop_menu.addAction(delete_action)
        delete_action.triggered.connect(self.DeletePatternItem)
        modify_action = QtGui.QAction(u'修改', self)
        pop_menu.addAction(modify_action)
        modify_action.triggered.connect(self.ModifyPatternItem)
        cancel_modify_action = QtGui.QAction(u'取消修改', self)
        pop_menu.addAction(cancel_modify_action)
        cancel_modify_action.triggered.connect(self.CancelModifyPatternItem)
        pop_menu.exec_(QtGui.QCursor.pos()) 
开发者ID:salan668,项目名称:FAE,代码行数:18,代码来源:FeatureExtractionForm.py

示例2: makeActions

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def makeActions(self):
        self.exitAct = QtWidgets.QAction('Exit', self, shortcut='Q', triggered=self.close)
        self.zoomInAct = QtWidgets.QAction(QtGui.QIcon('icons/zoom-in.png'), "Zoom &In (25%)", self, shortcut="up",
                                           triggered=lambda: self.zoom(3.0 / 2.0))
        self.zoomOutAct = QtWidgets.QAction(QtGui.QIcon('icons/zoom-out.png'), "Zoom &Out (25%)", self, shortcut="down",
                                            triggered=lambda: self.zoom(2.0 / 3.0))
        self.fitToWindowAct = QtWidgets.QAction(QtGui.QIcon('icons/zoom-fit-best.png'), "Reset view", self,
                                                shortcut="f",
                                                triggered=self.resetView)
        self.viewAmpAct = QtWidgets.QAction("View as amplitude", self, checkable=True, shortcut="1",
                                            triggered=self.viewAsAmplitude)
        self.viewPhaAct = QtWidgets.QAction("View as phase", self, checkable=True, shortcut="2",
                                            triggered=self.viewAsPhase)
        self.viewCohAct = QtWidgets.QAction("View as coherence", self, checkable=True, shortcut="3",
                                            triggered=self.viewAsCoherence)
        self.viewBrighter = QtWidgets.QAction("View brighter", self, shortcut="right", triggered=self.brighterView)
        self.viewDarker = QtWidgets.QAction("View darker", self, shortcut="left", triggered=self.darkerView)
        self.undoAct = QtWidgets.QAction('Undo', self, shortcut='Ctrl+z', triggered=self.undo)
        self.paletteAct = QtWidgets.QAction(QtGui.QIcon('icons/color_wheel.png'), 'Palette', self,
                                            triggered=self.paletteChooser) 
开发者ID:birgander2,项目名称:PyRAT,代码行数:22,代码来源:Viewer.py

示例3: get_QAction

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def get_QAction():
    """QAction getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QAction
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QAction 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:QtShim.py

示例4: add_header_context_menu

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def add_header_context_menu(self, checked = None, checkable = None, enabled = None):
        """ Adds the context menu from using header information
        
            checked can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checked value from the dictionary. 
            The corresponding column will be hidden if checked is False.
        
            checkable can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the checkable value from the dictionary.
            
            enabled can be a header_name -> boolean dictionary. If given, headers
            with the key name will get the enabled value from the dictionary.
        """
        checked = checked if checked is not None else {}
        checkable = checkable if checkable is not None else {}
        enabled = enabled if enabled is not None else {}
        
        horizontal_header = self._horizontal_header()
        horizontal_header.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        self.toggle_column_actions_group = QtGui.QActionGroup(self)
        self.toggle_column_actions_group.setExclusive(False)
        self.__toggle_functions = []  # for keeping references
        
        for col in range(horizontal_header.count()):
            column_label = self.model().headerData(col, Qt.Horizontal, Qt.DisplayRole)
            logger.debug("Adding: col {}: {}".format(col, column_label))            
            action = QtGui.QAction("Show {} column".format(column_label), 
                                   self.toggle_column_actions_group, 
                                   checkable = checkable.get(column_label, True), 
                                   enabled = enabled.get(column_label, True), 
                                   toolTip = "Shows or hides the {} column".format(column_label))
            func = self.__make_show_column_function(col) 
            self.__toggle_functions.append(func) # keep reference
            horizontal_header.addAction(action)
            is_checked = checked.get(column_label, not horizontal_header.isSectionHidden(col))
            horizontal_header.setSectionHidden(col, not is_checked)
            action.setChecked(is_checked)
            action.toggled.connect(func) 
开发者ID:dragondjf,项目名称:PFramer,代码行数:41,代码来源:toggle_column_mixin.py

示例5: _setup_actions

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def _setup_actions(self):
        """ Creates the main window actions.
        """
        # Show/hide callable objects
        self.toggle_callable_action = \
            QtGui.QAction("Show routine attributes", self, checkable=True, 
                          statusTip = "Shows/hides attributes that are routings (functions, methods, etc)")
        self.toggle_callable_action.toggled.connect(self.toggle_callables)
                              
        # Show/hide special attributes
        self.toggle_special_attribute_action = \
            QtGui.QAction("Show __special__ attributes", self, checkable=True, 
                          statusTip = "Shows or hides __special__ attributes")
        self.toggle_special_attribute_action.toggled.connect(self.toggle_special_attributes) 
开发者ID:dragondjf,项目名称:PFramer,代码行数:16,代码来源:objectbrowser.py

示例6: classifier

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def classifier(parent):
    main_menu = parent.menuBar()
    # classifier menu
    parent.trainfiles = []
    parent.statlabels = None
    parent.loadMenu = QtGui.QMenu("Load", parent)
    parent.loadClass = QtGui.QAction("from file", parent)
    parent.loadClass.triggered.connect(lambda: classgui.load_classifier(parent))
    parent.loadClass.setEnabled(False)
    parent.loadMenu.addAction(parent.loadClass)
    parent.loadUClass = QtGui.QAction("default classifier", parent)
    parent.loadUClass.triggered.connect(lambda: classgui.load_default_classifier(parent))
    parent.loadUClass.setEnabled(False)
    parent.loadMenu.addAction(parent.loadUClass)
    parent.loadSClass = QtGui.QAction("built-in classifier", parent)
    parent.loadSClass.triggered.connect(lambda: classgui.load_s2p_classifier(parent))
    parent.loadSClass.setEnabled(False)
    parent.loadMenu.addAction(parent.loadSClass)
    parent.loadTrain = QtGui.QAction("Build", parent)
    parent.loadTrain.triggered.connect(lambda: classgui.load_list(parent))
    parent.loadTrain.setEnabled(False)
    parent.saveDefault = QtGui.QAction("Save loaded as default", parent)
    parent.saveDefault.triggered.connect(lambda: classgui.class_default(parent))
    parent.saveDefault.setEnabled(False)
    parent.resetDefault = QtGui.QAction("Reset default to built-in", parent)
    parent.resetDefault.triggered.connect(lambda: classgui.reset_default(parent))
    parent.resetDefault.setEnabled(True)
    class_menu = main_menu.addMenu("&Classifier")
    class_menu.addMenu(parent.loadMenu)
    class_menu.addAction(parent.loadTrain)
    class_menu.addAction(parent.resetDefault)
    class_menu.addAction(parent.saveDefault) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:34,代码来源:menus.py

示例7: visualizations

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def visualizations(parent):
    # visualizations menuBar
    main_menu = parent.menuBar()
    vis_menu = main_menu.addMenu("&Visualizations")
    parent.visualizations = QtGui.QAction("&Visualize selected cells", parent)
    parent.visualizations.triggered.connect(lambda: vis_window(parent))
    parent.visualizations.setEnabled(False)
    vis_menu.addAction(parent.visualizations)
    parent.visualizations.setShortcut("Ctrl+V")
    parent.custommask = QtGui.QAction("Load custom hue for ROIs (*.npy)", parent)
    parent.custommask.triggered.connect(lambda: io.load_custom_mask(parent))
    parent.custommask.setEnabled(False)
    vis_menu.addAction(parent.custommask) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:15,代码来源:menus.py

示例8: registration

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def registration(parent):
    # registration menuBar
    main_menu = parent.menuBar()
    reg_menu = main_menu.addMenu("&Registration")
    parent.reg = QtGui.QAction("View registered &binary", parent)
    parent.reg.triggered.connect(lambda: reg_window(parent))
    parent.reg.setShortcut("Ctrl+B")
    parent.reg.setEnabled(True)
    parent.regPC = QtGui.QAction("View registration &Metrics", parent)
    parent.regPC.triggered.connect(lambda: regPC_window(parent))
    parent.regPC.setShortcut("Ctrl+M")
    parent.regPC.setEnabled(True)
    reg_menu.addAction(parent.reg)
    reg_menu.addAction(parent.regPC) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:16,代码来源:menus.py

示例9: mergebar

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def mergebar(parent):
    # merge menuBar
    main_menu = parent.menuBar()
    merge_menu = main_menu.addMenu("&Merge ROIs")
    parent.sugMerge = QtGui.QAction("Auto-suggest merges", parent)
    parent.sugMerge.triggered.connect(lambda: suggest_merge(parent))
    parent.sugMerge.setEnabled(False)
    parent.saveMerge = QtGui.QAction("&Append merges to npy files", parent)
    parent.saveMerge.triggered.connect(lambda: io.save_merge(parent))
    parent.saveMerge.setEnabled(False)
    merge_menu.addAction(parent.sugMerge)
    merge_menu.addAction(parent.saveMerge) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:14,代码来源:menus.py

示例10: makeToolbar

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def makeToolbar(self):
        self.openTB = QtWidgets.QAction(QtGui.QIcon('icons/document-open.png'), 'Open', self,
                                        triggered=lambda: pyrat.load.RatHDF.guirun(self))
        # self.closeTB = QtWidgets.QAction(QtGui.QIcon('icons/document-close.png'), 'Close', self)
        # self.zoominTB = QtGui.QAction(QtGui.QIcon('icons/zoom-in.png'), 'Zoom in', self)
        # self.zoomoutTB = QtGui.QAction(QtGui.QIcon('icons/zoom-out.png'), 'Zoom out', self)
        # self.zoomresetTB = QtGui.QAction(QtGui.QIcon('icons/zoom-fit-best.png'), 'Fit zoom', self)
        self.seperatorTB = QtWidgets.QAction(self)

        self.toolbar1 = self.addToolBar("File")
        self.toolbar1.addAction(self.openTB)
        # self.toolbar1.addAction(self.closeTB)

        self.toolbar2 = self.addToolBar("Display")
        self.toolbar2.addAction(self.zoomOutAct)
        self.viewCombo = QtWidgets.QComboBox(self)
        self.viewCombo.insertItems(1, ["100%", "Fit to window", "Fit to width", "Fit to height", "100%"])
        self.viewCombo.setEditable(False)
        self.viewCombo.activated.connect(self.comboZoom)
        self.toolbar2.addWidget(self.viewCombo)
        self.toolbar2.addAction(self.zoomInAct)
        self.toolbar2.addAction(self.paletteAct)

        # self.toolbar3 = self.addToolBar("Layer")
        # self.toolbar3.addAction(self.zoominTB)
        # self.toolbar3.addAction(self.zoomresetTB)

    # -------------------------------- STATUS BAR 
开发者ID:birgander2,项目名称:PyRAT,代码行数:30,代码来源:Viewer.py

示例11: mainmenu

# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QAction [as 别名]
def mainmenu(parent):
    main_menu = parent.menuBar()
    # --------------- MENU BAR --------------------------
    # run suite2p from scratch
    runS2P = QtGui.QAction("&Run suite2p ", parent)
    runS2P.setShortcut("Ctrl+R")
    runS2P.triggered.connect(lambda: run_suite2p(parent))
    parent.addAction(runS2P)

    # load processed data
    loadProc = QtGui.QAction("&Load processed data", parent)
    loadProc.setShortcut("Ctrl+L")
    loadProc.triggered.connect(lambda: io.load_dialog(parent))
    parent.addAction(loadProc)

    # load processed data
    loadNWB = QtGui.QAction("Load NWB file", parent)
    loadNWB.triggered.connect(lambda: io.load_dialog_NWB(parent))
    parent.addAction(loadNWB)

    # load a behavioral trace
    parent.loadBeh = QtGui.QAction(
        "Load behavior or stim trace (1D only)", parent
    )
    parent.loadBeh.triggered.connect(lambda: io.load_behavior(parent))
    parent.loadBeh.setEnabled(False)
    parent.addAction(parent.loadBeh)

    # save to matlab file
    parent.saveMat = QtGui.QAction("&Save to mat file (*.mat)", parent)
    parent.saveMat.setShortcut("Ctrl+S")
    parent.saveMat.triggered.connect(lambda: io.save_mat(parent))
    parent.saveMat.setEnabled(False)
    parent.addAction(parent.saveMat)


    # export figure
    exportFig = QtGui.QAction("Export as image (svg)", parent)
    exportFig.triggered.connect(lambda: io.export_fig(parent))
    exportFig.setEnabled(True)
    parent.addAction(exportFig)

    # export figure
    parent.manual = QtGui.QAction("Manual labelling", parent)
    parent.manual.triggered.connect(lambda: manual_label(parent))
    parent.manual.setEnabled(False)

    # make mainmenu!
    main_menu = parent.menuBar()
    file_menu = main_menu.addMenu("&File")
    file_menu.addAction(runS2P)
    file_menu.addAction(loadProc)
    file_menu.addAction(loadNWB)
    file_menu.addAction(parent.loadBeh)
    file_menu.addAction(parent.saveMat)
    file_menu.addAction(exportFig)
    file_menu.addAction(parent.manual) 
开发者ID:MouseLand,项目名称:suite2p,代码行数:59,代码来源:menus.py


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