[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 module in self._modules:
|
||||||
for widget in module.widgets():
|
for widget in module.widgets():
|
||||||
status.append({
|
status.append({
|
||||||
'full_text': widget.full_text()
|
'full_text': widget.full_text(),
|
||||||
|
'instance': widget.id(),
|
||||||
|
'name': module.id(),
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
'data': status,
|
'data': status,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
import core.input
|
||||||
import util.store
|
import util.store
|
||||||
|
|
||||||
class Widget(util.store.Store):
|
class Widget(util.store.Store, core.input.Object):
|
||||||
def __init__(self, full_text):
|
def __init__(self, full_text):
|
||||||
|
super(Widget, self).__init__()
|
||||||
self._full_text = full_text
|
self._full_text = full_text
|
||||||
|
|
||||||
def full_text(self, value=None):
|
def full_text(self, value=None):
|
||||||
|
|
|
@ -2,7 +2,7 @@ import unittest
|
||||||
|
|
||||||
import util.store
|
import util.store
|
||||||
|
|
||||||
class config(unittest.TestCase):
|
class store(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.store = util.store.Store()
|
self.store = util.store.Store()
|
||||||
|
|
||||||
|
@ -12,9 +12,6 @@ class config(unittest.TestCase):
|
||||||
self.someValue = "someRandomValue"
|
self.someValue = "someRandomValue"
|
||||||
self.someOtherValue = "anotherRandomValue"
|
self.someOtherValue = "anotherRandomValue"
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_get_of_unset_key(self):
|
def test_get_of_unset_key(self):
|
||||||
self.assertEqual(None, self.store.get(self.unusedKey), 'default value expected to be None')
|
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')
|
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):
|
class Store(object):
|
||||||
"""Interface for storing and retrieving simple values"""
|
"""Interface for storing and retrieving simple values"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
super(Store, self).__init__()
|
||||||
self._data = {}
|
self._data = {}
|
||||||
|
|
||||||
def set(self, key, value):
|
def set(self, key, value):
|
||||||
|
|
Loading…
Reference in a new issue