diff frontends/primitivus/chat.py @ 120:1ca5f254ce41

primitivus group chat & misc primitivus: new widget: SurroundedText (text with a character repeated around it) primitivus: new decorator LabelLine (like lineBox, but with a label on the top line) wix & primitivus & quick_app: group chat method move to quick_chat wix: when new message, window is not raised anymore, but RequestUserAttention is called instead
author Goffi <goffi@goffi.org>
date Thu, 08 Jul 2010 14:12:18 +0800
parents ded2431cea5a
children 961e0898271f
line wrap: on
line diff
--- a/frontends/primitivus/chat.py	Mon Jul 05 19:13:36 2010 +0800
+++ b/frontends/primitivus/chat.py	Thu Jul 08 14:12:18 2010 +0800
@@ -22,7 +22,7 @@
 import urwid
 from quick_frontend.quick_contact_list import QuickContactList
 from quick_frontend.quick_chat import QuickChat
-from custom_widgets import Password,List,InputDialog,ConfirmDialog,Alert,SelectableText
+from custom_widgets import Password,List,InputDialog,ConfirmDialog,Alert,SelectableText,LabelLine,SurroundedText
 
 
 class Chat(urwid.WidgetWrap, QuickChat):
@@ -31,8 +31,8 @@
         QuickChat.__init__(self, target, host, type)
         self.content = urwid.SimpleListWalker([])
         self.text_list = urwid.ListBox(self.content)
-        main_widget = urwid.LineBox(
-                      urwid.Frame(self.text_list, urwid.AttrMap(urwid.Text(str(target),'center'),'title'))
+        main_widget = LabelLine(
+                      urwid.Frame(self.text_list), SurroundedText(str(target))
                       )
         urwid.WidgetWrap.__init__(self, main_widget)
         self.setType(type)
@@ -41,6 +41,12 @@
         QuickChat.setType(self, type)
         if type == 'one2one':
             self.historyPrint(profile=self.host.profile)
+    
+    def setSubject(self, subject):
+        """Set title for a group chat"""
+        QuickChat.setSubject(self, subject)
+        self._w.base_widget.header = urwid.AttrMap(urwid.Text(unicode(subject),align='center'),'title')
+
 
     def printMessage(self, from_jid, msg, profile, timestamp=""):
         self.content.append(SelectableText("[%s] " % from_jid + msg))