[modules/all] Update constructore to include theme
This commit is contained in:
parent
1f94eab927
commit
f2d411276d
78 changed files with 158 additions and 158 deletions
|
@ -30,8 +30,8 @@ import util.graph
|
|||
import util.format
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config, channel):
|
||||
super().__init__(config, core.widget.Widget(self.volume))
|
||||
def __init__(self, config, theme, channel):
|
||||
super().__init__(config, theme, core.widget.Widget(self.volume))
|
||||
|
||||
if util.format.asbool(self.parameter('autostart', False)):
|
||||
util.cli.execute('pulseaudio --start', ignore_errors=True)
|
||||
|
|
|
@ -193,8 +193,8 @@ class UPowerManager():
|
|||
return "Pending discharge"
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.capacity))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.capacity))
|
||||
|
||||
try:
|
||||
self.power = UPowerManager()
|
||||
|
|
|
@ -97,9 +97,9 @@ class BatteryManager(object):
|
|||
return 'Charged'
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
def __init__(self, config, theme):
|
||||
widgets = []
|
||||
super().__init__(config, widgets)
|
||||
super().__init__(config, theme, widgets)
|
||||
|
||||
self.__manager = BatteryManager()
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ import util.cli
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(seconds=30)
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.brightness))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.brightness))
|
||||
|
||||
self.__brightness = 'n/a'
|
||||
self.__readcmd = None
|
||||
|
|
|
@ -15,8 +15,8 @@ import core.widget
|
|||
import core.input
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.utilization))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.utilization))
|
||||
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,
|
||||
|
|
|
@ -12,8 +12,8 @@ from .datetime import Module
|
|||
|
||||
class Module(Module):
|
||||
@core.decorators.every(hours=1)
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme)
|
||||
|
||||
def default_format(self):
|
||||
return '%x'
|
||||
|
|
|
@ -16,8 +16,8 @@ import core.widget
|
|||
import core.input
|
||||
|
||||
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))
|
||||
|
||||
core.input.register(self, button=core.input.LEFT_MOUSE, cmd='calendar')
|
||||
self._fmt = self.parameter('format', self.default_format())
|
||||
|
|
|
@ -19,8 +19,8 @@ import core.input
|
|||
import util.format
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.diskspace))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.diskspace))
|
||||
|
||||
self._path = self.parameter('path', '/')
|
||||
self._format = self.parameter('format', '{used}/{size} ({percent:05.02f}%)')
|
||||
|
|
|
@ -9,8 +9,8 @@ import core.widget
|
|||
import core.event
|
||||
|
||||
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))
|
||||
self.__error = ''
|
||||
self.__state = 'critical'
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ import core.widget
|
|||
import util.cli
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, [])
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, [])
|
||||
|
||||
self.__error = False
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import core.decorators
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(minutes=60)
|
||||
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 platform.release()
|
||||
|
|
|
@ -24,8 +24,8 @@ import core.input
|
|||
import util.format
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.current_layout))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.current_layout))
|
||||
|
||||
core.input.register(self, button=core.input.LEFT_MOUSE,
|
||||
cmd=self.__next_keymap)
|
||||
|
|
|
@ -14,8 +14,8 @@ import core.module
|
|||
import core.input
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.load))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.load))
|
||||
self._load = [0, 0, 0]
|
||||
try:
|
||||
self._cpus = multiprocessing.cpu_count()
|
||||
|
|
|
@ -18,8 +18,8 @@ import core.input
|
|||
import util.format
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.memory_usage))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.memory_usage))
|
||||
core.input.register(self, button=core.input.LEFT_MOUSE,
|
||||
cmd='gnome-system-monitor')
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ import util.format
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(seconds=10)
|
||||
def __init__(self, config):
|
||||
def __init__(self, config, theme):
|
||||
widgets = []
|
||||
super().__init__(config, widgets)
|
||||
super().__init__(config, theme, widgets)
|
||||
self._exclude = tuple(filter(len, self.parameter('exclude', 'lo,virbr,docker,vboxnet,veth,br').split(',')))
|
||||
self._include = self.parameter('include', '').split(',')
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from .__pulseaudio import Module
|
||||
|
||||
class Module(Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, 'sink')
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, 'sink')
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from .__pulseaudio import Module
|
||||
|
||||
class Module(Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, 'source')
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, 'source')
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -51,9 +51,10 @@ def get_rtt(module, widget):
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(seconds=60)
|
||||
def __init__(self, config):
|
||||
widget = core.widget.Widget(self.rtt)
|
||||
super().__init__(config, widget)
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.rtt))
|
||||
|
||||
widget = self.widget()
|
||||
|
||||
widget.set('address', self.parameter('address', '8.8.8.8'))
|
||||
widget.set('rtt-probes', self.parameter('probes', 5))
|
||||
|
|
|
@ -66,9 +66,8 @@ def get_redshift_value(module):
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(seconds=10)
|
||||
def __init__(self, config):
|
||||
widget = core.widget.Widget(self.text)
|
||||
super().__init__(config, widget)
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.text))
|
||||
|
||||
self.__thread = None
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import util.cli
|
|||
import util.format
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, [])
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, [])
|
||||
|
||||
self.__chip = self.parameter('chip', '')
|
||||
self.__data = {}
|
||||
|
|
|
@ -12,8 +12,8 @@ import core.decorators
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(minutes=60)
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.text))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.text))
|
||||
self.__text = self.parameter("text", "")
|
||||
|
||||
def text(self, _):
|
||||
|
|
|
@ -7,7 +7,7 @@ import core.widget
|
|||
import core.module
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget('test'))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config=config, theme=theme, widgets=core.widget.Widget('test'))
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -12,8 +12,8 @@ from .datetime import Module
|
|||
|
||||
class Module(Module):
|
||||
@core.decorators.every(seconds=59) # ensures one update per minute
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme)
|
||||
|
||||
def default_format(self):
|
||||
return '%X'
|
||||
|
|
|
@ -43,8 +43,8 @@ def build_menu(parent, current_directory, callback):
|
|||
parent.add_cascade(entry.name, submenu)
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config):
|
||||
super().__init__(config, core.widget.Widget(self.text))
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.text))
|
||||
|
||||
self.__duration = int(self.parameter('duration', 30))
|
||||
self.__offx = int(self.parameter('offx', 0))
|
||||
|
|
|
@ -35,9 +35,9 @@ except:
|
|||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(seconds=5) # takes up to 5s to detect a new screen
|
||||
def __init__(self, config):
|
||||
def __init__(self, config, theme):
|
||||
widgets = []
|
||||
super().__init__(config, widgets)
|
||||
super().__init__(config, theme, widgets)
|
||||
|
||||
self._autoupdate = util.format.asbool(self.parameter('autoupdate', True))
|
||||
self._needs_update = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue