From f9a4a36b341b1d866269f568e86cbf63b90b5f63 Mon Sep 17 00:00:00 2001 From: Necoro <> Date: Mon, 14 Jan 2008 16:45:06 +0000 Subject: r609@Devoty: necoro | 2008-01-14 17:04:38 +0100 Allowed '-' and '_' in key names. Also use group names instead of their number. r610@Devoty: necoro | 2008-01-14 17:05:42 +0100 Disabled saving of the queues r611@Devoty: necoro | 2008-01-14 17:08:53 +0100 Added the possibility to permanently en-/disable plugins r612@Devoty: necoro | 2008-01-14 17:14:09 +0100 adjust changelog and translations r613@Devoty: necoro | 2008-01-14 17:40:53 +0100 Dropdown should be localized too --- portato/plugin.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'portato/plugin.py') diff --git a/portato/plugin.py b/portato/plugin.py index 09f2dea..b081ecd 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -155,6 +155,8 @@ class Hook: class Plugin: """A complete plugin.""" + (STAT_DISABLED, STAT_TEMP_ENABLED, STAT_ENABLED, STAT_TEMP_DISABLED) = range(4) + def __init__ (self, file, name, author): """Constructor. @@ -173,6 +175,8 @@ class Plugin: self.menus = [] self.options = Options() + self.status = self.STAT_ENABLED + def parse_hooks (self, hooks): """Gets an -elements and parses it. @@ -199,6 +203,8 @@ class Plugin: if options: for o in options: self.options.parse(o.getElementsByTagName("option")) + + self.status = self.STAT_DISABLED if self.options.get("disabled") else self.STAT_ENABLED def set_import (self, imports): """This gets a list of imports and parses them - setting the import needed to call the plugin. @@ -234,7 +240,7 @@ class Plugin: return self.options.set(name, value) def is_enabled (self): - return not self.get_option("disabled") + return (self.status in (self.STAT_ENABLED, self.STAT_TEMP_ENABLED)) class PluginQueue: """Class managing and loading the plugins.""" -- cgit v1.2.3