eric6/Preferences/Shortcuts.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 8022
2da0139f4f91
child 8142
43248bafe9b2
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2004 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing functions dealing with keyboard shortcuts.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3642
diff changeset
10 from PyQt5.QtCore import QFile, QIODevice, QCoreApplication
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3642
diff changeset
11 from PyQt5.QtGui import QKeySequence
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
13 from E5Gui.E5Application import e5App
537
72b32daeb8d6 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
14 from E5Gui import E5MessageBox
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from Preferences import Prefs, syncPreferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
18
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 def __readShortcut(act, category, prefClass):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Private function to read a single keyboard shortcut from the settings.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
23 @param act reference to the action object (E5Action)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param category category the action belongs to (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param prefClass preferences class used as the storage area
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 if act.objectName():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 accel = prefClass.settings.value(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()))
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 if accel is not None:
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31 act.setShortcut(QKeySequence(accel))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 accel = prefClass.settings.value(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()))
7
c679fb30c8f3 Change code dealing with QVariant (and QSettings) to use the PyQt4 QVariant v2 API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34 if accel is not None:
3642
1a6f8d9b63a5 Fixed an issue causing deleted alternate keyboard shortcuts not being reloaded correctly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
35 act.setAlternateShortcut(QKeySequence(accel), removeEmpty=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
37
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
38 def readShortcuts(prefClass=Prefs, helpViewer=None, pluginName=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Module function to read the keyboard shortcuts for the defined QActions.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
42 @param prefClass preferences class used as the storage area
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
43 @param helpViewer reference to the help window object
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
44 @param pluginName name of the plugin for which to load shortcuts
3010
befeff46ec0f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
45 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 if helpViewer is None and pluginName is None:
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
48 for act in e5App().getObject("Project").getActions():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 __readShortcut(act, "Project", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
51 for act in e5App().getObject("UserInterface").getActions('ui'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 __readShortcut(act, "General", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
54 for act in e5App().getObject("UserInterface").getActions('wizards'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 __readShortcut(act, "Wizards", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
57 for act in e5App().getObject("DebugUI").getActions():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 __readShortcut(act, "Debug", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
60 for act in e5App().getObject("ViewManager").getActions('edit'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 __readShortcut(act, "Edit", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
63 for act in e5App().getObject("ViewManager").getActions('file'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 __readShortcut(act, "File", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
66 for act in e5App().getObject("ViewManager").getActions('search'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 __readShortcut(act, "Search", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
69 for act in e5App().getObject("ViewManager").getActions('view'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 __readShortcut(act, "View", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
72 for act in e5App().getObject("ViewManager").getActions('macro'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 __readShortcut(act, "Macro", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
75 for act in e5App().getObject("ViewManager").getActions('bookmark'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 __readShortcut(act, "Bookmarks", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
78 for act in e5App().getObject("ViewManager").getActions('spelling'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 __readShortcut(act, "Spelling", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
81 actions = e5App().getObject("ViewManager").getActions('window')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 if actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 __readShortcut(act, "Window", prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
86 for category, ref in e5App().getPluginObjects():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 if hasattr(ref, "getActions"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 actions = ref.getActions()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 __readShortcut(act, category, prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 if helpViewer is not None:
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
93 helpViewerCategory = helpViewer.getActionsCategory()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 for act in helpViewer.getActions():
4807
5c87ef12aa6d Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
95 __readShortcut(act, helpViewerCategory, prefClass)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 if pluginName is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 try:
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
99 ref = e5App().getPluginObject(pluginName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 if hasattr(ref, "getActions"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 actions = ref.getActions()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 __readShortcut(act, pluginName, prefClass)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 # silently ignore non available plugins
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
108
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 def __saveShortcut(act, category, prefClass):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 Private function to write a single keyboard shortcut to the settings.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
113 @param act reference to the action object (E5Action)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 @param category category the action belongs to (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 @param prefClass preferences class used as the storage area
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 if act.objectName():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 prefClass.settings.setValue(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
119 "Shortcuts/{0}/{1}/Accel".format(category, act.objectName()),
81
a40a255e56e4 Fixed a problem exporting shortcuts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
120 act.shortcut().toString())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 prefClass.settings.setValue(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
122 "Shortcuts/{0}/{1}/AltAccel".format(category, act.objectName()),
81
a40a255e56e4 Fixed a problem exporting shortcuts.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
123 act.alternateShortcut().toString())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
125
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
126 def saveShortcuts(prefClass=Prefs, helpViewer=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 Module function to write the keyboard shortcuts for the defined QActions.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 @param prefClass preferences class used as the storage area
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
131 @param helpViewer reference to the help window object
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 """
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
133 if helpViewer is None:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
134 # step 1: clear all previously saved shortcuts
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
135 prefClass.settings.beginGroup("Shortcuts")
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
136 prefClass.settings.remove("")
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
137 prefClass.settings.endGroup()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
138
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
139 # step 2: save the various shortcuts
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
140 for act in e5App().getObject("Project").getActions():
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
141 __saveShortcut(act, "Project", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
142
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
143 for act in e5App().getObject("UserInterface").getActions('ui'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
144 __saveShortcut(act, "General", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
145
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
146 for act in e5App().getObject("UserInterface").getActions('wizards'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
147 __saveShortcut(act, "Wizards", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
148
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
149 for act in e5App().getObject("DebugUI").getActions():
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
150 __saveShortcut(act, "Debug", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
151
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
152 for act in e5App().getObject("ViewManager").getActions('edit'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
153 __saveShortcut(act, "Edit", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
154
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
155 for act in e5App().getObject("ViewManager").getActions('file'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
156 __saveShortcut(act, "File", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
157
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
158 for act in e5App().getObject("ViewManager").getActions('search'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
159 __saveShortcut(act, "Search", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
160
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
161 for act in e5App().getObject("ViewManager").getActions('view'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
162 __saveShortcut(act, "View", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
163
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
164 for act in e5App().getObject("ViewManager").getActions('macro'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
165 __saveShortcut(act, "Macro", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
166
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
167 for act in e5App().getObject("ViewManager").getActions('bookmark'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
168 __saveShortcut(act, "Bookmarks", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
169
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
170 for act in e5App().getObject("ViewManager").getActions('spelling'):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
171 __saveShortcut(act, "Spelling", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
172
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
173 actions = e5App().getObject("ViewManager").getActions('window')
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
174 if actions:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
175 for act in actions:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
176 __saveShortcut(act, "Window", prefClass)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
177
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
178 for category, ref in e5App().getPluginObjects():
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
179 if hasattr(ref, "getActions"):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
180 actions = ref.getActions()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
181 for act in actions:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
182 __saveShortcut(act, category, prefClass)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
184 else:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
185 helpViewerCategory = helpViewer.getActionsCategory()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
186
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
187 # step 1: clear all previously saved shortcuts
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
188 prefClass.settings.beginGroup(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
189 "Shortcuts/{0}".format(helpViewerCategory)
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
190 )
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
191 prefClass.settings.remove("")
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
192 prefClass.settings.endGroup()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
193
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
194 # step 2: save the shortcuts
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
195 for act in helpViewer.getActions():
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
196 __saveShortcut(act, helpViewerCategory, prefClass)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
198
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
199 def exportShortcuts(fn, helpViewer=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 Module function to export the keyboard shortcuts for the defined QActions.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
203 @param fn filename of the export file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
204 @type str
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
205 @param helpViewer reference to the help window object
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
206 @type WebBrowserWindow
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 """
595
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
208 # let the plugin manager create on demand plugin objects
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
209 pm = e5App().getObject("PluginManager")
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
210 pm.initOnDemandPlugins()
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
211
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
212 if fn.endswith(".ekj"):
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
213 # new JSON based file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
214 from .ShortcutsFile import ShortcutsFile
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
215 shortcutsFile = ShortcutsFile()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
216 shortcutsFile.writeFile(fn, helpViewer)
595
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
217 else:
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
218 # old XML based file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
219 f = QFile(fn)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
220 if f.open(QIODevice.WriteOnly):
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
221 from E5XML.ShortcutsWriter import ShortcutsWriter
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
222 ShortcutsWriter(f).writeXML(helpViewer=helpViewer)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
223 f.close()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
224 else:
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
225 E5MessageBox.critical(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
226 None,
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
227 QCoreApplication.translate(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
228 "Shortcuts", "Export Keyboard Shortcuts"),
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
229 QCoreApplication.translate(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
230 "Shortcuts",
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
231 "<p>The keyboard shortcuts file <b>{0}</b> could not"
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
232 " be written.</p>")
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
233 .format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
235
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
236 def importShortcuts(fn, helpViewer=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 """
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
238 Module function to import the keyboard shortcuts for the defined actions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
240 @param fn filename of the import file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
241 @type str
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
242 @param helpViewer reference to the help window object
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
243 @type WebBrowserWindow
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 """
595
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
245 # let the plugin manager create on demand plugin objects
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
246 pm = e5App().getObject("PluginManager")
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
247 pm.initOnDemandPlugins()
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
248
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
249 if fn.endswith(".ekj"):
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
250 # new JSON based file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
251 from .ShortcutsFile import ShortcutsFile
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
252 shortcutsFile = ShortcutsFile()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
253 shortcuts = shortcutsFile.readFile(fn)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
254 if shortcuts:
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
255 setActions(shortcuts, helpViewer=helpViewer)
595
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
256 saveShortcuts()
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
257 syncPreferences()
7d2c8346021c Migrated the shortcuts handler to shortcuts reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
258 else:
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
259 # old XML based file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
260 f = QFile(fn)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
261 if f.open(QIODevice.ReadOnly):
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
262 from E5XML.ShortcutsReader import ShortcutsReader
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
263 reader = ShortcutsReader(f)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
264 reader.readXML()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
265 f.close()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
266 if not reader.hasError():
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
267 shortcuts = reader.getShortcuts()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
268 setActions(shortcuts, helpViewer=helpViewer)
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
269 saveShortcuts()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
270 syncPreferences()
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
271 else:
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
272 E5MessageBox.critical(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
273 None,
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
274 QCoreApplication.translate(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
275 "Shortcuts", "Import Keyboard Shortcuts"),
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
276 QCoreApplication.translate(
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
277 "Shortcuts",
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
278 "<p>The keyboard shortcuts file <b>{0}</b> could not be"
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
279 " read.</p>")
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
280 .format(fn))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
282
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
283 def __setAction(actions, shortcutsDict):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 """
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
285 Private function to set a single keyboard shortcut category shortcuts.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
287 @param actions list of actions to set
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
288 @type list of E5Action
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
289 @param shortcutsDict dictionary containing accelerator information for
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
290 one category
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
291 @type dict
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 if act.objectName():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 try:
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
296 accel, altAccel = shortcutsDict[act.objectName()]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 act.setShortcut(QKeySequence(accel))
3642
1a6f8d9b63a5 Fixed an issue causing deleted alternate keyboard shortcuts not being reloaded correctly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
298 act.setAlternateShortcut(QKeySequence(altAccel),
1a6f8d9b63a5 Fixed an issue causing deleted alternate keyboard shortcuts not being reloaded correctly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
299 removeEmpty=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
303
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
304 def setActions(shortcuts, helpViewer=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 """
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
306 Module function to set actions based on the imported shortcuts file.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
308 @param shortcuts dictionary containing the accelerator information
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
309 read from a JSON or XML file
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
310 @type dict
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
311 @param helpViewer reference to the help window object
8019
5fb467ac4233 Implemented the JSON based keyboard shortcuts files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8013
diff changeset
312 @type WebBrowserWindow
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 """
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
314 if helpViewer is None:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
315 if "Project" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
316 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
317 e5App().getObject("Project").getActions(),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
318 shortcuts["Project"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
319
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
320 if "General" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
321 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
322 e5App().getObject("UserInterface").getActions('ui'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
323 shortcuts["General"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
324
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
325 if "Wizards" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
326 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
327 e5App().getObject("UserInterface").getActions('wizards'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
328 shortcuts["Wizards"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
329
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
330 if "Debug" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
331 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
332 e5App().getObject("DebugUI").getActions(),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
333 shortcuts["Debug"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
334
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
335 if "Edit" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
336 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
337 e5App().getObject("ViewManager").getActions('edit'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
338 shortcuts["Edit"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
339
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
340 if "File" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
341 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
342 e5App().getObject("ViewManager").getActions('file'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
343 shortcuts["File"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
344
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
345 if "Search" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
346 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
347 e5App().getObject("ViewManager").getActions('search'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
348 shortcuts["Search"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
349
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
350 if "View" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
351 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
352 e5App().getObject("ViewManager").getActions('view'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
353 shortcuts["View"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
354
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
355 if "Macro" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
356 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
357 e5App().getObject("ViewManager").getActions('macro'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
358 shortcuts["Macro"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
359
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
360 if "Bookmarks" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
361 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
362 e5App().getObject("ViewManager").getActions('bookmark'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
363 shortcuts["Bookmarks"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
364
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
365 if "Spelling" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
366 __setAction(
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
367 e5App().getObject("ViewManager").getActions('spelling'),
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
368 shortcuts["Spelling"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
369
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
370 if "Window" in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
371 actions = e5App().getObject("ViewManager").getActions('window')
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
372 if actions:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
373 __setAction(actions, shortcuts["Window"])
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
374
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
375 for category, ref in e5App().getPluginObjects():
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
376 if category in shortcuts and hasattr(ref, "getActions"):
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
377 actions = ref.getActions()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
378 __setAction(actions, shortcuts[category])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
6625
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
380 else:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
381 category = helpViewer.getActionsCategory()
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
382 if category in shortcuts:
a67fee7bc09c Web Browser: changed the web browser logic inside eric to use a remote controlled web browser process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
383 __setAction(helpViewer.getActions(), shortcuts[category])

eric ide

mercurial