10 from E5Gui.E5Application import e5App |
10 from E5Gui.E5Application import e5App |
11 |
11 |
12 from .Config import templatesFileFormatVersion |
12 from .Config import templatesFileFormatVersion |
13 from .XMLStreamReaderBase import XMLStreamReaderBase |
13 from .XMLStreamReaderBase import XMLStreamReaderBase |
14 |
14 |
|
15 |
15 class TemplatesReader(XMLStreamReaderBase): |
16 class TemplatesReader(XMLStreamReaderBase): |
16 """ |
17 """ |
17 Class for reading an XML tasks file. |
18 Class for reading an XML tasks file. |
18 """ |
19 """ |
19 supportedVersions = ["4.0"] |
20 supportedVersions = ["4.0"] |
20 |
21 |
21 def __init__(self, device, viewer = None): |
22 def __init__(self, device, viewer=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param device reference to the I/O device to read from (QIODevice) |
26 @param device reference to the I/O device to read from (QIODevice) |
26 @param viewer reference to the template viewer object (TemplateViewer) |
27 @param viewer reference to the template viewer object (TemplateViewer) |
81 templateText = "" |
82 templateText = "" |
82 |
83 |
83 while not self.atEnd(): |
84 while not self.atEnd(): |
84 self.readNext() |
85 self.readNext() |
85 if self.isEndElement() and self.name() == "Template" and templateName: |
86 if self.isEndElement() and self.name() == "Template" and templateName: |
86 self.viewer.addEntry(self.groupName, templateName, |
87 self.viewer.addEntry(self.groupName, templateName, |
87 templateDescription, templateText, |
88 templateDescription, templateText, |
88 quiet = True) |
89 quiet=True) |
89 break |
90 break |
90 |
91 |
91 if self.isStartElement(): |
92 if self.isStartElement(): |
92 if self.name() == "TemplateDescription": |
93 if self.name() == "TemplateDescription": |
93 templateDescription = self.readElementText() |
94 templateDescription = self.readElementText() |