31 """ |
31 """ |
32 XMLStreamWriterBase.__init__(self, device) |
32 XMLStreamWriterBase.__init__(self, device) |
33 |
33 |
34 self.email = Preferences.getUser("Email") |
34 self.email = Preferences.getUser("Email") |
35 |
35 |
36 def writeXML(self): |
36 def writeXML(self, helpViewer=None): |
37 """ |
37 """ |
38 Public method to write the XML to the file. |
38 Public method to write the XML to the file. |
|
39 |
|
40 @param helpViewer reference to the help window object |
39 """ |
41 """ |
40 XMLStreamWriterBase.writeXML(self) |
42 XMLStreamWriterBase.writeXML(self) |
41 |
43 |
42 self.writeDTD('<!DOCTYPE Shortcuts SYSTEM "Shortcuts-{0}.dtd">'.format( |
44 self.writeDTD('<!DOCTYPE Shortcuts SYSTEM "Shortcuts-{0}.dtd">'.format( |
43 shortcutsFileFormatVersion)) |
45 shortcutsFileFormatVersion)) |
50 |
52 |
51 # add the main tag |
53 # add the main tag |
52 self.writeStartElement("Shortcuts") |
54 self.writeStartElement("Shortcuts") |
53 self.writeAttribute("version", shortcutsFileFormatVersion) |
55 self.writeAttribute("version", shortcutsFileFormatVersion) |
54 |
56 |
55 self.__writeActions( |
57 if helpViewer is None: |
56 "Project", |
58 self.__writeActions( |
57 e5App().getObject("Project").getActions()) |
59 "Project", |
58 self.__writeActions( |
60 e5App().getObject("Project").getActions()) |
59 "General", |
61 self.__writeActions( |
60 e5App().getObject("UserInterface").getActions('ui')) |
62 "General", |
61 self.__writeActions( |
63 e5App().getObject("UserInterface").getActions('ui')) |
62 "Wizards", |
64 self.__writeActions( |
63 e5App().getObject("UserInterface").getActions('wizards')) |
65 "Wizards", |
64 self.__writeActions( |
66 e5App().getObject("UserInterface").getActions('wizards')) |
65 "Debug", |
67 self.__writeActions( |
66 e5App().getObject("DebugUI").getActions()) |
68 "Debug", |
67 self.__writeActions( |
69 e5App().getObject("DebugUI").getActions()) |
68 "Edit", |
70 self.__writeActions( |
69 e5App().getObject("ViewManager").getActions('edit')) |
71 "Edit", |
70 self.__writeActions( |
72 e5App().getObject("ViewManager").getActions('edit')) |
71 "File", |
73 self.__writeActions( |
72 e5App().getObject("ViewManager").getActions('file')) |
74 "File", |
73 self.__writeActions( |
75 e5App().getObject("ViewManager").getActions('file')) |
74 "Search", |
76 self.__writeActions( |
75 e5App().getObject("ViewManager").getActions('search')) |
77 "Search", |
76 self.__writeActions( |
78 e5App().getObject("ViewManager").getActions('search')) |
77 "View", |
79 self.__writeActions( |
78 e5App().getObject("ViewManager").getActions('view')) |
80 "View", |
79 self.__writeActions( |
81 e5App().getObject("ViewManager").getActions('view')) |
80 "Macro", |
82 self.__writeActions( |
81 e5App().getObject("ViewManager").getActions('macro')) |
83 "Macro", |
82 self.__writeActions( |
84 e5App().getObject("ViewManager").getActions('macro')) |
83 "Bookmarks", |
85 self.__writeActions( |
84 e5App().getObject("ViewManager").getActions('bookmark')) |
86 "Bookmarks", |
85 self.__writeActions( |
87 e5App().getObject("ViewManager").getActions('bookmark')) |
86 "Spelling", |
88 self.__writeActions( |
87 e5App().getObject("ViewManager").getActions('spelling')) |
89 "Spelling", |
88 self.__writeActions( |
90 e5App().getObject("ViewManager").getActions('spelling')) |
89 "Window", |
91 self.__writeActions( |
90 e5App().getObject("ViewManager").getActions('window')) |
92 "Window", |
|
93 e5App().getObject("ViewManager").getActions('window')) |
|
94 |
|
95 for category, ref in e5App().getPluginObjects(): |
|
96 if hasattr(ref, "getActions"): |
|
97 self.__writeActions(category, ref.getActions()) |
91 |
98 |
92 for category, ref in e5App().getPluginObjects(): |
99 else: |
93 if hasattr(ref, "getActions"): |
|
94 self.__writeActions(category, ref.getActions()) |
|
95 |
|
96 try: |
|
97 self.__writeActions( |
100 self.__writeActions( |
98 "HelpViewer", |
101 helpViewer.getActionsCategory(), |
99 e5App().getObject("DummyHelpViewer").getActions()) |
102 helpViewer.getActions()) |
100 except KeyError: |
|
101 # no QtWebKit available |
|
102 pass |
|
103 |
103 |
104 # add the main end tag |
104 # add the main end tag |
105 self.writeEndElement() |
105 self.writeEndElement() |
106 self.writeEndDocument() |
106 self.writeEndDocument() |
107 |
107 |