diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-06-12 19:15:45 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-06-12 19:15:45 +0000 |
commit | 94fcfd07929b38218e1abb3bd81ae2db76edf013 (patch) | |
tree | 9f59516d89db7547c1ecfd6ef741e248872743c1 /src/message.py | |
parent | 5e7bb342e66e88480effbbb90ad6c2f185f9c589 (diff) | |
download | poezio-94fcfd07929b38218e1abb3bd81ae2db76edf013.tar.gz poezio-94fcfd07929b38218e1abb3bd81ae2db76edf013.tar.bz2 poezio-94fcfd07929b38218e1abb3bd81ae2db76edf013.tar.xz poezio-94fcfd07929b38218e1abb3bd81ae2db76edf013.zip |
area text now handle correctly all the \n and other long messages
Diffstat (limited to 'src/message.py')
-rw-r--r-- | src/message.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/message.py b/src/message.py index 7bbb1893..efa934b4 100644 --- a/src/message.py +++ b/src/message.py @@ -41,3 +41,40 @@ class Message(object): def __str__(self): return self.__repr__() +class Line(object): + """ + A line, corresponding to ONE row of the text area. + A message is composed of ONE line or more. + Example: + + Text area limit text area limit + v v + |[12:12:01] nickone has just joined the room named | + | test@kikoo.louiz.org | + |[12:12:23] nickone> hello good morning everyone, I am| + | seeking for informations about | + | poezio | + |[12:12:35] secondnick> Hello nickone, you can get | + | informations here :\n | + | http://blablablabla | + + To get this result, the three messages should be converted to: + + Line(None, None, Datetime(12, 12, 01), "nickone has just joined the room named", 0, 10) + Line(None, None, None, "test@kikoo.louiz.org", 0, 10) + Line("nickone", 1, Datetime(12, 12, 23), "hello good morning everyone, I am", 0, 20) + Line(None, None, None, "seeking for informations about", 0, 20) + Line(None, None, None, "poezio", 0, 20) + Line("secondnick", 2, Datetime(12, 12, 35), "Hello nickone, you can get", 0, 23) + 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): + from common import debug + # debug("Line: %s, %s, %s '%s', %s, %s\n" % (nickname, nickname_color, str(time), text, text_color, text_offset)) + self.nickname = nickname + self.nickname_color = nickname_color + self.time = time + self.text = text + self.text_color = text_color + self.text_offset = text_offset |