[core/output] Add id of widget and module to output
In the process of that, fix a bug in how the parent class constructors were invoked.
This commit is contained in:
parent
4d34fa9261
commit
fca364554e
4 changed files with 8 additions and 6 deletions
|
@ -38,7 +38,9 @@ class i3(object):
|
|||
for module in self._modules:
|
||||
for widget in module.widgets():
|
||||
status.append({
|
||||
'full_text': widget.full_text()
|
||||
'full_text': widget.full_text(),
|
||||
'instance': widget.id(),
|
||||
'name': module.id(),
|
||||
})
|
||||
return {
|
||||
'data': status,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import core.input
|
||||
import util.store
|
||||
|
||||
class Widget(util.store.Store):
|
||||
class Widget(util.store.Store, core.input.Object):
|
||||
def __init__(self, full_text):
|
||||
super(Widget, self).__init__()
|
||||
self._full_text = full_text
|
||||
|
||||
def full_text(self, value=None):
|
||||
|
|
|
@ -2,7 +2,7 @@ import unittest
|
|||
|
||||
import util.store
|
||||
|
||||
class config(unittest.TestCase):
|
||||
class store(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.store = util.store.Store()
|
||||
|
||||
|
@ -12,9 +12,6 @@ class config(unittest.TestCase):
|
|||
self.someValue = "someRandomValue"
|
||||
self.someOtherValue = "anotherRandomValue"
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_get_of_unset_key(self):
|
||||
self.assertEqual(None, self.store.get(self.unusedKey), 'default value expected to be None')
|
||||
self.assertEqual(self.someValue, self.store.get(self.unusedKey, self.someValue), 'wrong user-provided default value returned')
|
||||
|
|
|
@ -8,6 +8,7 @@ this module
|
|||
class Store(object):
|
||||
"""Interface for storing and retrieving simple values"""
|
||||
def __init__(self):
|
||||
super(Store, self).__init__()
|
||||
self._data = {}
|
||||
|
||||
def set(self, key, value):
|
||||
|
|
Loading…
Reference in a new issue