Mercurial > libervia-backend
changeset 130:5a88ad24ccc0
Primitivus: subject in group chat can now be shown in 3 ways: clip, full, or hidden
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 14 Jul 2010 16:14:48 +0800 |
parents | 542682d67282 |
children | 6cad483a6d84 |
files | frontends/primitivus/chat.py |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/primitivus/chat.py Wed Jul 14 16:14:04 2010 +0800 +++ b/frontends/primitivus/chat.py Wed Jul 14 16:14:48 2010 +0800 @@ -85,7 +85,7 @@ self.day_change = time.strptime(time.strftime("%a %b %d 00:00:00 %Y")) #struct_time of day changing time self.show_timestamp = True self.show_short_nick = False - self.show_title = True + self.show_title = 1 #0: clip title; 1: full title; 2: no title self.subject = None def keypress(self, size, key): @@ -110,10 +110,12 @@ self._invalidate() elif key == "meta s": #user wants to (un)hide group's subject if self.subject: - self.show_title = not self.show_title - if self.show_title: - self.setSubject(self.subject) - else: + self.show_title = (self.show_title + 1) % 3 + if self.show_title == 0: + self.setSubject(self.subject,'clip') + elif self.show_title == 1: + self.setSubject(self.subject,'space') + elif self.show_title == 2: self.chat_widget.header = None self._invalidate() @@ -154,11 +156,14 @@ self.columns.widget_list.remove(self.present_panel) del self.columns.column_types[-1] - def setSubject(self, subject): + def setSubject(self, subject, wrap='space'): """Set title for a group chat""" QuickChat.setSubject(self, subject) self.subject = subject - self.chat_widget.header = urwid.AttrMap(urwid.Text(unicode(subject),align='center'),'title') + self.subj_wid = urwid.Text(unicode(subject.replace('\n','|') if wrap == 'clip' else subject ), + align='left' if wrap=='clip' else 'center',wrap=wrap) + self.chat_widget.header = urwid.AttrMap(self.subj_wid,'title') + self.host.redraw() def setPresents(self, param_nicks): """Set the users presents in the contact list for a group chat