E5XML/PluginRepositoryReader.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
9 9
10 from .Config import pluginRepositoryFileFormatVersion 10 from .Config import pluginRepositoryFileFormatVersion
11 from .XMLStreamReaderBase import XMLStreamReaderBase 11 from .XMLStreamReaderBase import XMLStreamReaderBase
12 12
13 import Preferences 13 import Preferences
14
14 15
15 class PluginRepositoryReader(XMLStreamReaderBase): 16 class PluginRepositoryReader(XMLStreamReaderBase):
16 """ 17 """
17 Class to read the plug-in repository contents file. 18 Class to read the plug-in repository contents file.
18 """ 19 """
37 """ 38 """
38 while not self.atEnd(): 39 while not self.atEnd():
39 self.readNext() 40 self.readNext()
40 if self.isStartElement(): 41 if self.isStartElement():
41 if self.name() == "Plugins": 42 if self.name() == "Plugins":
42 self.version = self.attribute("version", 43 self.version = self.attribute("version",
43 pluginRepositoryFileFormatVersion) 44 pluginRepositoryFileFormatVersion)
44 if self.version not in self.supportedVersions: 45 if self.version not in self.supportedVersions:
45 self.raiseUnsupportedFormatVersion(self.version) 46 self.raiseUnsupportedFormatVersion(self.version)
46 elif self.name() == "RepositoryUrl": 47 elif self.name() == "RepositoryUrl":
47 url = self.readElementText() 48 url = self.readElementText()
55 56
56 def __readPlugin(self): 57 def __readPlugin(self):
57 """ 58 """
58 Private method to read the plug-in info. 59 Private method to read the plug-in info.
59 """ 60 """
60 pluginInfo = {"name" : "", 61 pluginInfo = {"name": "",
61 "short" : "", 62 "short": "",
62 "description" : "", 63 "description": "",
63 "url" : "", 64 "url": "",
64 "author" : "", 65 "author": "",
65 "version" : "", 66 "version": "",
66 "filename" : "", 67 "filename": "",
67 } 68 }
68 pluginInfo["status"] = self.attribute("status", "unknown") 69 pluginInfo["status"] = self.attribute("status", "unknown")
69 70
70 while not self.atEnd(): 71 while not self.atEnd():
71 self.readNext() 72 self.readNext()
72 if self.isEndElement() and self.name() == "Plugin": 73 if self.isEndElement() and self.name() == "Plugin":
73 self.dlg.addEntry(pluginInfo["name"], pluginInfo["short"], 74 self.dlg.addEntry(pluginInfo["name"], pluginInfo["short"],
74 pluginInfo["description"], pluginInfo["url"], 75 pluginInfo["description"], pluginInfo["url"],
75 pluginInfo["author"], pluginInfo["version"], 76 pluginInfo["author"], pluginInfo["version"],
76 pluginInfo["filename"], pluginInfo["status"]) 77 pluginInfo["filename"], pluginInfo["status"])
77 break 78 break
78 79
79 if self.isStartElement(): 80 if self.isStartElement():

eric ide

mercurial