diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-02 21:33:17 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-02 21:33:17 +0200 |
commit | 52e6334c8c95ec873ccbcf17bf42de12eec0475d (patch) | |
tree | d83bccb0ccd319821670f4b00642ee47d995e8fe /src/tabs | |
parent | 65c247399d4b5d8d78953e72cab89b7cf6b890fa (diff) | |
download | poezio-52e6334c8c95ec873ccbcf17bf42de12eec0475d.tar.gz poezio-52e6334c8c95ec873ccbcf17bf42de12eec0475d.tar.bz2 poezio-52e6334c8c95ec873ccbcf17bf42de12eec0475d.tar.xz poezio-52e6334c8c95ec873ccbcf17bf42de12eec0475d.zip |
Fix #2340 (change tab priority when the input is not empty)
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/basetabs.py | 3 | ||||
-rw-r--r-- | src/tabs/conversationtab.py | 5 | ||||
-rw-r--r-- | src/tabs/muctab.py | 5 | ||||
-rw-r--r-- | src/tabs/privatetab.py | 6 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 7b300b18..c58efc26 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -44,6 +44,7 @@ MIN_HEIGHT = 6 STATE_COLORS = { 'disconnected': lambda: get_theme().COLOR_TAB_DISCONNECTED, 'scrolled': lambda: get_theme().COLOR_TAB_SCROLLED, + 'nonempty': lambda: get_theme().COLOR_TAB_NONEMPTY, 'joined': lambda: get_theme().COLOR_TAB_JOINED, 'message': lambda: get_theme().COLOR_TAB_NEW_MESSAGE, 'highlight': lambda: get_theme().COLOR_TAB_HIGHLIGHT, @@ -55,6 +56,7 @@ STATE_COLORS = { VERTICAL_STATE_COLORS = { 'disconnected': lambda: get_theme().COLOR_VERTICAL_TAB_DISCONNECTED, 'scrolled': lambda: get_theme().COLOR_VERTICAL_TAB_SCROLLED, + 'nonempty': lambda: get_theme().COLOR_VERTICAL_TAB_NONEMPTY, 'joined': lambda: get_theme().COLOR_VERTICAL_TAB_JOINED, 'message': lambda: get_theme().COLOR_VERTICAL_TAB_NEW_MESSAGE, 'highlight': lambda: get_theme().COLOR_VERTICAL_TAB_HIGHLIGHT, @@ -71,6 +73,7 @@ STATE_PRIORITY = { 'normal': -1, 'current': -1, 'disconnected': 0, + 'nonempty': 0.1, 'scrolled': 0.5, 'message': 1, 'joined': 1, diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py index 82483046..f999ddcd 100644 --- a/src/tabs/conversationtab.py +++ b/src/tabs/conversationtab.py @@ -315,7 +315,10 @@ class ConversationTab(ChatTab): resource = contact.get_highest_priority_resource() else: resource = None - self.state = 'normal' + if self.input.text: + self.state = 'nonempty' + else: + self.state = 'normal' self.text_win.remove_line_separator() self.text_win.add_line_separator(self._text_buffer) if config.get_by_tabname('send_chat_states', True, self.general_jid, True) and (not self.input.get_text() or not self.input.get_text().startswith('//')): diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index b80903d4..5a271736 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -768,7 +768,10 @@ class MucTab(ChatTab): def on_lose_focus(self): if self.joined: - self.state = 'normal' + if self.input.text: + self.state = 'nonempty' + else: + self.state = 'normal' else: self.state = 'disconnected' self.text_win.remove_line_separator() diff --git a/src/tabs/privatetab.py b/src/tabs/privatetab.py index bafee073..5599ec45 100644 --- a/src/tabs/privatetab.py +++ b/src/tabs/privatetab.py @@ -280,7 +280,11 @@ class PrivateTab(ChatTab): return False def on_lose_focus(self): - self.state = 'normal' + if self.input.text: + self.state = 'nonempty' + else: + self.state = 'normal' + self.text_win.remove_line_separator() self.text_win.add_line_separator(self._text_buffer) tab = self.core.get_tab_by_name(safeJID(self.name).bare, MucTab) |