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