diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-11-11 03:39:39 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-11-11 03:39:39 +0000 |
commit | 58a82f170b01994be304283b2b195ea010b561e6 (patch) | |
tree | 97b3e00431ab1617c24607023f5f7634f2c7e44c /src/tab.py | |
parent | f729e79aade7a1c1e2978dcf3822647351d58204 (diff) | |
download | poezio-58a82f170b01994be304283b2b195ea010b561e6.tar.gz poezio-58a82f170b01994be304283b2b195ea010b561e6.tar.bz2 poezio-58a82f170b01994be304283b2b195ea010b561e6.tar.xz poezio-58a82f170b01994be304283b2b195ea010b561e6.zip |
fix some issues with recent-words completion, make the ConversationTabs closable with /unquery and ignore the keyboard shortcuts not handled. fixed #1941
Diffstat (limited to 'src/tab.py')
-rw-r--r-- | src/tab.py | 37 |
1 files changed, 28 insertions, 9 deletions
@@ -25,6 +25,9 @@ Window are displayed, etc MIN_WIDTH = 50 MIN_HEIGHT = 16 +import logging +log = logging.getLogger(__name__) + import window import theme import curses @@ -126,6 +129,12 @@ class Tab(object): """ raise NotImplementedError + def on_close(self): + """ + Called when the tab is to be closed + """ + raise NotImplementedError + class InfoTab(Tab): """ The information tab, used to display global informations @@ -181,6 +190,9 @@ class InfoTab(Tab): def just_before_refresh(self): return + def on_close(self): + return + class MucTab(Tab): """ The tab containing a multi-user-chat room. @@ -251,31 +263,26 @@ class MucTab(Tab): Complete the input with words recently said """ # build the list of the recent words - char_we_dont_want = [',', '(', ')', '.'] + char_we_dont_want = [',', '(', ')', '.', '"', '\'', ' '] # The last one is nbsp words = list() for msg in self._room.messages[:-40:-1]: if not msg: continue + log.debug('line: %s\n'%msg) for char in char_we_dont_want: - msg.txt.replace(char, ' ') + msg.txt = msg.txt.replace(char, ' ') for word in msg.txt.split(): - if len(word) > 5: + if len(word) >= 5 and word not in words: words.append(word) self.input.auto_completion(words, False) def get_color_state(self): - """ - """ return self._room.color_state def set_color_state(self, color): - """ - """ self._room.set_color_state(color) def get_name(self): - """ - """ return self._room.name def get_room(self): @@ -305,6 +312,9 @@ class MucTab(Tab): def just_before_refresh(self): self.input.move_cursor_to_pos() + def on_close(self): + return + class PrivateTab(Tab): """ The tab containg a private conversation (someone from a MUC) @@ -374,6 +384,9 @@ class PrivateTab(Tab): def just_before_refresh(self): return + def on_close(self): + return + class RosterInfoTab(Tab): """ A tab, splitted in two, containing the roster and infos @@ -523,6 +536,9 @@ class RosterInfoTab(Tab): def just_before_refresh(self): return + def on_close(self): + return + class ConversationTab(Tab): """ The tab containg a normal conversation (someone from our roster) @@ -597,6 +613,9 @@ class ConversationTab(Tab): def just_before_refresh(self): return + def on_close(self): + return + def jid_and_name_match(contact, txt): """ A function used to know if a contact in the roster should |