198 if f.open(QIODevice.WriteOnly): |
198 if f.open(QIODevice.WriteOnly): |
199 from E5XML.ShortcutsWriter import ShortcutsWriter |
199 from E5XML.ShortcutsWriter import ShortcutsWriter |
200 ShortcutsWriter(f).writeXML() |
200 ShortcutsWriter(f).writeXML() |
201 f.close() |
201 f.close() |
202 else: |
202 else: |
203 E5MessageBox.critical(None, |
203 E5MessageBox.critical( |
|
204 None, |
204 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
205 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
205 QApplication.translate( |
206 QApplication.translate( |
206 "Shortcuts", |
207 "Shortcuts", |
207 "<p>The keyboard shortcuts could not be written to file" |
208 "<p>The keyboard shortcuts could not be written to file" |
208 " <b>{0}</b>.</p>") |
209 " <b>{0}</b>.</p>") |
265 @param shortcuts dictionary containing the accelerator information |
267 @param shortcuts dictionary containing the accelerator information |
266 read from a XML file |
268 read from a XML file |
267 """ |
269 """ |
268 if "Project" in shortcuts: |
270 if "Project" in shortcuts: |
269 __setAction(e5App().getObject("Project").getActions(), |
271 __setAction(e5App().getObject("Project").getActions(), |
270 shortcuts["Project"]) |
272 shortcuts["Project"]) |
271 |
273 |
272 if "General" in shortcuts: |
274 if "General" in shortcuts: |
273 __setAction(e5App().getObject("UserInterface").getActions('ui'), |
275 __setAction(e5App().getObject("UserInterface").getActions('ui'), |
274 shortcuts["General"]) |
276 shortcuts["General"]) |
275 |
277 |
276 if "Wizards" in shortcuts: |
278 if "Wizards" in shortcuts: |
277 __setAction(e5App().getObject("UserInterface").getActions('wizards'), |
279 __setAction(e5App().getObject("UserInterface").getActions('wizards'), |
278 shortcuts["Wizards"]) |
280 shortcuts["Wizards"]) |
279 |
281 |
280 if "Debug" in shortcuts: |
282 if "Debug" in shortcuts: |
281 __setAction(e5App().getObject("DebugUI").getActions(), |
283 __setAction(e5App().getObject("DebugUI").getActions(), |
282 shortcuts["Debug"]) |
284 shortcuts["Debug"]) |
283 |
285 |
284 if "Edit" in shortcuts: |
286 if "Edit" in shortcuts: |
285 __setAction(e5App().getObject("ViewManager").getActions('edit'), |
287 __setAction(e5App().getObject("ViewManager").getActions('edit'), |
286 shortcuts["Edit"]) |
288 shortcuts["Edit"]) |
287 |
289 |
288 if "File" in shortcuts: |
290 if "File" in shortcuts: |
289 __setAction(e5App().getObject("ViewManager").getActions('file'), |
291 __setAction(e5App().getObject("ViewManager").getActions('file'), |
290 shortcuts["File"]) |
292 shortcuts["File"]) |
291 |
293 |
292 if "Search" in shortcuts: |
294 if "Search" in shortcuts: |
293 __setAction(e5App().getObject("ViewManager").getActions('search'), |
295 __setAction(e5App().getObject("ViewManager").getActions('search'), |
294 shortcuts["Search"]) |
296 shortcuts["Search"]) |
295 |
297 |
296 if "View" in shortcuts: |
298 if "View" in shortcuts: |
297 __setAction(e5App().getObject("ViewManager").getActions('view'), |
299 __setAction(e5App().getObject("ViewManager").getActions('view'), |
298 shortcuts["View"]) |
300 shortcuts["View"]) |
299 |
301 |
300 if "Macro" in shortcuts: |
302 if "Macro" in shortcuts: |
301 __setAction(e5App().getObject("ViewManager").getActions('macro'), |
303 __setAction(e5App().getObject("ViewManager").getActions('macro'), |
302 shortcuts["Macro"]) |
304 shortcuts["Macro"]) |
303 |
305 |
304 if "Bookmarks" in shortcuts: |
306 if "Bookmarks" in shortcuts: |
305 __setAction(e5App().getObject("ViewManager").getActions('bookmark'), |
307 __setAction(e5App().getObject("ViewManager").getActions('bookmark'), |
306 shortcuts["Bookmarks"]) |
308 shortcuts["Bookmarks"]) |
307 |
309 |
308 if "Spelling" in shortcuts: |
310 if "Spelling" in shortcuts: |
309 __setAction(e5App().getObject("ViewManager").getActions('spelling'), |
311 __setAction(e5App().getObject("ViewManager").getActions('spelling'), |
310 shortcuts["Spelling"]) |
312 shortcuts["Spelling"]) |
311 |
313 |
312 if "Window" in shortcuts: |
314 if "Window" in shortcuts: |
313 actions = e5App().getObject("ViewManager").getActions('window') |
315 actions = e5App().getObject("ViewManager").getActions('window') |
314 if actions: |
316 if actions: |
315 __setAction(actions, shortcuts["Window"]) |
317 __setAction(actions, shortcuts["Window"]) |