mirror of
https://github.com/yweber/lodel2.git
synced 2025-10-29 02:29: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
|
||||
LodelContext.expose_modules(globals(), {
|
||||
'lodel.plugin.plugins': ['Plugin'],
|
||||
|
|
@ -5,16 +7,18 @@ LodelContext.expose_modules(globals(), {
|
|||
'LodelScriptError', 'DatasourcePluginError'],
|
||||
'lodel.validator.validator': ['Validator']})
|
||||
|
||||
## @brief Global type name used in the settings of Lodel for this type of plugins
|
||||
_glob_typename = 'ui'
|
||||
|
||||
|
||||
##@brief Handles interfaces plugin
|
||||
##@brief A plugin Interface
|
||||
#@note It's a singleton class. Only 1 interface allowed by instance.
|
||||
class InterfacePlugin(Plugin):
|
||||
|
||||
##@brief Singleton instance storage
|
||||
## @brief Singleton instance storage
|
||||
_instance = None
|
||||
|
||||
## @brief Settings description
|
||||
_plist_confspecs = {
|
||||
'section': 'lodel2',
|
||||
'key': 'interface',
|
||||
|
|
@ -22,16 +26,20 @@ class InterfacePlugin(Plugin):
|
|||
'validator': Validator(
|
||||
'plugin', none_is_valid = True, ptype = _glob_typename)}
|
||||
|
||||
## @brief plugin type name
|
||||
_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):
|
||||
if InterfacePlugin._instance is not None:
|
||||
raise PluginError("Maximum one interface allowed")
|
||||
super().__init__(name)
|
||||
self._instance = self
|
||||
|
||||
##@brief Clear class
|
||||
#@see plugins.Plugin::clear()
|
||||
## @brief Clears the singleton from its active instance
|
||||
# @see plugins.Plugin::clear()
|
||||
@classmethod
|
||||
def clear_cls(cls):
|
||||
if cls._instance is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue