parent
4baf63f88c
commit
fa30b9505b
4 changed files with 10 additions and 2 deletions
|
@ -19,6 +19,7 @@ class Widget(object):
|
||||||
self.module = module.name
|
self.module = module.name
|
||||||
|
|
||||||
def state(self):
|
def state(self):
|
||||||
|
"""Return the widget's state"""
|
||||||
return "state-default"
|
return "state-default"
|
||||||
|
|
||||||
def full_text(self):
|
def full_text(self):
|
||||||
|
|
|
@ -17,6 +17,9 @@ class Theme(object):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self._init(self.load(name))
|
self._init(self.load(name))
|
||||||
self._widget = None
|
self._widget = None
|
||||||
|
self._cycle_idx = 0
|
||||||
|
self._cycle = {}
|
||||||
|
self._prevbg = None
|
||||||
|
|
||||||
def _init(self, data):
|
def _init(self, data):
|
||||||
"""Initialize theme from data structure"""
|
"""Initialize theme from data structure"""
|
||||||
|
@ -67,9 +70,11 @@ class Theme(object):
|
||||||
return self._get(widget, "separator", None)
|
return self._get(widget, "separator", None)
|
||||||
|
|
||||||
def separator_fg(self, widget):
|
def separator_fg(self, widget):
|
||||||
|
"""Return the separator's foreground/text color"""
|
||||||
return self.bg(widget)
|
return self.bg(widget)
|
||||||
|
|
||||||
def separator_bg(self, widget):
|
def separator_bg(self, widget):
|
||||||
|
"""Return the separator's background color"""
|
||||||
return self._prevbg
|
return self._prevbg
|
||||||
|
|
||||||
def separator_block_width(self, widget):
|
def separator_block_width(self, widget):
|
||||||
|
|
|
@ -82,11 +82,12 @@ class TestTheme(unittest.TestCase):
|
||||||
theme = self.theme
|
theme = self.theme
|
||||||
data = theme.data()
|
data = theme.data()
|
||||||
|
|
||||||
self.assertEquals(theme.separator_block_width(self.anyWidget), data["defaults"]["separator-block-width"])
|
self.assertEquals(theme.separator_block_width(self.anyWidget),
|
||||||
|
data["defaults"]["separator-block-width"]
|
||||||
|
)
|
||||||
|
|
||||||
def test_separator(self):
|
def test_separator(self):
|
||||||
for theme in [self.theme, self.cycleTheme]:
|
for theme in [self.theme, self.cycleTheme]:
|
||||||
data = theme.data()
|
|
||||||
theme.reset()
|
theme.reset()
|
||||||
prev_bg = theme.bg(self.anyWidget)
|
prev_bg = theme.bg(self.anyWidget)
|
||||||
theme.bg(self.anotherWidget)
|
theme.bg(self.anotherWidget)
|
||||||
|
|
|
@ -30,6 +30,7 @@ class MockOutput(object):
|
||||||
|
|
||||||
class MockWidget(Widget):
|
class MockWidget(Widget):
|
||||||
def __init__(self, text):
|
def __init__(self, text):
|
||||||
|
super(MockWidget, self).__init__(text)
|
||||||
self._text = text
|
self._text = text
|
||||||
self.module = None
|
self.module = None
|
||||||
self.attr_state = "state-default"
|
self.attr_state = "state-default"
|
||||||
|
|
Loading…
Reference in a new issue