From 5e673482d3b5e6a2b54d6c2943b2747a42d365d1 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 23 Feb 2020 14:52:58 +0100 Subject: [PATCH] [core] Nicify error widget --- core/decorators.py | 2 +- core/module.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/decorators.py b/core/decorators.py index 2d39521..91727f9 100644 --- a/core/decorators.py +++ b/core/decorators.py @@ -11,7 +11,7 @@ def scrollable(func): if width < 0 or len(text) <= width: return text - bounce = util.format.asint(module.parameter('scrolling.bounce', 1)) + bounce = util.format.asbool(module.parameter('scrolling.bounce', True)) scroll_speed = util.format.asint(module.parameter('scrolling.speed', 1)) start = widget.get('scrolling.start', -1) direction = widget.get('scrolling.direction', 'right') diff --git a/core/module.py b/core/module.py index e45d3f1..8f159d6 100644 --- a/core/module.py +++ b/core/module.py @@ -30,6 +30,9 @@ class Module(core.input.Object): # TODO retrieve from config file return value + def set(self, key, value): + self._config.set('{}.{}'.format(self.name(), key), value) + def update(self): pass @@ -48,7 +51,9 @@ class Error(Module): self._module = module self._error = error - self.widgets()[0].set('theme.width', 15) + self.set('scrolling.bounce', False) + self.set('scrolling.speed', 2) + self.set('width', 15) @core.decorators.scrollable def full_text(self, widget):