summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-09 05:27:10 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-03-09 05:27:10 +0100
commit769b6ec33b6bacc24f825c40a66d6327af383ae9 (patch)
tree44ccb15c221e797eff80f78224981f440a962e56 /src/windows.py
parenta516e78bcf76f07545310332290b6c5443d437a7 (diff)
downloadpoezio-769b6ec33b6bacc24f825c40a66d6327af383ae9.tar.gz
poezio-769b6ec33b6bacc24f825c40a66d6327af383ae9.tar.bz2
poezio-769b6ec33b6bacc24f825c40a66d6327af383ae9.tar.xz
poezio-769b6ec33b6bacc24f825c40a66d6327af383ae9.zip
little fixes and (very little) optimization
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/windows.py b/src/windows.py
index 316dd6d5..3e073f9e 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -569,12 +569,10 @@ class TextWin(Win):
if line is None:
self.write_line_separator()
else:
- if line.get('time'):
- self.write_time(line.get('time'))
- if line.get('nickname'):
- self.write_nickname(line.get('nickname'), line.get('nickname_color'))
+ self.write_time(line.get('time'))
+ self.write_nickname(line.get('nickname'), line.get('nickname_color'))
self.write_text(y, line.get('text_offset'), line.get('text'), line.get('text_color'), line.get('colorized'))
- if y != self.height-1 or (not line or line.get('text_offset')+wcwidth.wcswidth(line.get('text')) < self.width):
+ if y != self.height-1:
self.addstr('\n')
self._refresh()
@@ -585,7 +583,6 @@ class TextWin(Win):
"""
write the text of a line.
"""
- txt = txt
if not colorized:
if color:
self._win.attron(common.curses_color_pair(color))
@@ -627,6 +624,8 @@ class TextWin(Win):
Write the nickname, using the user's color
and return the number of written characters
"""
+ if not nickname:
+ return
if color:
self._win.attron(common.curses_color_pair(color))
self.addstr(nickname)
@@ -638,8 +637,9 @@ class TextWin(Win):
"""
Write the date on the yth line of the window
"""
- self.addstr(time)
- self.addstr(' ')
+ if time:
+ self.addstr(time)
+ self.addstr(' ')
def resize(self, height, width, y, x, room=None):
self._resize(height, width, y, x)