summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-07-26 00:09:23 +0200
committermathieui <mathieui@mathieui.net>2012-07-26 00:09:23 +0200
commit2767da0b78512f9070506ead32bd3fe4a16b2450 (patch)
tree128dee2fd59aad8da74c6c4e1b89e71b934dd396 /src
parentb7b7d6b3aadde8cf769fec948f5598f66998e100 (diff)
downloadpoezio-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')
-rw-r--r--src/config.py8
-rw-r--r--src/core.py17
-rw-r--r--src/tabs.py8
3 files changed, 16 insertions, 17 deletions
diff --git a/src/config.py b/src/config.py
index 6695c074..742bd947 100644
--- a/src/config.py
+++ b/src/config.py
@@ -127,7 +127,7 @@ class Config(RawConfigParser):
for line in lines_before:
if line.startswith('['): # check the section
if we_are_in_the_right_section and not written:
- result_lines.append('%s= %s' % (option, value))
+ result_lines.append('%s = %s' % (option, value))
written = True
if line == '[%s]' % section:
we_are_in_the_right_section = True
@@ -137,15 +137,15 @@ class Config(RawConfigParser):
if (line.startswith('%s ' % (option,)) or
line.startswith('%s=' % (option,)) or
line.startswith('%s = ' % (option,))) and we_are_in_the_right_section:
- line = '%s= %s' % (option, value)
+ line = '%s = %s' % (option, value)
written = True
result_lines.append(line)
if not section_found:
result_lines.append('[%s]' % section)
- result_lines.append('%s= %s' % (option, value))
+ result_lines.append('%s = %s' % (option, value))
elif not written:
- result_lines.append('%s= %s' % (option, value))
+ result_lines.append('%s = %s' % (option, value))
df = open(self.file_name, 'w')
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], '')
diff --git a/src/tabs.py b/src/tabs.py
index f697d888..7eed1790 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -352,14 +352,6 @@ class Tab(object):
"""
pass
- def just_before_refresh(self):
- """
- Method called just before the screen refresh.
- Particularly useful to move the cursor at the
- correct position.
- """
- pass
-
def on_close(self):
"""
Called when the tab is to be closed