我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QAction()。
def CustomContextMenuHandler(self, pos): menu = QtGui.QMenu(self) menu.addAction(QtGui.QAction("Xref ...", self, statusTip="List the references where this element is used", triggered=self.actionXref)) menu.addAction(QtGui.QAction("Go to...", self, statusTip="Go to element definition", triggered=self.actionGoto)) menu.addAction(QtGui.QAction("Rename...", self, statusTip="Rename an element (class, method, ...)", triggered=self.actionRename)) menu.addAction(QtGui.QAction("Info...", self, statusTip="Display info of an element (anything useful in the document)", triggered=self.actionInfo)) menu.addAction(QtGui.QAction("Reload sources...", self, statusTip="Reload sources (needed when renaming changed other tabs)", triggered=self.reload_java_sources)) menu.addAction(QtGui.QAction("Open bytecodes...", self, statusTip="", triggered=self.display_bytecodes)) menu.exec_(QtGui.QCursor.pos())
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
def init_tray(self): self._popup_shown = False self.trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon("icons/windows_icon.ico"),self) self.trayIconMenu = QtGui.QMenu() self.openAction = QtGui.QAction("&Show/Hide", self, triggered=self._showhide) self.startupAction = QtGui.QAction("Start &Automatically", self, triggered=self.toggle_startup) self.exitAction = QtGui.QAction("&Exit", self, triggered=self._icon_exit) self.startupAction.setCheckable(True) self.startupAction.setChecked(check_startup()) self.trayIconMenu.addAction(self.openAction) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.startupAction) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.exitAction) self.trayIcon.setContextMenu(self.trayIconMenu) self.trayIcon.activated.connect(self._icon_activated) self._show_when_systray_available()
def qui_menu(self, action_list_str, menu_str): # qui menu creation # syntax: self.qui_menu('right_menu_createFolder_atn;Create Folder,Ctrl+D | right_menu_openFolder_atn;Open Folder', 'right_menu') if menu_str not in self.uiList.keys(): self.uiList[menu_str] = QtWidgets.QMenu() create_opt_list = [ x.strip() for x in action_list_str.split('|') ] for each_creation in create_opt_list: ui_info = [ x.strip() for x in each_creation.split(';') ] atn_name = ui_info[0] atn_title = '' atn_hotkey = '' if len(ui_info) > 1: options = ui_info[1].split(',') atn_title = '' if len(options) < 1 else options[0] atn_hotkey = '' if len(options) < 2 else options[1] if atn_name != '': if atn_name == '_': self.uiList[menu_str].addSeparator() else: if atn_name not in self.uiList.keys(): self.uiList[atn_name] = QtWidgets.QAction(atn_title, self) if atn_hotkey != '': self.uiList[atn_name].setShortcut(QtGui.QKeySequence(atn_hotkey)) self.uiList[menu_str].addAction(self.uiList[atn_name])
def setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
def CustomContextMenuHandler(self, pos): menu = QtGui.QMenu(self) menu.addAction(QtGui.QAction("Xref from...", self, statusTip="List the references where this element is used", triggered=self.actionXref)) menu.addAction(QtGui.QAction("Go to...", self, statusTip="Go to element definition", triggered=self.actionGoto)) menu.addAction(QtGui.QAction("Rename...", self, statusTip="Rename an element (class, method, ...)", triggered=self.actionRename)) menu.addAction(QtGui.QAction("Info...", self, statusTip="Display info of an element (anything useful in the document)", triggered=self.actionInfo)) menu.addAction(QtGui.QAction("Reload sources...", self, statusTip="Reload sources (needed when renaming changed other tabs)", triggered=self.reload_java_sources)) menu.exec_(QtGui.QCursor.pos())
def setupToolButtonExtra(self): self.menu = QtGui.QMenu() self.ag = QtGui.QActionGroup(self.menu) for n in valid_select: a1 = QtGui.QAction(select_names[n], self.menu) def closure(n): def fn(): self.__set_version(n) self.toolButton.click() return fn a1.triggered.connect(closure(n)) self.menu.addAction(a1) self.ag.addAction(a1) self.toolButton.setMenu(self.menu) self.__update_icon()
def aboutShowMenu(self): self.menu.clear() self.ag = QtGui.QActionGroup(self.menu) self.ag.setExclusive(True) for n, vp in enumerate(self.project.stackup.via_pairs): l1, l2 = vp.layers a1 = QtGui.QAction("%d-%d" % (l1.order, l2.order), self.menu) a1.setCheckable(True) a1.setChecked(vp is self.model.current_layer_pair) def closure(vp): def fn(): self.__changed_selected_viapair(vp) return fn a1.triggered.connect(closure(vp)) self.menu.addAction(a1) self.ag.addAction(a1)
def createActions(self): self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", triggered=self.close) self.saveAction = QtGui.QAction("Save", self, shortcut="Ctrl+S", triggered=self.save) self.saveAsAction = QtGui.QAction("Save-As", self, shortcut="Ctrl+Shift+S", triggered=self.saveAs) self.editStackup = QtGui.QAction("Edit Stackup", self, triggered=self.doStackupSetup) self.rebuildConnectivity = QtGui.QAction("Rebuild Connectivity", self, triggered=self.project.artwork.rebuild_connectivity) self.editLayerViews = QtGui.QAction("Edit Stackup/Imagery pairing", self, triggered=self.doLayerviewSetup)
def __init__(self, mw): QtGui.QMenu.__init__(self, "&File", mw) # Build the "Add" menu self.__menu_add = self.addMenu("Add") # TODO: Move the addImage action to the action package act = QtGui.QAction("Image", mw, triggered=mw.addImage) self.__menu_add.addAction(act) # Add the rest of the actions self.addSeparator() self.addAction(mw.saveAction) self.addAction(mw.saveAsAction) self.addSeparator() self.addAction(mw.exitAct) # the "save" option is disabled if a) the project hasn't changed # or b) the save location isn't defined def updateCanSave(): mw.saveAction.setEnabled(mw.project.can_save) # So update the "greyed" state immediately before rendering self.aboutToShow.connect(updateCanSave)
def createAction(self, text, tooltip, icon): action = QtGui.QAction(text, self) action.setToolTip(tooltip) action.setStatusTip(tooltip) action.setIcon(QtGui.QIcon(icon)) #action.setIcon(QtGui.QIcon(__currentPath__ + "/data/img/" + icon)) return action #def getMainWindow(self): #toplevel = QtGui.qApp.topLevelWidgets() #for i in toplevel: #if i.metaObject().className() == "Gui::MainWindow": #return i
def update_recently_opened(self, paths): """ Update the recently opened menu with new entries. :param paths: The disk paths of the recently opened sessions. """ self.open_recent_menu.clear() for i, path in enumerate(paths): action = QtGui.QAction(os.path.basename(path), self, triggered=lambda *_: self.open_session(path)) self.open_recent_menu.addAction(action) if len(paths) == 0: self._no_recent_sessions = QtGui.QAction( "(No recent sessions)", self, triggered=lambda *_: None) self._no_recent_sessions.setEnabled(False) self.open_recent_menu.addAction(self._no_recent_sessions) self.open_recent_menu.addSeparator() self.open_recent_menu.addAction(QtGui.QAction("Clear recently opened", self, statusTip="Clear the recently opened sessions", triggered=self.clear_recently_opened)) return None
def createActions(self): self.xrefAct = QtGui.QAction("Xref from/to...", self, # shortcut=QtGui.QKeySequence("CTRL+B"), statusTip="List the references where this element is used", triggered=self.actionXref) self.expandAct = QtGui.QAction("Expand...", self, statusTip="Expand all the subtrees", triggered=self.actionExpand) self.collapseAct = QtGui.QAction("Collapse...", self, statusTip="Collapse all the subtrees", triggered=self.actionCollapse)
def initMenus(self): exitAction = QAction('&Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(QApplication.instance().quit) self.fileMenu.addAction(exitAction)
def contextMenuEvent(self, event): menu = QtGui.QMenu() testAction = QtGui.QAction('Select This Community Over Time', None) CommunityAction= QtGui.QAction('Select This Community', None) testAction.triggered.connect(self.SelectCommunitiesOverTime) CommunityAction.triggered.connect(self.SelectingCommunityInThisTimestep) menu.addAction(testAction) menu.addAction(CommunityAction) menu.exec_(event.screenPos())
def scaleView(self, scaleFactor): factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width() if factor < 0.07 or factor > 100: return self.scale(scaleFactor, scaleFactor) del factor # def contextMenuEvent(self, event): # menu = QtGfui.QMenu() # testAction = QtGui.QAction('Refresh Screen', None) # testAction.triggered.connect(self.RefreshInteractivityData) # menu.addAction(testAction) # # menu.exec_(event.globalPos())
def _action(self, name, callback=None, icon_path=None): """ Create an action and store it in self.actions. """ action = QtGui.QAction(self) action.setText(name) if icon_path: action.setIcon(icon_path) if callback: action.connect(action, QtCore.SIGNAL("triggered()"), callback) return action
def setLang(self, langName): lang_data = self.memoData['lang'][langName] for ui_name in lang_data.keys(): if ui_name in self.uiList.keys() and lang_data[ui_name] != '': ui_element = self.uiList[ui_name] # '' means no translation availdanle in that data file if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ): # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox ui_element.setText(lang_data[ui_name]) elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ): # uiType: QMenu, QGroupBox ui_element.setTitle(lang_data[ui_name]) elif isinstance(ui_element, QtWidgets.QTabWidget): # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = lang_data[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != '': ui_element.setTabText(i,tabNameList[i]) elif isinstance(ui_element, QtWidgets.QComboBox): # uiType: QComboBox itemCnt = ui_element.count() itemNameList = lang_data[ui_name].split(';') ui_element.clear() ui_element.addItems(itemNameList) elif isinstance(ui_element, QtWidgets.QTreeWidget): # uiType: QTreeWidget labelCnt = ui_element.headerItem().columnCount() labelList = lang_data[ui_name].split(';') ui_element.setHeaderLabels(labelList) elif isinstance(ui_element, QtWidgets.QTableWidget): # uiType: QTableWidget colCnt = ui_element.columnCount() headerList = lang_data[ui_name].split(';') cur_table.setHorizontalHeaderLabels( headerList ) elif isinstance(ui_element, (str, unicode) ): # uiType: string for msg self.uiList[ui_name] = lang_data[ui_name]
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
def loadLang(self): self.quickMenu(['language_menu;&Language']) cur_menu = self.uiList['language_menu'] self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu) cur_menu.addSeparator() self.uiList['langDefault_atnLang'].triggered.connect(partial(self.setLang,'default')) # store default language self.memoData['lang']={} self.memoData['lang']['default']={} for ui_name in self.uiList: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox self.memoData['lang']['default'][ui_name] = str(ui_element.text()) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox self.memoData['lang']['default'][ui_name] = str(ui_element.title()) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = [] for i in range(tabCnt): tabNameList.append(str(ui_element.tabText(i))) self.memoData['lang']['default'][ui_name]=';'.join(tabNameList) elif type(ui_element) == str: # uiType: string for msg self.memoData['lang']['default'][ui_name] = self.uiList[ui_name] # try load other language lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__)) baseName = os.path.splitext( os.path.basename(self.location) )[0] for fileName in os.listdir(lang_path): if fileName.startswith(baseName+"_lang_"): langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","") self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) ) self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu) self.uiList[langName+'_atnLang'].triggered.connect(partial(self.setLang,langName)) # if no language file detected, add export default language option if len(self.memoData['lang']) == 1: self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu) self.uiList['langExport_atnLang'].triggered.connect(self.exportLang)
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
def loadLang(self): self.quickMenu(['language_menu;&Language']) cur_menu = self.uiList['language_menu'] self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu) cur_menu.addSeparator() QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') ) # store default language self.memoData['lang']={} self.memoData['lang']['default']={} for ui_name in self.uiList: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox self.memoData['lang']['default'][ui_name] = str(ui_element.text()) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox self.memoData['lang']['default'][ui_name] = str(ui_element.title()) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() tabNameList = [] for i in range(tabCnt): tabNameList.append(str(ui_element.tabText(i))) self.memoData['lang']['default'][ui_name]=';'.join(tabNameList) elif type(ui_element) == str: # uiType: string for msg self.memoData['lang']['default'][ui_name] = self.uiList[ui_name] # try load other language lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__)) baseName = os.path.splitext( os.path.basename(self.location) )[0] for fileName in os.listdir(lang_path): if fileName.startswith(baseName+"_lang_"): langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","") self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) ) self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu) QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) ) # if no language file detected, add export default language option if len(self.memoData['lang']) == 1: self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu) QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang )
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtGui.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
def qui_menu(self, action_list_str, menu_str): # for context menu quick creation # syntax: self.qui_menu('right_menu_createFolder_atn;Create Folder | right_menu_openFolder_atn;Open Folder', 'right_menu') if menu_str not in self.uiList.keys(): self.uiList[menu_str] = QtWidgets.QMenu() create_opt_list = [ x.strip() for x in action_list_str.split('|') ] for each_creation in create_opt_list: options = [ x.strip() for x in each_creation.split(';') ] atn_name = options[0] atn_title = '' if len(options) < 2 else options[1] if atn_name != '': if atn_name not in self.uiList.keys(): self.uiList[atn_name] = QtWidgets.QAction(atn_title, self) self.uiList[menu_str].addAction(self.uiList[atn_name])
def chat_add_line_to_message(self, add_window, v_layout): # H h_layout = QtGui.QHBoxLayout() line_frame = QtGui.QFrame(parent = add_window.new_topics_frame) # button button = QtGui.QPushButton('img', parent = line_frame) button.setFixedSize(100, 100) button.img_path = False h_layout.addWidget(button) # -- button connect button.clicked.connect(partial(self.chat_image_view_ui, button)) button.setContextMenuPolicy( QtCore.Qt.ActionsContextMenu ) addgrup_action = QtGui.QAction( 'Inser Image From Clipboard', add_window) addgrup_action.triggered.connect(partial(self.chat_add_img_to_line, button)) button.addAction( addgrup_action ) # text field text_field = QtGui.QTextEdit(parent = line_frame) text_field.setMaximumHeight(100) h_layout.addWidget(text_field) line_frame.setLayout(h_layout) v_layout.addWidget(line_frame) # ****** append line data # -- get num numbers = [] for key in add_window.line_data.keys(): numbers.append(int(key)) num = max(numbers) + 1 add_window.line_data[str(num)] = (button, text_field)
def tm_edit_readers_ui(self): # create window loader = QtUiTools.QUiLoader() file = QtCore.QFile(self.select_from_list_dialog_3button_path) #file.open(QtCore.QFile.ReadOnly) window = self.editReadersDialog = loader.load(file, self) file.close() # set modal window window.setWindowModality(QtCore.Qt.WindowModal) window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # edit Widget window.setWindowTitle('Edit Readers List') window.pushButton_01.setText('Remove Readers') window.pushButton_02.setText('Add Readers') # -- selection mode table = window.select_from_list_data_list_table table.setSortingEnabled(True) table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) table.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) # table_2 context menu table.setContextMenuPolicy( QtCore.Qt.ActionsContextMenu ) addgrup_action = QtGui.QAction( 'make First', self.myWidget) addgrup_action.triggered.connect(partial(self.tm_make_first_reader, table)) table.addAction( addgrup_action ) # button connect window.select_from_list_cansel_button.clicked.connect(partial(self.close_window, window)) window.pushButton_01.clicked.connect(partial(self.tm_remove_reader_action)) window.pushButton_02.clicked.connect(self.tm_add_readers_ui) # load table self.tm_edit_readers_ui_reload_table() window.show()
def addSourceDelegate(self, src): def addSource(source): if source: self.sandbox.addSource(source) action = QtGui.QAction(src.display_name, self) action.setToolTip('<span style="font-family: monospace;">' '%s</span>' % src.__represents__) action.triggered.connect( partial(addSource, src.getRepresentedSource(self.sandbox))) self.addAction(action) return action
def addSection(self, text): action = QtGui.QAction(text, self) # action.setSeparator(True) font = action.font() font.setPointSize(9) font.setItalic(True) action.setFont(font) action.setEnabled(False) self.addAction(action) return action
def createActions(self): self.minimizeAction = QtGui.QAction("Mi&nimize", self, triggered=self.hide) self.maximizeAction = QtGui.QAction("Ma&ximize", self, triggered=self.showMaximized) self.restoreAction = QtGui.QAction("&Restore", self, triggered=self.showNormal) self.quitAction = QtGui.QAction("&Quit", self, triggered=QtGui.qApp.quit)
def createActions(self): self.xrefAct = QtGui.QAction("Xref from...", self, # shortcut=QtGui.QKeySequence("CTRL+B"), statusTip="List the references where this element is used", triggered=self.actionXref) self.expandAct = QtGui.QAction("Expand...", self, statusTip="Expand all the subtrees", triggered=self.actionExpand) self.collapseAct = QtGui.QAction("Collapse...", self, statusTip="Collapse all the subtrees", triggered=self.actionCollapse)
def actions(self): self.renameAct = QtGui.QAction("&Rename Pose", self, shortcut=Qt.Key_F2, statusTip="rename the current pose", triggered=self.renamePose) self.deleteAct = QtGui.QAction("&Delete Pose", self, shortcut=QtGui.QKeySequence.Delete, statusTip="delete the current pose", triggered=self.deletePose) # menu actions
def __init__ (self, errors, parent = None) : #super (ErrorsDialog, self).__init__ () super (ErrorsDialog, self).__init__ (parent) errors.reverse () self.parent = parent #print self.parent.current_file, self.parent.current_list self.setAttribute (QtCore.Qt.WA_DeleteOnClose) saveAction = QtGui.QAction('Save log...', self) saveAction.setShortcut('Ctrl+S') saveAction.setStatusTip('Save displayed log file.') saveAction.triggered.connect(self.saveFile) saveErrAction = QtGui.QAction('Save unprocessed list...', self) saveErrAction.setShortcut('Ctrl+U') saveErrAction.setStatusTip('Save a list of unprocessed raw files.') saveErrAction.triggered.connect(self.saveErrFile) closeAction = QtGui.QAction('Close', self) closeAction.setShortcut('Ctrl+Q') closeAction.setStatusTip('Close error display') closeAction.triggered.connect(self.close) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(saveAction) fileMenu.addAction (saveErrAction) fileMenu.addAction(closeAction) self.text = QtGui.QTextEdit(self) self.setCentralWidget(self.text) self.setGeometry(300,300,800,300) self.setWindowTitle('Errors X') self.show() self.setIt (errors) self.whatsLeft ()
def createActions(self): self.runAct = QtGui.QAction ("&Run", self, statusTip="Initiate processing.", triggered=self.newFamily) self.mergeAct = QtGui.QAction ("&Merge", self, statusTip="Merge processed families to a single family.", triggered=self.mergeFamily) self.timeoutAct = QtGui.QAction ("Set &Timeout...", self, statusTip="Change timeout to process a single raw file.", triggered=self.setTimeout) self.utmAct = QtGui.QAction ("&UTM zone...", self, statusTip="UTM zone. For some SEG-D data.", triggered=self.setUTMZone) self.combineAct = QtGui.QAction ("Combine # of SEG-D traces in ph5...", self, statusTip="Combine a number of SEG-D traces for faster processing.", triggered=self.setCombineSEGD) self.resetAct = QtGui.QAction ("R&eset", self, statusTip="Reset all family processes.", triggered=self.resetIt) self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", statusTip="Exit the application", triggered=QtGui.qApp.closeAllWindows) self.separatorAct = QtGui.QAction(self) self.separatorAct.setSeparator(True) self.aboutAct = QtGui.QAction("&About", self, statusTip="Show pforma's About box", triggered=self.about) #self.aboutQtAct = QtGui.QAction("About &Qt", self, #statusTip="Show the Qt library's About box", #triggered=QtGui.qApp.aboutQt)