diff --git a/core/module.py b/core/module.py index 455620a..89cdbba 100644 --- a/core/module.py +++ b/core/module.py @@ -12,14 +12,14 @@ except Exception as e: log = logging.getLogger(__name__) -def load(module_name, config=core.config.Config([])): +def load(module_name, config=core.config.Config([]), theme=None): error = None module_short, alias = (module_name.split(':') + [module_name])[0:2] config.set('__alias__', alias) for namespace in [ 'core', 'contrib' ]: try: mod = importlib.import_module('modules.{}.{}'.format(namespace, module_short)) - return getattr(mod, 'Module')(config) + return getattr(mod, 'Module')(config, theme) except ImportError as e: log.fatal('failed to import {}: {}'.format(module_short, e)) if not error or module_short in error: @@ -28,7 +28,7 @@ def load(module_name, config=core.config.Config([])): return Error(config=config, module=module_name, error=error) class Module(core.input.Object): - def __init__(self, config=core.config.Config([]), widgets=[]): + def __init__(self, config=core.config.Config([]), theme=None, widgets=[]): super().__init__() self.__config = config self.__widgets = widgets if isinstance(widgets, list) else [ widgets ] @@ -90,8 +90,8 @@ class Module(core.input.Object): return None class Error(Module): - def __init__(self, module, error, config=core.config.Config([])): - super().__init__(config, core.widget.Widget(self.full_text)) + def __init__(self, module, error, config=core.config.Config([]), theme=None): + super().__init__(config, theme, core.widget.Widget(self.full_text)) self.__module = module self.__error = error diff --git a/tests/core/test_decorators.py b/tests/core/test_decorators.py index e345725..fb3c37e 100644 --- a/tests/core/test_decorators.py +++ b/tests/core/test_decorators.py @@ -6,9 +6,9 @@ import core.module import core.config class TestModule(core.module.Module): - def __init__(self, config=None): + def __init__(self, config=None, theme=None): config = core.config.Config([]) - super().__init__(config, core.widget.Widget(self.get)) + super().__init__(config, theme, core.widget.Widget(self.get)) self.text = '' @core.decorators.scrollable diff --git a/tests/core/test_widget.py b/tests/core/test_widget.py index 7e68670..084a8fc 100644 --- a/tests/core/test_widget.py +++ b/tests/core/test_widget.py @@ -6,8 +6,8 @@ import core.module import core.config class TestModule(core.module.Module): - def __init__(self, widgets, config=core.config.Config([])): - super().__init__(config, widgets) + def __init__(self, widgets, config=core.config.Config([]), theme=None): + super().__init__(config, theme, widgets) self.states = [] def update(self): diff --git a/tests/modules/test_kernel.py b/tests/modules/test_kernel.py index bef3472..8d5034e 100644 --- a/tests/modules/test_kernel.py +++ b/tests/modules/test_kernel.py @@ -6,7 +6,7 @@ import modules.core.kernel class kernel(unittest.TestCase): def setUp(self): self.someKernel = 'this-is-my-kernel' - self.module = modules.core.kernel.Module(config=core.config.Config([])) + self.module = modules.core.kernel.Module(config=core.config.Config([]), theme=None) def test_full_text(self): with unittest.mock.patch('modules.core.kernel.platform') as platform: