12 |
12 |
13 from E5Gui.E5Application import e5App |
13 from E5Gui.E5Application import e5App |
14 from E5Gui import E5MessageBox |
14 from E5Gui import E5MessageBox |
15 |
15 |
16 from Preferences import Prefs, syncPreferences |
16 from Preferences import Prefs, syncPreferences |
17 |
|
18 from E5XML.ShortcutsReader import ShortcutsReader |
|
19 from E5XML.ShortcutsWriter import ShortcutsWriter |
|
20 |
17 |
21 |
18 |
22 def __readShortcut(act, category, prefClass): |
19 def __readShortcut(act, category, prefClass): |
23 """ |
20 """ |
24 Private function to read a single keyboard shortcut from the settings. |
21 Private function to read a single keyboard shortcut from the settings. |
194 pm = e5App().getObject("PluginManager") |
191 pm = e5App().getObject("PluginManager") |
195 pm.initOnDemandPlugins() |
192 pm.initOnDemandPlugins() |
196 |
193 |
197 f = QFile(fn) |
194 f = QFile(fn) |
198 if f.open(QIODevice.WriteOnly): |
195 if f.open(QIODevice.WriteOnly): |
|
196 from E5XML.ShortcutsWriter import ShortcutsWriter |
199 ShortcutsWriter(f).writeXML() |
197 ShortcutsWriter(f).writeXML() |
200 f.close() |
198 f.close() |
201 else: |
199 else: |
202 E5MessageBox.critical(None, |
200 E5MessageBox.critical(None, |
203 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
201 QApplication.translate("Shortcuts", "Export Keyboard Shortcuts"), |
216 pm = e5App().getObject("PluginManager") |
214 pm = e5App().getObject("PluginManager") |
217 pm.initOnDemandPlugins() |
215 pm.initOnDemandPlugins() |
218 |
216 |
219 f = QFile(fn) |
217 f = QFile(fn) |
220 if f.open(QIODevice.ReadOnly): |
218 if f.open(QIODevice.ReadOnly): |
|
219 from E5XML.ShortcutsReader import ShortcutsReader |
221 reader = ShortcutsReader(f) |
220 reader = ShortcutsReader(f) |
222 reader.readXML() |
221 reader.readXML() |
223 f.close() |
222 f.close() |
224 if not reader.hasError(): |
223 if not reader.hasError(): |
225 shortcuts = reader.getShortcuts() |
224 shortcuts = reader.getShortcuts() |