diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-10 13:40:23 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-06-10 13:40:23 +0200 |
commit | e8af12efa928a1eca54216398b7ace09af169e8d (patch) | |
tree | fb5e4caa8ab25001575747263f1dc46e11856fec | |
parent | e6135e20aa7c86bcb0639cc4d13b5845123bb6f0 (diff) | |
download | portato-e8af12efa928a1eca54216398b7ace09af169e8d.tar.gz portato-e8af12efa928a1eca54216398b7ace09af169e8d.tar.bz2 portato-e8af12efa928a1eca54216398b7ace09af169e8d.zip |
Modified plugin.xsd so it allows also menu-only plugins
Diffstat (limited to '')
-rw-r--r-- | plugin.xsd | 2 | ||||
-rw-r--r-- | portato/plugin.py | 13 |
2 files changed, 8 insertions, 7 deletions
@@ -7,7 +7,7 @@ <xs:element name="author" type="string" /> <xs:element name="import" type="importString" minOccurs="0"/> <xs:element name="frontends" type="stringList" minOccurs="0" /> - <xs:element name="hooks"> + <xs:element name="hooks" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="hook" minOccurs="1" maxOccurs="unbounded"> diff --git a/portato/plugin.py b/portato/plugin.py index bf9dc91..5926922 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -180,12 +180,13 @@ class Plugin: """Gets an <hooks>-elements and parses it. @param hooks: the hooks node - @type hooks: Node""" + @type hooks: NodeList""" - for h in hooks.getElementsByTagName("hook"): - hook = Hook(self, str(h.getAttribute("type")), str(h.getAttribute("call"))) - hook.parse_connects(h.getElementsByTagName("connect")) - self.hooks.append(hook) + if hooks: + for h in hooks[0].getElementsByTagName("hook"): + hook = Hook(self, str(h.getAttribute("type")), str(h.getAttribute("call"))) + hook.parse_connects(h.getElementsByTagName("connect")) + self.hooks.append(hook) def parse_menus (self, menus): """Get a list of <menu>-elements and parses them. @@ -388,7 +389,7 @@ class PluginQueue: if frontendOK is None or frontendOK == True: plugin = Plugin(p, elem.getElementsByTagName("name")[0], elem.getElementsByTagName("author")[0]) - plugin.parse_hooks(elem.getElementsByTagName("hooks")[0]) + plugin.parse_hooks(elem.getElementsByTagName("hooks")) plugin.set_import(elem.getElementsByTagName("import")) plugin.parse_menus(elem.getElementsByTagName("menu")) plugin.parse_options(elem.getElementsByTagName("options")) |