diff options
author | mathieui <mathieui@mathieui.net> | 2012-07-26 00:09:23 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-07-26 00:09:23 +0200 |
commit | 2767da0b78512f9070506ead32bd3fe4a16b2450 (patch) | |
tree | 128dee2fd59aad8da74c6c4e1b89e71b934dd396 /src/core.py | |
parent | b7b7d6b3aadde8cf769fec948f5598f66998e100 (diff) | |
download | poezio-2767da0b78512f9070506ead32bd3fe4a16b2450.tar.gz poezio-2767da0b78512f9070506ead32bd3fe4a16b2450.tar.bz2 poezio-2767da0b78512f9070506ead32bd3fe4a16b2450.tar.xz poezio-2767da0b78512f9070506ead32bd3fe4a16b2450.zip |
Small non-impacting modifications
- Write the config with “option = value” instead of “option= value”
- Docstring for sighup_handler
- Optimize a join() in the main loop
- Rename the verbose get_error_message_from_error_stanza() with
get_error_message()
- Remove the unused Tab.just_before_refresh() which is litterally used
nowhere in poezio
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core.py b/src/core.py index f4d11a38..9159bfe0 100644 --- a/src/core.py +++ b/src/core.py @@ -286,6 +286,10 @@ class Core(object): self.pending_invites = {} def sighup_handler(self, num, stack): + """ + Handle SIGHUP (1) + When caught, reload all the possible files. + """ log.debug("SIGHUP caught, reloading the files…") # reload all log files log.debug("Reloading the log files…") @@ -1139,7 +1143,10 @@ class Core(object): if res: self.refresh_window() else: - self.do_command(''.join(list(map(replace_line_breaks, list(map(replace_tabulation, char_list))))), True) + self.do_command(''.join(map( + lambda x: replace_line_breaks(replace_tabulation(x)), + char_list) + ), True) self.refresh_window() self.doupdate() @@ -1303,7 +1310,7 @@ class Core(object): self.current_tab().on_half_scroll_down() self.refresh_window() - def get_error_message_from_error_stanza(self, stanza, deprecated=False): + def get_error_message(self, stanza, deprecated=False): """ Takes a stanza of the form <message type='error'><error/></message> and return a well formed string containing the error informations @@ -1335,7 +1342,7 @@ class Core(object): Display the error in the tab """ tab = self.get_tab_by_name(room_name) - error_message = self.get_error_message_from_error_stanza(error) + error_message = self.get_error_message(error) self.add_message_to_text_buffer(tab._text_buffer, error_message) code = error['error']['code'] if code == '401': @@ -1829,7 +1836,7 @@ class Core(object): else: return True items = ['%s/%s' % (tup[0], jid.resource) for tup in items] - for i in range(len(jid.server) + 2 + len(jid.resource)): + for _ in range(len(jid.server) + 2 + len(jid.resource)): the_input.key_backspace() else: items = [] @@ -2166,7 +2173,7 @@ class Core(object): else: self.information('No bookmark to remove', 'Info') - def completion_remove_bookmark(self,the_input): + def completion_remove_bookmark(self, the_input): """Completion for /remove_bookmark""" return the_input.auto_completion([bm.jid for bm in bookmark.bookmarks], '') |