summaryrefslogtreecommitdiff
path: root/src/windows
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-04-13 17:32:35 +0200
committermathieui <mathieui@mathieui.net>2015-04-13 17:35:40 +0200
commit91fde24388c97d5f74b1b68d5ada7f69725ab964 (patch)
tree340a64563b9ce98f26d26e817200da325e2f146f /src/windows
parent1c9257b4a28e88c7f575e70939367fc9175ad53c (diff)
downloadpoezio-91fde24388c97d5f74b1b68d5ada7f69725ab964.tar.gz
poezio-91fde24388c97d5f74b1b68d5ada7f69725ab964.tar.bz2
poezio-91fde24388c97d5f74b1b68d5ada7f69725ab964.tar.xz
poezio-91fde24388c97d5f74b1b68d5ada7f69725ab964.zip
Display error messages inside a conversation
if the error has the same id as a sent message, it will be displayed with a cross where there is usually a checkmark (ack), and the received error will be appended to the message, in red. if it does not have a know id, it will be added as another message to the conversation, without a nick, and in red.
Diffstat (limited to 'src/windows')
-rw-r--r--src/windows/text_win.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/windows/text_win.py b/src/windows/text_win.py
index 380142bb..bdda721c 100644
--- a/src/windows/text_win.py
+++ b/src/windows/text_win.py
@@ -307,7 +307,10 @@ class TextWin(BaseTextWin):
nick = truncate_nick(message.nickname)
offset = 0
if message.ack:
- offset += poopt.wcswidth(get_theme().CHAR_ACK_RECEIVED) + 1
+ if message.ack > 0:
+ offset += poopt.wcswidth(get_theme().CHAR_ACK_RECEIVED) + 1
+ else:
+ offset += poopt.wcswidth(get_theme().CHAR_NACK) + 1
if nick:
offset += poopt.wcswidth(nick) + 2 # + nick + '> ' length
if message.revisions > 0:
@@ -361,7 +364,10 @@ class TextWin(BaseTextWin):
if with_timestamps:
self.write_time(msg.str_time)
if msg.ack:
- self.write_ack()
+ if msg.ack > 0:
+ self.write_ack()
+ else:
+ self.write_nack()
if msg.me:
self._win.attron(to_curses_attr(get_theme().COLOR_ME_MESSAGE))
self.addstr('* ')
@@ -404,8 +410,11 @@ class TextWin(BaseTextWin):
offset += ceil(log10(line.msg.revisions + 1))
if line.msg.ack:
- offset += 1 + poopt.wcswidth(
- get_theme().CHAR_ACK_RECEIVED)
+ if msg.ack > 0:
+ offset += 1 + poopt.wcswidth(
+ get_theme().CHAR_ACK_RECEIVED)
+ else:
+ offset += 1 + poopt.wcswidth(get_theme().CHAR_NACK)
self.write_text(y, offset,
line.prepend+line.msg.txt[line.start_pos:line.end_pos])
@@ -428,6 +437,13 @@ class TextWin(BaseTextWin):
self._win.attroff(to_curses_attr(color))
self.addstr(' ')
+ def write_nack(self):
+ color = get_theme().COLOR_CHAR_NACK
+ self._win.attron(to_curses_attr(color))
+ self.addstr(get_theme().CHAR_NACK)
+ self._win.attroff(to_curses_attr(color))
+ self.addstr(' ')
+
def write_nickname(self, nickname, color, highlight=False):
"""
Write the nickname, using the user's color