Preferences/Shortcuts.py

changeset 7
c679fb30c8f3
parent 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
6:52e8c820d0dd 7:c679fb30c8f3
31 @param prefClass preferences class used as the storage area 31 @param prefClass preferences class used as the storage area
32 """ 32 """
33 if act.objectName(): 33 if act.objectName():
34 accel = prefClass.settings.value( 34 accel = prefClass.settings.value(
35 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName())) 35 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()))
36 if accel.isValid(): 36 if accel is not None:
37 act.setShortcut(QKeySequence(accel.toString())) 37 act.setShortcut(QKeySequence(accel))
38 accel = prefClass.settings.value( 38 accel = prefClass.settings.value(
39 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())) 39 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()))
40 if accel.isValid(): 40 if accel is not None:
41 act.setAlternateShortcut(QKeySequence(accel.toString())) 41 act.setAlternateShortcut(QKeySequence(accel))
42 42
43 def readShortcuts(prefClass = Prefs, helpViewer = None, pluginName = None): 43 def readShortcuts(prefClass = Prefs, helpViewer = None, pluginName = None):
44 """ 44 """
45 Module function to read the keyboard shortcuts for the defined QActions. 45 Module function to read the keyboard shortcuts for the defined QActions.
46 46
117 @param prefClass preferences class used as the storage area 117 @param prefClass preferences class used as the storage area
118 """ 118 """
119 if act.objectName(): 119 if act.objectName():
120 prefClass.settings.setValue( 120 prefClass.settings.setValue(
121 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()), 121 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()),
122 QVariant(act.shortcut())) 122 act.shortcut())
123 prefClass.settings.setValue( 123 prefClass.settings.setValue(
124 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()), 124 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()),
125 QVariant(act.alternateShortcut())) 125 act.alternateShortcut())
126 126
127 def saveShortcuts(prefClass = Prefs): 127 def saveShortcuts(prefClass = Prefs):
128 """ 128 """
129 Module function to write the keyboard shortcuts for the defined QActions. 129 Module function to write the keyboard shortcuts for the defined QActions.
130 130

eric ide

mercurial