本文整理匯總了Python中PyQt4.QtGui.QKeySequence方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QKeySequence方法的具體用法?Python QtGui.QKeySequence怎麽用?Python QtGui.QKeySequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QKeySequence方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: qui_menu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
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])
示例2: setupMenu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def setupMenu(self):
self.quickMenu(['file_menu;&File','setting_menu;&Setting','help_menu;&Help'])
cur_menu = self.uiList['setting_menu']
self.quickMenuAction('setParaA_atn','Set Parameter &A','A example of tip notice.','setParaA.png', cur_menu)
self.uiList['setParaA_atn'].setShortcut(QtGui.QKeySequence("Ctrl+R"))
cur_menu.addSeparator()
# for file menu
cur_menu = self.uiList['file_menu']
self.quickMenuAction('newLang_atn','&Add New Language','Add a new translation.','newLang.png', cur_menu)
self.quickMenuAction('resetLang_atn','&Reset Languages','Reset All.','resetLang.png', cur_menu)
# for info review
cur_menu = self.uiList['help_menu']
self.quickMenuAction('helpHostMode_atnNone','Host Mode - {}'.format(hostMode),'Host Running.','', cur_menu)
self.quickMenuAction('helpPyMode_atnNone','Python Mode - {}'.format(pyMode),'Python Library Running.','', cur_menu)
self.quickMenuAction('helpQtMode_atnNone','Qt Mode - {}'.format(qtModeList[qtMode]),'Qt Library Running.','', cur_menu)
self.quickMenuAction('helpTemplate_atnNone','Universal Tool Teamplate - {}'.format(tpl_ver),'based on Univeral Tool Template v{} by Shining Ying - https://github.com/shiningdesign/universal_tool_template.py'.format(tpl_ver),'', cur_menu)
cur_menu.addSeparator()
self.uiList['helpGuide_msg'] = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
self.quickMenuAction('helpGuide_atnMsg','Usage Guide','How to Usge Guide.','helpGuide.png', cur_menu)
示例3: setupMenu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def setupMenu(self):
self.quickMenu(['file_menu;&File','setting_menu;&Setting','help_menu;&Help'])
cur_menu = self.uiList['setting_menu']
self.quickMenuAction('setParaA_atn','Set Parameter &A','A example of tip notice.','setParaA.png', cur_menu)
self.uiList['setParaA_atn'].setShortcut(QtGui.QKeySequence("Ctrl+R"))
cur_menu.addSeparator()
if 'help_menu' in self.uiList.keys():
# for info review
cur_menu = self.uiList['help_menu']
self.quickMenuAction('helpHostMode_atnNone','Host Mode - {}'.format(hostMode),'Host Running.','', cur_menu)
self.quickMenuAction('helpPyMode_atnNone','Python Mode - {}'.format(pyMode),'Python Library Running.','', cur_menu)
self.quickMenuAction('helpQtMode_atnNone','Qt Mode - {}'.format(qtModeList[qtMode]),'Qt Library Running.','', cur_menu)
self.quickMenuAction('helpTemplate_atnNone','Universal Tool Teamplate - {}'.format(tpl_ver),'based on Univeral Tool Template v{0} by Shining Ying - https://github.com/shiningdesign/universal{1}tool{1}template.py'.format(tpl_ver,'_'),'', cur_menu)
cur_menu.addSeparator()
self.uiList['helpGuide_msg'] = self.help
self.quickMenuAction('helpGuide_atnMsg','Usage Guide','How to Usge Guide.','helpGuide.png', cur_menu)
示例4: qui_menu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
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])
示例5: setup_browser_menu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def setup_browser_menu(self):
#self is browser
try:
# used by multiple add-ons, so we check for its existence first
menu = self.menuTags
except:
self.menuTags = QMenu(_("Tags"))
action = self.menuBar().insertMenu(self.mw.form.menuTools.menuAction(), self.menuTags)
menu = self.menuTags
menu.addSeparator()
unseen_menu = menu.addMenu("Unseen Card Tracking")
a = unseen_menu.addAction('Add "Unseen" Tags to Selected Cards')
a.setShortcut(QKeySequence("Ctrl+U"))
self.connect(a, SIGNAL("triggered()"), lambda b=self: add_unseen_tags_to_selected(b))
a = unseen_menu.addAction('Remove "Unseen" Tags from Selected Cards')
a.setShortcut(QKeySequence("Ctrl+Shift+U"))
self.connect(a, SIGNAL("triggered()"), lambda b=self: remove_unseen_tags_from_selected(b))
a = unseen_menu.addAction('Show all Unseen Cards')
a.setShortcut(QKeySequence("Ctrl+Alt+U"))
self.connect(a, SIGNAL("triggered()"), lambda b=self: show_all_unseen_cards(b))
#todo: menu action to set search string to show all
示例6: qui_atn
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
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
示例7: qui_key
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def qui_key(self, key_name, key_combo, func):
self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self)
self.hotkey[key_name].activated.connect( func )
示例8: Establish_Connections
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def Establish_Connections(self):
super(self.__class__,self).Establish_Connections()
# custom ui response
# shortcut connection
self.hotkey = {}
# self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self)
# self.hotkey['my_key'].activated.connect(self.my_key_func)
# ---- user response list ----
示例9: setupMenu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def setupMenu(self):
self.quickMenu('file_menu;&File | setting_menu;&Setting | help_menu;&Help')
cur_menu = self.uiList['setting_menu']
for info in ['export', 'import','user']:
title = info.title()
self.quickMenuAction('{0}Config_atn'.format(info),'{0} Config (&{1})'.format(title,title[0]),'{0} Setting and Configuration.'.format(title),'{0}Config.png'.format(info), cur_menu)
self.uiList['{0}Config_atn'.format(info)].setShortcut(QtGui.QKeySequence("Ctrl+{0}".format(title[0])))
cur_menu.addSeparator()
super(self.__class__,self).setupMenu()
示例10: Establish_Connections
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def Establish_Connections(self):
super(self.__class__,self).Establish_Connections()
# custom ui response
# shortcut connection
self.hotkey = {}
# self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self)
# self.hotkey['my_key'].activated.connect(self.my_key_func)
示例11: setupMenu
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QKeySequence [as 別名]
def setupMenu(self):
self.quickMenu('file_menu;&File | setting_menu;&Setting | help_menu;&Help')
cur_menu = self.uiList['setting_menu']
for info in ['export', 'import']:
title = info.title()
self.quickMenuAction('{0}Config_atn'.format(info),'{0} Config (&{1})'.format(title,title[0]),'{0} Setting and Configuration.'.format(title),'{0}Config.png'.format(info), cur_menu)
self.uiList['{0}Config_atn'.format(info)].setShortcut(QtGui.QKeySequence("Ctrl+{0}".format(title[0])))
cur_menu.addSeparator()
super(self.__class__,self).setupMenu()