[modules/nic] Re-enable NIC module
Re-add the NIC module with all its functionality (hopefully...). This introduces a new concept: Instead of having separate queries for critical and warning (which really are just another set of states), a module can now return a list of states for each widget. All the state information is then merged together into a single theme. So, for instance, the NIC module can return a state saying "critical - wlan-down", which applies the theme information for both "critical" and "wlan-down". see #23
This commit is contained in:
parent
c820223d0c
commit
a045962d00
8 changed files with 104 additions and 19 deletions
|
@ -118,16 +118,19 @@ class Theme(object):
|
|||
self._cycle = self._cycles[self._cycle_idx]
|
||||
|
||||
module_theme = self._theme.get(widget.module, {})
|
||||
if name != widget.state():
|
||||
# avoid infinite recursion
|
||||
state_theme = self._get(widget, widget.state(), {})
|
||||
else:
|
||||
state_theme = {}
|
||||
|
||||
state_themes = []
|
||||
# avoid infinite recursion
|
||||
if name not in widget.state():
|
||||
for state in widget.state():
|
||||
state_themes.append(self._get(widget, state, {}))
|
||||
|
||||
value = self._defaults.get(name, default)
|
||||
value = self._cycle.get(name, value)
|
||||
value = module_theme.get(name, value)
|
||||
value = state_theme.get(name, value)
|
||||
|
||||
for theme in state_themes:
|
||||
value = theme.get(name, value)
|
||||
|
||||
return value
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue