Preferences/Shortcuts.py

changeset 55
b5c84934de9c
parent 53
c3eb7cc1ff8b
child 81
a40a255e56e4
equal deleted inserted replaced
54:31463df17fd5 55:b5c84934de9c
10 import io 10 import io
11 11
12 from PyQt4.QtCore import * 12 from PyQt4.QtCore import *
13 from PyQt4.QtGui import * 13 from PyQt4.QtGui import *
14 14
15 from E4Gui.E4Application import e5App 15 from E5Gui.E5Application import e5App
16 16
17 from Preferences import Prefs, syncPreferences 17 from Preferences import Prefs, syncPreferences
18 18
19 from E5XML.XMLUtilities import make_parser 19 from E5XML.XMLUtilities import make_parser
20 from E5XML.XMLErrorHandler import XMLErrorHandler, XMLFatalParseError 20 from E5XML.XMLErrorHandler import XMLErrorHandler, XMLFatalParseError
24 24
25 def __readShortcut(act, category, prefClass): 25 def __readShortcut(act, category, prefClass):
26 """ 26 """
27 Private function to read a single keyboard shortcut from the settings. 27 Private function to read a single keyboard shortcut from the settings.
28 28
29 @param act reference to the action object (E4Action) 29 @param act reference to the action object (E5Action)
30 @param category category the action belongs to (string) 30 @param category category the action belongs to (string)
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(
110 110
111 def __saveShortcut(act, category, prefClass): 111 def __saveShortcut(act, category, prefClass):
112 """ 112 """
113 Private function to write a single keyboard shortcut to the settings. 113 Private function to write a single keyboard shortcut to the settings.
114 114
115 @param act reference to the action object (E4Action) 115 @param act reference to the action object (E5Action)
116 @param category category the action belongs to (string) 116 @param category category the action belongs to (string)
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(
216 except IOError: 216 except IOError:
217 return False 217 return False
218 218
219 def importShortcuts(fn): 219 def importShortcuts(fn):
220 """ 220 """
221 Module function to import the keyboard shortcuts for the defined E4Actions. 221 Module function to import the keyboard shortcuts for the defined E5Actions.
222 222
223 @param fn filename of the import file (string) 223 @param fn filename of the import file (string)
224 @return flag indicating success 224 @return flag indicating success
225 """ 225 """
226 try: 226 try:
321 321
322 def __setAction(actions, sdict): 322 def __setAction(actions, sdict):
323 """ 323 """
324 Private function to write a single keyboard shortcut to the settings. 324 Private function to write a single keyboard shortcut to the settings.
325 325
326 @param actions list of actions to set (list of E4Action) 326 @param actions list of actions to set (list of E5Action)
327 @param sdict dictionary containg accelerator information for one category 327 @param sdict dictionary containg accelerator information for one category
328 """ 328 """
329 for act in actions: 329 for act in actions:
330 if act.objectName(): 330 if act.objectName():
331 try: 331 try:

eric ide

mercurial