|
@@ -1,3 +1,5 @@
|
|
1
|
+## @package lodel.plugin.interface Handles the Interface type plugins
|
|
2
|
+
|
1
|
3
|
from lodel.context import LodelContext
|
2
|
4
|
LodelContext.expose_modules(globals(), {
|
3
|
5
|
'lodel.plugin.plugins': ['Plugin'],
|
|
@@ -5,16 +7,18 @@ LodelContext.expose_modules(globals(), {
|
5
|
7
|
'LodelScriptError', 'DatasourcePluginError'],
|
6
|
8
|
'lodel.validator.validator': ['Validator']})
|
7
|
9
|
|
|
10
|
+## @brief Global type name used in the settings of Lodel for this type of plugins
|
8
|
11
|
_glob_typename = 'ui'
|
9
|
12
|
|
10
|
13
|
|
11
|
|
-##@brief Handles interfaces plugin
|
|
14
|
+##@brief A plugin Interface
|
12
|
15
|
#@note It's a singleton class. Only 1 interface allowed by instance.
|
13
|
16
|
class InterfacePlugin(Plugin):
|
14
|
17
|
|
15
|
|
- ##@brief Singleton instance storage
|
|
18
|
+ ## @brief Singleton instance storage
|
16
|
19
|
_instance = None
|
17
|
20
|
|
|
21
|
+ ## @brief Settings description
|
18
|
22
|
_plist_confspecs = {
|
19
|
23
|
'section': 'lodel2',
|
20
|
24
|
'key': 'interface',
|
|
@@ -22,16 +26,20 @@ class InterfacePlugin(Plugin):
|
22
|
26
|
'validator': Validator(
|
23
|
27
|
'plugin', none_is_valid = True, ptype = _glob_typename)}
|
24
|
28
|
|
|
29
|
+ ## @brief plugin type name
|
25
|
30
|
_type_conf_name = _glob_typename
|
26
|
31
|
|
|
32
|
+ ##
|
|
33
|
+ # @param name str : Name of the interface plugin
|
|
34
|
+ # @throw PluginError if there is already an interface plugin instanciated
|
27
|
35
|
def __init__(self, name):
|
28
|
36
|
if InterfacePlugin._instance is not None:
|
29
|
37
|
raise PluginError("Maximum one interface allowed")
|
30
|
38
|
super().__init__(name)
|
31
|
39
|
self._instance = self
|
32
|
40
|
|
33
|
|
- ##@brief Clear class
|
34
|
|
- #@see plugins.Plugin::clear()
|
|
41
|
+ ## @brief Clears the singleton from its active instance
|
|
42
|
+ # @see plugins.Plugin::clear()
|
35
|
43
|
@classmethod
|
36
|
44
|
def clear_cls(cls):
|
37
|
45
|
if cls._instance is not None:
|