[core] replace widget.minwidth with widget.set('theme.minwidth')

This commit is contained in:
Tobias Witek 2020-03-07 13:21:19 +01:00
parent b841ba3c93
commit 47e8d5b82b
4 changed files with 3 additions and 5 deletions

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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')