mirror of
https://github.com/yweber/lodel2.git
synced 2025-10-29 10:39:03 +01:00
Documentation on the lodel.plugin.interface module
This commit is contained in:
parent
bc68848600
commit
bdbb76e10e
1 changed files with 12 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
## @package lodel.plugin.interface Handles the Interface type plugins
|
||||||
|
|
||||||
from lodel.context import LodelContext
|
from lodel.context import LodelContext
|
||||||
LodelContext.expose_modules(globals(), {
|
LodelContext.expose_modules(globals(), {
|
||||||
'lodel.plugin.plugins': ['Plugin'],
|
'lodel.plugin.plugins': ['Plugin'],
|
||||||
|
|
@ -5,16 +7,18 @@ LodelContext.expose_modules(globals(), {
|
||||||
'LodelScriptError', 'DatasourcePluginError'],
|
'LodelScriptError', 'DatasourcePluginError'],
|
||||||
'lodel.validator.validator': ['Validator']})
|
'lodel.validator.validator': ['Validator']})
|
||||||
|
|
||||||
|
## @brief Global type name used in the settings of Lodel for this type of plugins
|
||||||
_glob_typename = 'ui'
|
_glob_typename = 'ui'
|
||||||
|
|
||||||
|
|
||||||
##@brief Handles interfaces plugin
|
##@brief A plugin Interface
|
||||||
#@note It's a singleton class. Only 1 interface allowed by instance.
|
#@note It's a singleton class. Only 1 interface allowed by instance.
|
||||||
class InterfacePlugin(Plugin):
|
class InterfacePlugin(Plugin):
|
||||||
|
|
||||||
##@brief Singleton instance storage
|
## @brief Singleton instance storage
|
||||||
_instance = None
|
_instance = None
|
||||||
|
|
||||||
|
## @brief Settings description
|
||||||
_plist_confspecs = {
|
_plist_confspecs = {
|
||||||
'section': 'lodel2',
|
'section': 'lodel2',
|
||||||
'key': 'interface',
|
'key': 'interface',
|
||||||
|
|
@ -22,16 +26,20 @@ class InterfacePlugin(Plugin):
|
||||||
'validator': Validator(
|
'validator': Validator(
|
||||||
'plugin', none_is_valid = True, ptype = _glob_typename)}
|
'plugin', none_is_valid = True, ptype = _glob_typename)}
|
||||||
|
|
||||||
|
## @brief plugin type name
|
||||||
_type_conf_name = _glob_typename
|
_type_conf_name = _glob_typename
|
||||||
|
|
||||||
|
##
|
||||||
|
# @param name str : Name of the interface plugin
|
||||||
|
# @throw PluginError if there is already an interface plugin instanciated
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
if InterfacePlugin._instance is not None:
|
if InterfacePlugin._instance is not None:
|
||||||
raise PluginError("Maximum one interface allowed")
|
raise PluginError("Maximum one interface allowed")
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
self._instance = self
|
self._instance = self
|
||||||
|
|
||||||
##@brief Clear class
|
## @brief Clears the singleton from its active instance
|
||||||
#@see plugins.Plugin::clear()
|
# @see plugins.Plugin::clear()
|
||||||
@classmethod
|
@classmethod
|
||||||
def clear_cls(cls):
|
def clear_cls(cls):
|
||||||
if cls._instance is not None:
|
if cls._instance is not None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue