35 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())) |
35 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName())) |
36 if accel is not None: |
36 if accel is not None: |
37 act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True) |
37 act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True) |
38 |
38 |
39 |
39 |
40 def readShortcuts(prefClass=Prefs, helpViewer=None, pluginName=None): |
40 def readShortcuts(prefClass=Prefs, helpViewer=None, pluginName=None, |
|
41 helpViewerCategory=""): |
41 """ |
42 """ |
42 Module function to read the keyboard shortcuts for the defined QActions. |
43 Module function to read the keyboard shortcuts for the defined QActions. |
43 |
44 |
44 @keyparam prefClass preferences class used as the storage area |
45 @keyparam prefClass preferences class used as the storage area |
45 @keyparam helpViewer reference to the help window object |
46 @keyparam helpViewer reference to the help window object |
46 @keyparam pluginName name of the plugin for which to load shortcuts |
47 @keyparam pluginName name of the plugin for which to load shortcuts |
47 (string) |
48 (string) |
|
49 @keyparam helpViewerCategory name of the help viewer category (string) |
48 """ |
50 """ |
49 if helpViewer is None and pluginName is None: |
51 if helpViewer is None and pluginName is None: |
50 for act in e5App().getObject("Project").getActions(): |
52 for act in e5App().getObject("Project").getActions(): |
51 __readShortcut(act, "Project", prefClass) |
53 __readShortcut(act, "Project", prefClass) |
52 |
54 |
90 actions = ref.getActions() |
92 actions = ref.getActions() |
91 for act in actions: |
93 for act in actions: |
92 __readShortcut(act, category, prefClass) |
94 __readShortcut(act, category, prefClass) |
93 |
95 |
94 if helpViewer is not None: |
96 if helpViewer is not None: |
|
97 if not helpViewerCategory: |
|
98 helpViewerCategory = "HelpViewer" |
95 for act in helpViewer.getActions(): |
99 for act in helpViewer.getActions(): |
96 __readShortcut(act, "HelpViewer", prefClass) |
100 __readShortcut(act, helpViewerCategory, prefClass) |
97 |
101 |
98 if pluginName is not None: |
102 if pluginName is not None: |
99 try: |
103 try: |
100 ref = e5App().getPluginObject(pluginName) |
104 ref = e5App().getPluginObject(pluginName) |
101 if hasattr(ref, "getActions"): |
105 if hasattr(ref, "getActions"): |