39 """ |
39 """ |
40 Module function to read the keyboard shortcuts for the defined QActions. |
40 Module function to read the keyboard shortcuts for the defined QActions. |
41 |
41 |
42 @keyparam prefClass preferences class used as the storage area |
42 @keyparam prefClass preferences class used as the storage area |
43 @keyparam helpViewer reference to the help window object |
43 @keyparam helpViewer reference to the help window object |
44 @keyparam pluginName name of the plugin for which to load shortcuts (string) |
44 @keyparam pluginName name of the plugin for which to load shortcuts |
|
45 (string) |
45 """ |
46 """ |
46 if helpViewer is None and pluginName is None: |
47 if helpViewer is None and pluginName is None: |
47 for act in e5App().getObject("Project").getActions(): |
48 for act in e5App().getObject("Project").getActions(): |
48 __readShortcut(act, "Project", prefClass) |
49 __readShortcut(act, "Project", prefClass) |
49 |
50 |
197 ShortcutsWriter(f).writeXML() |
198 ShortcutsWriter(f).writeXML() |
198 f.close() |
199 f.close() |
199 else: |
200 else: |
200 E5MessageBox.critical(None, |
201 E5MessageBox.critical(None, |
201 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
202 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
202 QApplication.translate("Shortcuts", |
203 QApplication.translate( |
203 "<p>The keyboard shortcuts could not be written to file <b>{0}</b>.</p>") |
204 "Shortcuts", |
|
205 "<p>The keyboard shortcuts could not be written to file" |
|
206 " <b>{0}</b>.</p>") |
204 .format(fn)) |
207 .format(fn)) |
205 |
208 |
206 |
209 |
207 def importShortcuts(fn): |
210 def importShortcuts(fn): |
208 """ |
211 """ |
226 saveShortcuts() |
229 saveShortcuts() |
227 syncPreferences() |
230 syncPreferences() |
228 else: |
231 else: |
229 E5MessageBox.critical(None, |
232 E5MessageBox.critical(None, |
230 QApplication.translate("Shortcuts", "Import Keyboard Shortcuts"), |
233 QApplication.translate("Shortcuts", "Import Keyboard Shortcuts"), |
231 QApplication.translate("Shortcuts", |
234 QApplication.translate( |
232 "<p>The keyboard shortcuts could not be read from file <b>{0}</b>.</p>") |
235 "Shortcuts", |
|
236 "<p>The keyboard shortcuts could not be read from file" |
|
237 " <b>{0}</b>.</p>") |
233 .format(fn)) |
238 .format(fn)) |
234 return |
239 return |
235 |
240 |
236 |
241 |
237 def __setAction(actions, sdict): |
242 def __setAction(actions, sdict): |