[modules] Re-add module nic
This commit is contained in:
parent
7420434358
commit
533b8ca0cc
8 changed files with 134 additions and 8 deletions
|
@ -43,7 +43,7 @@ class Module(core.input.Object):
|
|||
self.update()
|
||||
except Exception as e:
|
||||
module = Error(self._config, 'error', str(e))
|
||||
self._widgets = [module.widgets()[0]]
|
||||
self._widgets = [module.widget()]
|
||||
self.update = module.update
|
||||
|
||||
def name(self):
|
||||
|
@ -55,6 +55,13 @@ class Module(core.input.Object):
|
|||
def widgets(self):
|
||||
return self._widgets
|
||||
|
||||
def widget(self, name=None):
|
||||
if not name: return self.widgets()[0]
|
||||
|
||||
for w in self.widgets():
|
||||
if w.name() == name: return w
|
||||
return None
|
||||
|
||||
def state(self, widget):
|
||||
return []
|
||||
|
||||
|
|
|
@ -3,10 +3,14 @@ import core.decorators
|
|||
import util.store
|
||||
|
||||
class Widget(util.store.Store, core.input.Object):
|
||||
def __init__(self, full_text):
|
||||
def __init__(self, full_text='', name=None, module=None):
|
||||
super(Widget, self).__init__()
|
||||
self._full_text = full_text
|
||||
self._module = None
|
||||
self._module = module
|
||||
self._name = name
|
||||
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
def full_text(self, value=None):
|
||||
if value:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue