diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-05 22:12:03 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-05 22:12:03 +0100 |
commit | 25fb35d7e149c9d2a1ac44c9270b11780a5bfcda (patch) | |
tree | 5aaf111f421b9aff8eb4fa922bbacdd7312630ad /src/tabs.py | |
parent | a49af71f7c18eb7373423ab45cb543f2141d049b (diff) | |
download | poezio-25fb35d7e149c9d2a1ac44c9270b11780a5bfcda.tar.gz poezio-25fb35d7e149c9d2a1ac44c9270b11780a5bfcda.tar.bz2 poezio-25fb35d7e149c9d2a1ac44c9270b11780a5bfcda.tar.xz poezio-25fb35d7e149c9d2a1ac44c9270b11780a5bfcda.zip |
Things related to priority, fixes #2266 (imo)
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tabs.py b/src/tabs.py index 2e4a8901..a27eeb38 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -64,6 +64,17 @@ STATE_COLORS = { 'private': lambda: get_theme().COLOR_TAB_PRIVATE, 'normal': lambda: get_theme().COLOR_TAB_NORMAL, 'current': lambda: get_theme().COLOR_TAB_CURRENT, +# 'attention': lambda: get_theme().COLOR_TAB_ATTENTION, + } + +STATE_PRIORITY = { + 'normal': -1, + 'current': -1, + 'disconnected': 0, + 'message': 1, + 'highlight': 2, + 'private': 2, +# 'attention': 3 } class Tab(object): @@ -71,7 +82,7 @@ class Tab(object): tab_core = None def __init__(self): self.input = None - self.state = 'normal' + self._state = 'normal' self.need_resize = False self.nb = Tab.number Tab.number += 1 @@ -109,6 +120,10 @@ class Tab(object): if not value in STATE_COLORS: log.debug("WARNING: invalid value for tab state") return + elif STATE_PRIORITY[value] < STATE_PRIORITY[self._state] and \ + value != 'current': + log.debug("WARNING: did not set status because of lower priority") + return self._state = value @staticmethod |