Python PySide2.QtWidgets.QAction() Examples
The following are 30
code examples of PySide2.QtWidgets.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
PySide2.QtWidgets
, or try the search function
.
Example #1
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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #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: toolbar.py From angr-management with BSD 2-Clause "Simplified" License | 6 votes |
def _translate_element(toolbar, action): if isinstance(action, ToolbarSplitter): toolbar.addSeparator() return None elif isinstance(action, ToolbarAction): if action.icon is not None: act = QAction(action.icon, action.name, toolbar) else: act = QAction(action.name, toolbar) if action.triggered is not None: act.triggered.connect(action.triggered) if action.tooltip: act.setToolTip(action.tooltip) act.setCheckable(action.checkable) toolbar.addAction(act) return act else: raise TypeError("Bad toolbar action", action)
Example #14
Source File: FileSystemWidget.py From pyrdp with GNU General Public License v3.0 | 6 votes |
def onCustomContextMenu(self, localPosition: QPoint): """ Show a custom context menu with a "Download file" action when a file is right-clicked. :param localPosition: position where the user clicked. """ selectedFile = self.selectedFile() if selectedFile is None: return globalPosition = self.listWidget.mapToGlobal(localPosition) downloadAction = QAction("Download file") downloadAction.setEnabled(selectedFile.type in [FileSystemItemType.File]) downloadAction.triggered.connect(self.downloadFile) downloadRecursiveAction = QAction("Download files recursively") downloadRecursiveAction.setEnabled(selectedFile.type in [FileSystemItemType.Directory]) downloadRecursiveAction.triggered.connect(self.downloadDirectoryRecursively) itemMenu = QMenu() itemMenu.addAction(downloadAction) itemMenu.addAction(downloadRecursiveAction) itemMenu.exec_(globalPosition)
Example #15
Source File: MenusTools.py From PyAero with MIT License | 6 votes |
def createTools(self): """create the toolbar and populate it automatically from method toolData """ # create a tool bar self.toolbar = self.parent.addToolBar('Toolbar') for tip, icon, handler in self.getToolbarData(): if len(tip) == 0: self.toolbar.addSeparator() continue icon = QtGui.QIcon(ICONS_L + icon) action = QtWidgets.QAction( icon, tip, self.parent, triggered=eval( 'self.parent.slots.' + handler)) self.toolbar.addAction(action)
Example #16
Source File: MenusTools.py From PyAero with MIT License | 6 votes |
def createPullDown(self, menu, eachPullDown): """create the submenu structure to method createMenus""" for name, tip, short, icon, handler in eachPullDown: if len(name) == 0: menu.addSeparator() continue icon = QtGui.QIcon(ICONS_S + icon) logger.debug('HANDLER: {}'.format(handler)) if 'aboutQt' not in handler: handler = 'self.parent.slots.' + handler action = QtWidgets.QAction(icon, name, self.parent, shortcut=short, statusTip=tip, triggered=eval(handler)) menu.addAction(action)
Example #17
Source File: main_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _create_open_map_tracker_actions(self): base_layout = self.preset_manager.default_preset.layout_configuration for trick_level in LayoutTrickLevel: if trick_level != LayoutTrickLevel.MINIMAL_RESTRICTIONS: action = QtWidgets.QAction(self) action.setText(trick_level.long_name) self.menu_map_tracker.addAction(action) configuration = dataclasses.replace( base_layout, trick_level_configuration=TrickLevelConfiguration(trick_level, {}) ) action.triggered.connect(partial(self.open_map_tracker, configuration))
Example #18
Source File: universal_tool_template_1000.py From universal_tool_template.py with MIT License | 5 votes |
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])
Example #19
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
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])
Example #20
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 5 votes |
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)
Example #21
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 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 #22
Source File: universal_tool_template_0803.py From universal_tool_template.py with MIT License | 5 votes |
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])
Example #23
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 5 votes |
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])
Example #24
Source File: universal_tool_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
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])
Example #25
Source File: main_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def display_new_version(self, version: update_checker.VersionDescription): if self.menu_new_version is None: self.menu_new_version = QAction("", self) self.menu_new_version.triggered.connect(self.open_version_link) self.menu_bar.addAction(self.menu_new_version) self.menu_new_version.setText("New version available: {}".format(version.tag_name)) self._current_version_url = version.html_url
Example #26
Source File: manager.py From hotbox_designer with BSD 3-Clause Clear License | 5 votes |
def __init__(self, parent=None): super(HotboxManagerToolbar, self).__init__(parent) self.setIconSize(QtCore.QSize(16, 16)) self.new = QtWidgets.QAction(icon('manager-new.png'), '', self) self.new.setToolTip('Create new hotbox') self.new.triggered.connect(self.newRequested.emit) self.edit = QtWidgets.QAction(icon('manager-edit.png'), '', self) self.edit.setToolTip('Edit hotbox') self.edit.triggered.connect(self.editRequested.emit) self.delete = QtWidgets.QAction(icon('manager-delete.png'), '', self) self.delete.setToolTip('Delete hotbox') self.delete.triggered.connect(self.deleteRequested.emit) self.link = QtWidgets.QAction(icon('link.png'), '', self) self.link.setToolTip('Link to external hotbox file') self.link.triggered.connect(self.linkRequested.emit) self.unlink = QtWidgets.QAction(icon('unlink.png'), '', self) self.unlink.setToolTip('Remove hotbox file link') self.unlink.triggered.connect(self.unlinkRequested.emit) self.import_ = QtWidgets.QAction(icon('manager-import.png'), '', self) self.import_.setToolTip('Import hotbox') self.import_.triggered.connect(self.importRequested.emit) self.export = QtWidgets.QAction(icon('manager-export.png'), '', self) self.export.setToolTip('Export hotbox') self.export.triggered.connect(self.exportRequested.emit) self.hotkeyset = QtWidgets.QAction(icon('touch.png'), '', self) self.hotkeyset.setToolTip('Set hotkey') self.hotkeyset.triggered.connect(self.setHotkeyRequested.emit) self.addAction(self.new) self.addAction(self.edit) self.addAction(self.delete) self.addSeparator() self.addAction(self.link) self.addAction(self.unlink) self.addSeparator() self.addAction(self.import_) self.addAction(self.export) self.addSeparator() self.addAction(self.hotkeyset)
Example #27
Source File: main_window.py From randovania with GNU General Public License v3.0 | 5 votes |
def _setup_difficulties_menu(self): game = default_database.default_prime2_game_description() for i, trick_level in enumerate(LayoutTrickLevel): if trick_level not in {LayoutTrickLevel.NO_TRICKS, LayoutTrickLevel.MINIMAL_RESTRICTIONS}: difficulty_action = QAction(self) difficulty_action.setText(trick_level.long_name) self.menu_difficulties.addAction(difficulty_action) difficulty_action.triggered.connect(functools.partial(self._open_difficulty_details_popup, trick_level)) configurable_tricks = TrickLevelConfiguration.all_possible_tricks() tricks_in_use = used_tricks(game.world_list) for trick in sorted(game.resource_database.trick, key=lambda _trick: _trick.long_name): if trick.index not in configurable_tricks or trick not in tricks_in_use: continue trick_menu = QMenu(self) trick_menu.setTitle(trick.long_name) self.menu_trick_details.addAction(trick_menu.menuAction()) used_difficulties = difficulties_for_trick(game.world_list, trick) for i, trick_level in enumerate(LayoutTrickLevel): if trick_level in used_difficulties: difficulty_action = QAction(self) difficulty_action.setText(trick_level.long_name) trick_menu.addAction(difficulty_action) difficulty_action.triggered.connect( functools.partial(self._open_trick_details_popup, trick, trick_level)) # ==========
Example #28
Source File: generate_seed_tab.py From randovania with GNU General Public License v3.0 | 5 votes |
def setup_ui(self): window = self.window # Progress self.background_processor.background_tasks_button_lock_signal.connect(self.enable_buttons_with_background_tasks) for preset in self._window_manager.preset_manager.all_presets: self._create_button_for_preset(preset) self.window.num_players_spin_box.setVisible(self._window_manager.is_preview_mode and False) # Menu self._tool_button_menu = QMenu(window.preset_tool_button) window.preset_tool_button.setMenu(self._tool_button_menu) self._action_delete = QAction(window) self._action_delete.setText("Delete") self._tool_button_menu.addAction(self._action_delete) action_export_preset = QAction(window) action_export_preset.setText("Export") self._tool_button_menu.addAction(action_export_preset) action_import_preset = QAction(window) action_import_preset.setText("Import") self._tool_button_menu.addAction(action_import_preset) # Signals window.create_customize_button.clicked.connect(self._on_customize_button) window.create_preset_combo.activated.connect(self._on_select_preset) window.create_generate_button.clicked.connect(partial(self._generate_new_seed, True)) window.create_generate_race_button.clicked.connect(partial(self._generate_new_seed, False)) self._action_delete.triggered.connect(self._on_delete_preset) action_export_preset.triggered.connect(self._on_export_preset) action_import_preset.triggered.connect(self._on_import_preset)
Example #29
Source File: plugin_interface.py From CutterDRcov with MIT License | 5 votes |
def setupInterface(self, main): action = QAction("CutterCov", main) action.setCheckable(True) widget = MyDockWidget(main, action) main.addPluginDockWidget(widget, action)
Example #30
Source File: lightmap.py From GridCal with GNU General Public License v3.0 | 5 votes |
def __init__(self): super(MapZoom, self).__init__(None) self.map_ = LightMaps(self) self.setCentralWidget(self.map_) self.map_.setFocus() self.osloAction = QAction("&Oslo", self) self.berlinAction = QAction("&Berlin", self) self.jakartaAction = QAction("&Jakarta", self) self.nightModeAction = QAction("Night Mode", self) self.nightModeAction.setCheckable(True) self.nightModeAction.setChecked(False) self.osmAction = QAction("About OpenStreetMap", self) self.osloAction.triggered.connect(self.chooseOslo) self.berlinAction.triggered.connect(self.chooseBerlin) self.jakartaAction.triggered.connect(self.chooseJakarta) self.nightModeAction.triggered.connect(self.map_.toggleNightMode) self.osmAction.triggered.connect(self.aboutOsm) menu = self.menuBar().addMenu("&Options") menu.addAction(self.osloAction) menu.addAction(self.berlinAction) menu.addAction(self.jakartaAction) menu.addSeparator() menu.addAction(self.nightModeAction) menu.addAction(self.osmAction) # slots