19 """ |
19 """ |
20 Class to read the plug-in repository contents file. |
20 Class to read the plug-in repository contents file. |
21 """ |
21 """ |
22 supportedVersions = ["4.1", "4.2"] |
22 supportedVersions = ["4.1", "4.2"] |
23 |
23 |
24 def __init__(self, device, dlg): |
24 def __init__(self, device, entryCallback): |
25 """ |
25 """ |
26 Constructor |
26 Constructor |
27 |
27 |
28 @param device reference to the I/O device to read from (QIODevice) |
28 @param device reference to the I/O device to read from (QIODevice) |
29 @param dlg reference to the plug-in repository dialog |
29 @param entryCallback reference to a function to be called once the |
|
30 data for a plug-in has been read (function) |
30 """ |
31 """ |
31 XMLStreamReaderBase.__init__(self, device) |
32 XMLStreamReaderBase.__init__(self, device) |
32 |
33 |
33 self.dlg = dlg |
34 self.__entryCallback = entryCallback |
34 |
35 |
35 self.version = "" |
36 self.version = "" |
36 |
37 |
37 def readXML(self): |
38 def readXML(self): |
38 """ |
39 """ |
72 pluginInfo["status"] = self.attribute("status", "unknown") |
73 pluginInfo["status"] = self.attribute("status", "unknown") |
73 |
74 |
74 while not self.atEnd(): |
75 while not self.atEnd(): |
75 self.readNext() |
76 self.readNext() |
76 if self.isEndElement() and self.name() == "Plugin": |
77 if self.isEndElement() and self.name() == "Plugin": |
77 self.dlg.addEntry(pluginInfo["name"], pluginInfo["short"], |
78 self.__entryCallback( |
78 pluginInfo["description"], pluginInfo["url"], |
79 pluginInfo["name"], pluginInfo["short"], |
79 pluginInfo["author"], pluginInfo["version"], |
80 pluginInfo["description"], pluginInfo["url"], |
80 pluginInfo["filename"], pluginInfo["status"]) |
81 pluginInfo["author"], pluginInfo["version"], |
|
82 pluginInfo["filename"], pluginInfo["status"]) |
81 break |
83 break |
82 |
84 |
83 if self.isStartElement(): |
85 if self.isStartElement(): |
84 if self.name() == "Name": |
86 if self.name() == "Name": |
85 pluginInfo["name"] = self.readElementText() |
87 pluginInfo["name"] = self.readElementText() |