summaryrefslogtreecommitdiff
path: root/src/message.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-22 16:33:57 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-22 16:33:57 +0000
commit893cd3808b3f3d54786c91ada73c566d152f5aa8 (patch)
treec77dda63e57cb46533793a4254dc61cdecf8d9cf /src/message.py
parent3d278f781650aacd644a0b7ea8961dc43b223f3a (diff)
downloadpoezio-893cd3808b3f3d54786c91ada73c566d152f5aa8.tar.gz
poezio-893cd3808b3f3d54786c91ada73c566d152f5aa8.tar.bz2
poezio-893cd3808b3f3d54786c91ada73c566d152f5aa8.tar.xz
poezio-893cd3808b3f3d54786c91ada73c566d152f5aa8.zip
Mor colored information message, also finish the theme 'engine'. fixed #1537
Diffstat (limited to 'src/message.py')
-rw-r--r--src/message.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/message.py b/src/message.py
index c5d3d47e..078bc8fd 100644
--- a/src/message.py
+++ b/src/message.py
@@ -21,21 +21,25 @@ from datetime import datetime
class Message(object):
"""
A message with all the associated data (nickname, time, color, etc)
+ The color can be a single number OR a list of numbers, for
+ specials cases like join or quit messages.
"""
- def __init__(self, txt, time=None, nickname=None, user=None, color=None):
+ def __init__(self, txt, time=None, nickname=None, user=None, color=None, colorized=False):
"""
time is a datetime object, None means 'now'.
If no nickname is specified, it's an information.
user is an User object (used for the color, etc)
+
"""
self.txt = txt
self.nickname = nickname
self.time = time
self.user = user
self.color = color
+ self.colorized = colorized
def __repr__(self):
- return "<Message txt=%s, nickname=%s, time=%s, user=%s>" % (self.txt, self.nickname, str(self.time), str(self.user))
+ return "<Message txt=%s, nickname=%s, time=%s, user=%s, colorized=%s>" % (self.txt, self.nickname, str(self.time), str(self.user), self.colorized)
def __str__(self):
return self.__repr__()
@@ -43,6 +47,8 @@ class Line(object):
"""
A line, corresponding to ONE row of the text area.
A message is composed of ONE line or MORE.
+ The same particularity for colors in Message class applies
+ here too.
Example:
Text area limit text area limit
@@ -67,10 +73,11 @@ class Line(object):
Line(None, None, None, "informations here:", 0, 23)
Line(None, None, None, "http://blablablabla", 0, 23)
"""
- def __init__(self, nickname, nickname_color, time, text, text_color, text_offset):
+ def __init__(self, nickname, nickname_color, time, text, text_color, text_offset, colorized=False):
self.nickname = nickname
self.nickname_color = nickname_color
self.time = time
self.text = text
self.text_color = text_color
self.text_offset = text_offset
+ self.colorized = colorized