Python PyQt5.QtGui.QAction() Examples
The following are 11 code examples for showing how to use PyQt5.QtGui.QAction(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example 1
Project: FAE Author: salan668 File: FeatureExtractionForm.py License: GNU General Public License v3.0 | 6 votes |
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())
Example 2
Project: PyRAT Author: birgander2 File: Viewer.py License: Mozilla Public License 2.0 | 6 votes |
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)
Example 3
Project: grap Author: AirbusCyber File: QtShim.py License: MIT License | 5 votes |
def get_QAction(): """QAction getter.""" try: import PySide.QtGui as QtGui return QtGui.QAction except ImportError: import PyQt5.QtWidgets as QtWidgets return QtWidgets.QAction
Example 4
Project: PFramer Author: dragondjf File: toggle_column_mixin.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 5
Project: PFramer Author: dragondjf File: objectbrowser.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 6
Project: suite2p Author: MouseLand File: menus.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 7
Project: suite2p Author: MouseLand File: menus.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 8
Project: suite2p Author: MouseLand File: menus.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 9
Project: suite2p Author: MouseLand File: menus.py License: GNU General Public License v3.0 | 5 votes |
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)
Example 10
Project: PyRAT Author: birgander2 File: Viewer.py License: Mozilla Public License 2.0 | 5 votes |
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
Example 11
Project: suite2p Author: MouseLand File: menus.py License: GNU General Public License v3.0 | 4 votes |
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)