From c7c966fb19bbad334e94dc79f62c404cc74c8178 Mon Sep 17 00:00:00 2001 From: pilkonimo Date: Wed, 29 Jan 2025 16:44:21 +0100 Subject: [PATCH] docs: debug examples for 'How to write a module' --- docs/development/module.rst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/development/module.rst b/docs/development/module.rst index 32a653ac..dbd2a19f 100644 --- a/docs/development/module.rst +++ b/docs/development/module.rst @@ -54,8 +54,8 @@ This example will show “hello world” in the status bar: import core.widget class Module(core.module.Module): - def __init__(self, config): - super().__init__(config, core.widget.Widget(self.full_text)) + def __init__(self, config, theme): + super().__init__(config, theme, core.widget.Widget(self.full_text)) def full_text(self, widgets): return 'hello world' @@ -167,11 +167,10 @@ events: import core.input class Module(core.module.Module): - @core.decorators.every(minutes=60, seconds=20) - def __init__(self, config): - super().__init__(config=config, widgets=) + def __init__(self, config, theme): + super().__init__(config, theme, widgets=) - core.input.register(widget, button=core.input.LEFT_MOUSE, cmd=) + core.input.register(, button=core.input.LEFT_MOUSE, cmd=) The command can be either a CLI tool that will be directly executed (e.g. ``cmd='shutdown -h now'``) or a method that will be executed. The @@ -194,8 +193,8 @@ To change the default update interval, you can use a simple decorator: class Module(core.module.Module): @core.decorators.every(minutes=60, seconds=20) - def __init__(self, config): - super().__init__(config=config, widgets=) + def __init__(self, config, theme): + super().__init__(config, theme, widgets=) **NOTE**: This makes the update interval of the module independent of what the user configures via ``-i ``! It is still possible to @@ -241,9 +240,9 @@ This behaviour can be achieved using the ``scrollable`` decorator like this: def __init__(self, config, theme): super().__init__(config, theme, core.widget.Widget(self.description)) - @core.decorators.scrollable - def description(self, widget): - pass # TODO: implement + @core.decorators.scrollable + def description(self, widget): + pass # TODO: implement There are a couple of parameters that can be set on the affected module, either in the module using ``self.set()`` or via the CLI using the ``--parameter`` flag: