E5XML/ShortcutsWriter.py

Fri, 10 Sep 2010 08:54:33 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 10 Sep 2010 08:54:33 +0200
changeset 580
45c38566b001
parent 411
99409cddaaa9
child 595
7d2c8346021c
permissions
-rw-r--r--

Implemented the plug-in repository reader.

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
13
1af94a91f439 Changed copyright for 2010.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
3 # Copyright (c) 2004 - 2010 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 the writer class for writing an XML shortcuts file.
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
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import time
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
12 from E5Gui.E5Application import e5App
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14 from .XMLWriterBase import XMLWriterBase
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from .Config import shortcutsFileFormatVersion
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 class ShortcutsWriter(XMLWriterBase):
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 Class implementing the writer class for writing an XML shortcuts file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 def __init__(self, file):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
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 @param file open file (like) object for writing
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 XMLWriterBase.__init__(self, file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.email = Preferences.getUser("Email")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 def writeXML(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Public method to write the XML to the file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 XMLWriterBase.writeXML(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
39 self._write('<!DOCTYPE Shortcuts SYSTEM "Shortcuts-{0}.dtd">'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
40 shortcutsFileFormatVersion))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 # add some generation comments
18
3b1f5d872fd7 More renaming to eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
43 self._write("<!-- Eric5 keyboard shortcuts -->")
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
44 self._write("<!-- Saved: {0} -->".format(time.strftime('%Y-%m-%d, %H:%M:%S')))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
45 self._write("<!-- Author: {0} -->".format(self.escape("{0}".format(self.email))))
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 # add the main tag
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
48 self._write('<Shortcuts version="{0}">'.format(shortcutsFileFormatVersion))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
50 for act in e5App().getObject("Project").getActions():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self._write(' <Shortcut category="Project">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
52 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
53 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
54 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
55 self._write(' <AltAccel>{0}</AltAccel>' \
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
56 .format(self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
59 for act in e5App().getObject("UserInterface").getActions('ui'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self._write(' <Shortcut category="General">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
61 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
62 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
63 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
64 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
65 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
68 for act in e5App().getObject("UserInterface").getActions('wizards'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self._write(' <Shortcut category="Wizards">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
70 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
71 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
72 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
73 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
74 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
77 for act in e5App().getObject("DebugUI").getActions():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self._write(' <Shortcut category="Debug">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
79 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
80 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
81 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
82 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
83 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self._write(' </Shortcut>')
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 act in e5App().getObject("ViewManager").getActions('edit'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self._write(' <Shortcut category="Edit">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
88 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
89 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
90 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
91 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
92 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
95 for act in e5App().getObject("ViewManager").getActions('file'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self._write(' <Shortcut category="File">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
97 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
98 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
99 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
100 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
101 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
104 for act in e5App().getObject("ViewManager").getActions('search'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self._write(' <Shortcut category="Search">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
106 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
107 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
108 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
109 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
110 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
113 for act in e5App().getObject("ViewManager").getActions('view'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self._write(' <Shortcut category="View">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
115 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
116 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
117 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
118 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
119 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
122 for act in e5App().getObject("ViewManager").getActions('macro'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self._write(' <Shortcut category="Macro">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
124 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
125 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
126 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
127 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
128 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
131 for act in e5App().getObject("ViewManager").getActions('bookmark'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self._write(' <Shortcut category="Bookmarks">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
133 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
134 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
135 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
136 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
137 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
140 for act in e5App().getObject("ViewManager").getActions('spelling'):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 self._write(' <Shortcut category="Spelling">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
142 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
143 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
144 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
145 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
146 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
149 actions = e5App().getObject("ViewManager").getActions('window')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 self._write(' <Shortcut category="Window">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
152 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
153 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
154 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
155 self._write(' <AltAccel>{0}</AltAccel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
156 self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
159 for category, ref in e5App().getPluginObjects():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 if hasattr(ref, "getActions"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 actions = ref.getActions()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 for act in actions:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 if act.objectName():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 # shortcuts are only exported, if their objectName is set
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
165 self._write(' <Shortcut category="{0}">'.format(category))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
166 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
167 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
168 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
169 self._write(' <AltAccel>{0}</AltAccel>'\
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
170 .format(self.escape("{0}".format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
171 act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173
53
c3eb7cc1ff8b Renamed e5App to e5App.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
174 for act in e5App().getObject("DummyHelpViewer").getActions():
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self._write(' <Shortcut category="HelpViewer">')
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
176 self._write(' <Name>{0}</Name>'.format(act.objectName()))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
177 self._write(' <Accel>{0}</Accel>'.format(
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
178 self.escape("{0}".format(act.shortcut().toString()))))
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
179 self._write(' <AltAccel>{0}</AltAccel>' \
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
180 .format(self.escape("{0}".format(act.alternateShortcut().toString()))))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 self._write(' </Shortcut>')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 # add the main end tag
411
99409cddaaa9 Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
184 self._write("</Shortcuts>", newline = False)

eric ide

mercurial