15 |
15 |
16 class MultiProjectReader(XMLStreamReaderBase): |
16 class MultiProjectReader(XMLStreamReaderBase): |
17 """ |
17 """ |
18 Class for reading an XML multi project file. |
18 Class for reading an XML multi project file. |
19 """ |
19 """ |
20 supportedVersions = ["4.2"] |
20 supportedVersions = ["4.2", "5.0"] |
21 |
21 |
22 def __init__(self, device, multiProject): |
22 def __init__(self, device, multiProject): |
23 """ |
23 """ |
24 Constructor |
24 Constructor |
25 |
25 |
59 """ |
59 """ |
60 Private method to read the project infos. |
60 Private method to read the project infos. |
61 """ |
61 """ |
62 while not self.atEnd(): |
62 while not self.atEnd(): |
63 self.readNext() |
63 self.readNext() |
64 if self.isEndElement() and self.name() == "Task": |
64 if self.isEndElement() and self.name() == "Projects": |
65 break |
65 break |
66 |
66 |
67 if self.isStartElement(): |
67 if self.isStartElement(): |
68 if self.name() == "Project": |
68 if self.name() == "Project": |
69 self.__readProject() |
69 self.__readProject() |
79 project["master"] = self.toBool(self.attribute("isMaster", "False")) |
79 project["master"] = self.toBool(self.attribute("isMaster", "False")) |
80 |
80 |
81 while not self.atEnd(): |
81 while not self.atEnd(): |
82 self.readNext() |
82 self.readNext() |
83 if self.isEndElement() and self.name() == "Project": |
83 if self.isEndElement() and self.name() == "Project": |
|
84 if 'category' not in project: |
|
85 # upgrade from 4.2 format |
|
86 project["category"] = "" |
84 self.multiProject.projects.append(project) |
87 self.multiProject.projects.append(project) |
85 break |
88 break |
86 |
89 |
87 if self.isStartElement(): |
90 if self.isStartElement(): |
88 if self.name() == "ProjectName": |
91 if self.name() == "ProjectName": |
90 elif self.name() == "ProjectFile": |
93 elif self.name() == "ProjectFile": |
91 project["file"] = Utilities.toNativeSeparators( |
94 project["file"] = Utilities.toNativeSeparators( |
92 self.readElementText()) |
95 self.readElementText()) |
93 elif self.name() == "ProjectDescription": |
96 elif self.name() == "ProjectDescription": |
94 project["description"] = self.readElementText() |
97 project["description"] = self.readElementText() |
|
98 elif self.name() == "ProjectCategory": |
|
99 project["category"] = self.readElementText() |
95 else: |
100 else: |
96 self.raiseUnexpectedStartTag(self.name()) |
101 self.raiseUnexpectedStartTag(self.name()) |