- self._options = None
- self._data = Store()
-
- def get_config_desc(self):
- """ The configuration description is a dictionary that provides
- A description of the supported configuration options, as well
- as the default configuration option values.
- The key is the option name, the value is an array of 3 elements:
- - description
- - option type
- - default value
- """
- return self._options
-
- def set_config(self, config):
+ self._data = AdminStore()
+ self._plugins = plugins
+ self.is_enabled = False
+
+ @property
+ def is_readonly(self):
+ return self._data.is_readonly
+
+ def on_enable(self):
+ return
+
+ def on_disable(self):
+ return
+
+ def save_enabled_state(self):
+ enabled = []
+ self._plugins.refresh_enabled()
+ enabled.extend(self._plugins.enabled)
+ if self.is_enabled:
+ if self.name not in enabled:
+ enabled.append(self.name)
+ else:
+ if self.name in enabled:
+ enabled.remove(self.name)
+ self._plugins.save_enabled(enabled)
+
+ def enable(self):
+ if self.is_enabled:
+ return
+
+ self.refresh_plugin_config()
+ self.on_enable()
+ self.is_enabled = True
+ self.debug('Plugin enabled: %s' % self.name)
+
+ def disable(self):
+ if not self.is_enabled:
+ return
+
+ self.on_disable()
+
+ self.is_enabled = False
+ self.debug('Plugin disabled: %s' % self.name)
+
+ def import_config(self, config):