diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-05 22:12:55 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-05 22:12:55 +0100 |
commit | af6e5345781381fbfab48552684a2c621989a24d (patch) | |
tree | b83b5df44779bdf7f642810fd0f0302175425f2d /src | |
parent | 25fb35d7e149c9d2a1ac44c9270b11780a5bfcda (diff) | |
download | poezio-af6e5345781381fbfab48552684a2c621989a24d.tar.gz poezio-af6e5345781381fbfab48552684a2c621989a24d.tar.bz2 poezio-af6e5345781381fbfab48552684a2c621989a24d.tar.xz poezio-af6e5345781381fbfab48552684a2c621989a24d.zip |
More @property magic, for transparency
Diffstat (limited to 'src')
-rw-r--r-- | src/tabs.py | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/tabs.py b/src/tabs.py index a27eeb38..2297cf86 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -840,18 +840,22 @@ class MucTab(ChatTab): return self._room @property - def color(self): - return STATE_COLORS[self._room.state]() + def state(self): + return self._room.state + + @state.setter + def state(self, value): + self._room.state = value def on_lose_focus(self): - self._room.state = 'normal' + self.state = 'normal' self.text_win.remove_line_separator() self.text_win.add_line_separator() if config.get('send_chat_states', 'true') == 'true' and not self.input.get_text(): self.send_chat_state('inactive') def on_gain_focus(self): - self._room.state = 'current' + self.state = 'current' if self.text_win.built_lines and self.text_win.built_lines[-1] is None: self.text_win.remove_line_separator() curses.curs_set(1) @@ -1193,11 +1197,12 @@ class PrivateTab(ChatTab): self.input.refresh() @property - def color(self): - if self._room.state == 'normal' or\ - self._room.state == 'current': - return STATE_COLORS[self._room.state]() - return get_theme().COLOR_TAB_PRIVATE + def state(self): + return self._room.state + + @state.setter + def state(self, value): + self._room.state = value def get_name(self): return self._room.name @@ -1216,14 +1221,14 @@ class PrivateTab(ChatTab): return False def on_lose_focus(self): - self._room.state = 'normal' + self.state = 'normal' self.text_win.remove_line_separator() self.text_win.add_line_separator() if self.get_room().joined and config.get('send_chat_states', 'true') == 'true' and not self.input.get_text(): self.send_chat_state('inactive') def on_gain_focus(self): - self._room.state = 'CURRENT' + self.state = 'current' curses.curs_set(1) if self.get_room().joined and config.get('send_chat_states', 'true') == 'true' and not self.input.get_text(): self.send_chat_state('active') @@ -1833,13 +1838,6 @@ class ConversationTab(ChatTab): self.info_header.refresh(self.get_name(), roster.get_contact_by_jid(self.get_name()), self._room, self.text_win, self.chatstate) self.input.refresh() - @property - def color(self): - if self.state == 'normal' or \ - self.state == 'current': - return STATE_COLORS[self.state]() - return get_theme().COLOR_TAB_PRIVATE - def get_name(self): return self._name |