Python PyQt4.QtGui.QAction() Examples
The following are 30
code examples of PyQt4.QtGui.QAction().
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 also want to check out all available functions/classes of the module
PyQt4.QtGui
, or try the search function
.
Example #1
Source File: cityscapesLabelTool.py From TFSegmentation with Apache License 2.0 | 6 votes |
def keyReleaseEvent(self,e): # Ctrl key changes mouse cursor if e.key() == QtCore.Qt.Key_Control: QtGui.QApplication.restoreOverrideCursor() # check for zero to release temporary zero # somehow, for the numpad key in some machines, a check on Insert is needed aswell elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert: self.transpTempZero = False self.update() ############################# ## Little helper methods ############################# # Helper method that sets tooltip and statustip # Provide an QAction and the tip text # This text is appended with a hotkeys and then assigned
Example #2
Source File: simulation_form.py From nupic.studio with GNU General Public License v2.0 | 6 votes |
def menuViewsNew_Click(self, event): # Ask for views's name enteredText, ok = QtGui.QInputDialog.getText(self, "Input Dialog", "Enter views' name:") if ok: view = View() view.name = enteredText view.menu = QtGui.QAction(self) view.menu.setText(view.name) view.menu.setCheckable(True) view.menu.triggered.connect(self.menuView_Click) Global.views.append(view) self.menuViews.addAction(view.menu) self.selectView(view.menu)
Example #3
Source File: ggpowindow.py From pyqtggpo with GNU General Public License v2.0 | 6 votes |
def setupMenuSmoothing(self): # unfortunately Qt Designer doesn't support QActionGroup, we have to code it up self.uiMenuSmoothingGroup = QtGui.QActionGroup(self.uiSmoothingMenu, exclusive=True) def onSmoothingToggled(boolean): if boolean: result = re.search(r'[0-9]+', self.sender().text()) if result: Settings.setValue(Settings.SMOOTHING, result.group(0)) desc = defaultdictinit({0: ' More jerky', 1: ' Default', 10: ' Laggy'}) for smooth in range(11): act = QtGui.QAction('&' + str(smooth) + desc[smooth], self) act.setCheckable(True) act.toggled.connect(onSmoothingToggled) self.uiSmoothingMenu.addAction(self.uiMenuSmoothingGroup.addAction(act)) cleanname = self.buildInSmoothingToActionName(smooth) setattr(self, cleanname, act)
Example #4
Source File: gui.py From PrusaControl with GNU General Public License v3.0 | 6 votes |
def get_actual_action_list(self, button_widget): actionList = [] action = QAction(self.tr("Save G-Code"), self) action.triggered.connect(self.controller.generate_button_pressed) actionList.append(action) for address in self.controller.list_of_printing_services: action_tmp = QAction("Print on %s" % address, self) action_tmp.triggered.connect(self.make_action) actionList.append(action_tmp) action_tmp = QAction("Add OctoPrint", self) action_tmp.triggered.connect(self.controller.add_new_octoprint) actionList.append(action_tmp) return actionList
Example #5
Source File: cityscapesLabelTool.py From Detectron-PYTORCH with Apache License 2.0 | 6 votes |
def keyReleaseEvent(self,e): # Ctrl key changes mouse cursor if e.key() == QtCore.Qt.Key_Control: QtGui.QApplication.restoreOverrideCursor() # check for zero to release temporary zero # somehow, for the numpad key in some machines, a check on Insert is needed aswell elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert: self.transpTempZero = False self.update() ############################# ## Little helper methods ############################# # Helper method that sets tooltip and statustip # Provide an QAction and the tip text # This text is appended with a hotkeys and then assigned
Example #6
Source File: emoticonsdialog.py From pyqtggpo with GNU General Public License v2.0 | 6 votes |
def __init__(self, *args, **kwargs): super(EmoticonDialog, self).__init__(*args, **kwargs) saved = Settings.value(Settings.EMOTICON_DIALOG_GEOMETRY) if saved: self.restoreGeometry(saved) self._value = '' flowLayout = FlowLayout(self) customEmoticons = Settings.value(Settings.CUSTOM_EMOTICONS) if customEmoticons: customEmoticons = filter(None, [line.strip() for line in customEmoticons.split("\n") if 0 < len(line) < 64]) else: customEmoticons = [] for emoticon in customEmoticons + _emoticons.split("\n"): act = QtGui.QAction(emoticon, self) act.triggered.connect(self.onActionTriggered) btn = QtGui.QToolButton(self) btn.setDefaultAction(act) flowLayout.addWidget(btn) self.setLayout(flowLayout) self.setWindowTitle("Insert emoticon") self.accepted.connect(self.saveGeometrySettings) self.finished.connect(self.saveGeometrySettings) self.rejected.connect(self.saveGeometrySettings)
Example #7
Source File: universal_tool_template_1010.py From universal_tool_template.py with MIT License | 6 votes |
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 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])
Example #8
Source File: cityscapesLabelTool.py From fcn8s_tensorflow with GNU General Public License v3.0 | 6 votes |
def keyReleaseEvent(self,e): # Ctrl key changes mouse cursor if e.key() == QtCore.Qt.Key_Control: QtGui.QApplication.restoreOverrideCursor() # check for zero to release temporary zero # somehow, for the numpad key in some machines, a check on Insert is needed aswell elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert: self.transpTempZero = False self.update() ############################# ## Little helper methods ############################# # Helper method that sets tooltip and statustip # Provide an QAction and the tip text # This text is appended with a hotkeys and then assigned
Example #9
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 6 votes |
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]
Example #10
Source File: cityscapesLabelTool.py From LightNet with MIT License | 6 votes |
def keyReleaseEvent(self,e): # Ctrl key changes mouse cursor if e.key() == QtCore.Qt.Key_Control: QtGui.QApplication.restoreOverrideCursor() # check for zero to release temporary zero # somehow, for the numpad key in some machines, a check on Insert is needed aswell elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert: self.transpTempZero = False self.update() ############################# ## Little helper methods ############################# # Helper method that sets tooltip and statustip # Provide an QAction and the tip text # This text is appended with a hotkeys and then assigned
Example #11
Source File: UITranslator_v1.0.py From universal_tool_template.py with MIT License | 6 votes |
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]
Example #12
Source File: universal_tool_template_1116.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #13
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #14
Source File: universal_tool_template_1020.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #15
Source File: ClassName_1010.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #16
Source File: universal_tool_template_2010.py From universal_tool_template.py with MIT License | 6 votes |
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]
Example #17
Source File: universal_tool_template_2010.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #18
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #19
Source File: UITranslator.py From universal_tool_template.py with MIT License | 6 votes |
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]
Example #20
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #21
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 6 votes |
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])
Example #22
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 5 votes |
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]
Example #23
Source File: uiBasicWidget.py From InplusTrader_Linux with MIT License | 5 votes |
def initMenu(self): """初始化右键菜单""" self.menu = QtGui.QMenu(self) saveAction = QtGui.QAction(u'保存内容', self) saveAction.triggered.connect(self.saveToCsv) self.menu.addAction(saveAction) #----------------------------------------------------------------------
Example #24
Source File: writer.py From Writer with MIT License | 5 votes |
def initMenubar(self): menubar = self.menuBar() file = menubar.addMenu("File") edit = menubar.addMenu("Edit") view = menubar.addMenu("View") # Add the most important actions to the menubar file.addAction(self.newAction) file.addAction(self.openAction) file.addAction(self.saveAction) file.addAction(self.printAction) file.addAction(self.previewAction) edit.addAction(self.undoAction) edit.addAction(self.redoAction) edit.addAction(self.cutAction) edit.addAction(self.copyAction) edit.addAction(self.pasteAction) edit.addAction(self.findAction) # Toggling actions for the various bars toolbarAction = QtGui.QAction("Toggle Toolbar",self) toolbarAction.triggered.connect(self.toggleToolbar) formatbarAction = QtGui.QAction("Toggle Formatbar",self) formatbarAction.triggered.connect(self.toggleFormatbar) statusbarAction = QtGui.QAction("Toggle Statusbar",self) statusbarAction.triggered.connect(self.toggleStatusbar) view.addAction(toolbarAction) view.addAction(formatbarAction) view.addAction(statusbarAction)
Example #25
Source File: mainwindow.py From nike_purchase_system with GNU General Public License v3.0 | 5 votes |
def __init__(self, a, b, c): super(NikeProxiesPoolTableWidget, self).__init__(a, b, c) self.menu = None self.delete_action = QtGui.QAction('删除该行', self)
Example #26
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 5 votes |
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
Example #27
Source File: gui.py From Pic-Numero with MIT License | 5 votes |
def create_toolbar(self): settingsAction = QtGui.QAction("&Set Cluster Parameters", self) settingsAction.setShortcut("Ctrl+Q") settingsAction.triggered.connect(didPressSettingsMenuItem) settingsMenu = QtGui.QMenu(self) settingsMenu.addAction(settingsAction) toolBar = QtGui.QToolBar() settingsButton = QtGui.QToolButton() settingsButton.setPopupMode(QtGui.QToolButton.MenuButtonPopup) settingsButton.setText("Settings") settingsButton.setMenu(settingsMenu) toolBar.addWidget(settingsButton) self.layout.addWidget(toolBar)
Example #28
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 5 votes |
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
Example #29
Source File: uiBasicWidget.py From InplusTrader_Linux with MIT License | 5 votes |
def addMenuAction(self): """增加右键菜单内容""" refreshAction = QtGui.QAction(u'刷新', self) refreshAction.triggered.connect(self.refresh) self.menu.addAction(refreshAction) #----------------------------------------------------------------------
Example #30
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 5 votes |
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