From 47e8d5b82bb95484736736a9a164cf12c1c18fd6 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 7 Mar 2020 13:21:19 +0100 Subject: [PATCH] [core] replace widget.minwidth with widget.set('theme.minwidth') --- core/decorators.py | 2 +- core/output.py | 2 +- core/widget.py | 2 -- modules/core/cpu.py | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/decorators.py b/core/decorators.py index 635e123..4c241a8 100644 --- a/core/decorators.py +++ b/core/decorators.py @@ -8,7 +8,7 @@ def scrollable(func): return text width = widget.get('theme.width', util.format.asint(module.parameter('width', 30))) if util.format.asbool(module.parameter('scrolling.makewide', True)): - widget.minwidth = 'A'*width + widget.set('theme.minwidth', 'A'*width) if width < 0 or len(text) <= width: return text diff --git a/core/output.py b/core/output.py index 0a7fa00..a8358fc 100644 --- a/core/output.py +++ b/core/output.py @@ -86,7 +86,7 @@ class i3(object): 'full_text': self.__decorate(module, widget, text), 'color': self._theme.fg(widget), 'background': self._theme.bg(widget), - 'min_width': self.__decorate(module, widget, widget.minwidth), + 'min_width': self.__decorate(module, widget, widget.get('theme.minwidth')), }) return [attr] diff --git a/core/widget.py b/core/widget.py index 660f4f2..5dfb4d9 100644 --- a/core/widget.py +++ b/core/widget.py @@ -9,8 +9,6 @@ class Widget(util.store.Store, core.input.Object): self._module = module self._name = name - self.minwidth = None - def name(self): return self._name diff --git a/modules/core/cpu.py b/modules/core/cpu.py index 3c9787f..250f177 100644 --- a/modules/core/cpu.py +++ b/modules/core/cpu.py @@ -17,7 +17,7 @@ import core.input class Module(core.module.Module): def __init__(self, config=None): super().__init__(config, core.widget.Widget(self.utilization)) - self.widget().minwidth = self._format.format(100.0-10e-20) + self.widget().set('theme.minwidth', self._format.format(100.0-10e-20)) self._utilization = psutil.cpu_percent(percpu=False) core.input.register(self, button=core.input.LEFT_MOUSE, cmd='gnome-system-monitor')