diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-02-13 22:26:23 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-02-13 22:26:23 +0100 |
commit | 8d0ebdfc123890048f7d282077c4e3ab0b845bba (patch) | |
tree | 6aac9e94c46d256a6ebda11024868fadaccc430e | |
parent | 1a058c3579fe31e82f5370ff6fee629375dbbb2b (diff) | |
parent | ac99467965ba04282b6dbc63c5c04ab91ba1b007 (diff) | |
download | poezio-8d0ebdfc123890048f7d282077c4e3ab0b845bba.tar.gz poezio-8d0ebdfc123890048f7d282077c4e3ab0b845bba.tar.bz2 poezio-8d0ebdfc123890048f7d282077c4e3ab0b845bba.tar.xz poezio-8d0ebdfc123890048f7d282077c4e3ab0b845bba.zip |
Automated merge with http://hg.louiz.org/poezio
-rw-r--r-- | src/core.py | 12 | ||||
-rw-r--r-- | src/room.py | 1 | ||||
-rw-r--r-- | src/tabs.py | 3 | ||||
-rw-r--r-- | src/text_buffer.py | 7 | ||||
-rw-r--r-- | src/windows.py | 4 |
5 files changed, 23 insertions, 4 deletions
diff --git a/src/core.py b/src/core.py index ae3bc55b..98d2a7fa 100644 --- a/src/core.py +++ b/src/core.py @@ -115,7 +115,7 @@ class Core(object): # The completion function should return True if a completion was # made ; False otherwise self.commands = { - 'help': (self.command_help, '\_o< KOIN KOIN KOIN', None), + 'help': (self.command_help, '\_o< KOIN KOIN KOIN', self.completion_help), 'join': (self.command_join, _("Usage: /join [room_name][@server][/nick] [password]\nJoin: Join the specified room. You can specify a nickname after a slash (/). If no nickname is specified, you will use the default_nick in the configuration file. You can omit the room name: you will then join the room you\'re looking at (useful if you were kicked). You can also provide a room_name without specifying a server, the server of the room you're currently in will be used. You can also provide a password to join the room.\nExamples:\n/join room@server.tld\n/join room@server.tld/John\n/join room2\n/join /me_again\n/join\n/join room@server.tld/my_nick password\n/join / password"), self.completion_join), 'exit': (self.command_quit, _("Usage: /exit\nExit: Just disconnect from the server and exit poezio."), None), 'next': (self.rotate_rooms_right, _("Usage: /next\nNext: Go to the next room."), None), @@ -999,10 +999,16 @@ class Core(object): if len(args) >= 1: if args[0] in list(self.commands.keys()): msg = self.commands[args[0]][1] + elif args[0] in list(self.current_tab().commands.keys()): + msg = self.current_tab().commands[args[0]][1] else: msg = _('Unknown command: %s') % args[0] self.information(msg) + def completion_help(self, the_input): + commands = list(self.commands.keys()) + list(self.current_tab().commands.keys()) + return the_input.auto_completion(commands, ' ') + def command_status(self, arg): args = arg.split() if len(args) < 1: @@ -1128,7 +1134,7 @@ class Core(object): for tab in self.tabs: # TODO, also from an history if isinstance(tab, tabs.MucTab) and\ tab.get_name() not in muc_serv_list: - muc_serv_list.append(tab.get_name()) + muc_serv_list.append(JID(tab.get_name()).server) if muc_serv_list: return the_input.auto_completion(muc_serv_list, ' ') @@ -1297,6 +1303,8 @@ class Core(object): tab.on_close() self.tabs.remove(tab) self.rotate_rooms_left() + del tab.key_func # Remove self references + del tab.commands # and make the object collectable del tab def move_separator(self): diff --git a/src/room.py b/src/room.py index 9bb9f721..29986142 100644 --- a/src/room.py +++ b/src/room.py @@ -123,4 +123,3 @@ class Room(TextBuffer): nb = window.build_new_message(message) if window.pos != 0: window.scroll_up(nb) - diff --git a/src/tabs.py b/src/tabs.py index ecb53ab9..3c91fc14 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -210,6 +210,9 @@ class Tab(object): """ pass + def __del__(self): + log.debug('Closing tab %s' % self.__class__.__name__) + class ChatTab(Tab): """ A tab containing a chat of any type. diff --git a/src/text_buffer.py b/src/text_buffer.py index 828b344c..9285a433 100644 --- a/src/text_buffer.py +++ b/src/text_buffer.py @@ -36,7 +36,7 @@ class TextBuffer(object): self.messages = [] # Message objects self.windows = [] # we keep track of one or more windows # so we can pass the new messages to them, as they are added, so - # they (the windows) can built the lines from the new message + # they (the windows) can build the lines from the new message def add_window(self, win): self.windows.append(win) @@ -55,3 +55,8 @@ class TextBuffer(object): if window.pos != 0: window.scroll_up(nb) + def del_window(self, win): + self.windows.remove(win) + + def __del__(self): + log.debug('** Deleting %s messages from textbuffer' % (len(self.messages))) diff --git a/src/windows.py b/src/windows.py index 3f23341c..68e4de62 100644 --- a/src/windows.py +++ b/src/windows.py @@ -638,6 +638,10 @@ class TextWin(Win): for message in room.messages: self.build_new_message(message) + def __del__(self): + log.debug('** TextWin: deleting %s built lines' % (len(self.built_lines))) + del self.built_lines + class HelpText(Win): """ A Window just displaying a read-only message. |