diff frontends/wix/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 4020931569b8
children 29998cd0ed8d
line wrap: on
line diff
--- a/frontends/wix/chat.py	Mon Jul 05 19:13:36 2010 +0800
+++ b/frontends/wix/chat.py	Thu Jul 08 14:12:18 2010 +0800
@@ -128,10 +128,7 @@
         """Set the users presents in the contact list for a group chat
         @param nicks: list of nicknames
         """
-        debug (_("Adding users %s to room") % nicks)
-        if self.type != "group":
-            error (_("[INTERNAL] trying to set presents nicks for a non group chat window"))
-            return
+        QuickChat.setPresents(self, nicks)
         for nick in nicks:
             self.present_panel.presents.replace(nick)
             self.occupants.add(nick)
@@ -143,27 +140,19 @@
         if self.type != "group":
             error (_("[INTERNAL] trying to replace user for a non group chat window"))
             return
-        self.present_panel.presents.replace(nick)
-        self.occupants.add(nick)
-      
+        QuickChat.replaceUser(self, nick)
+
     def removeUser(self, nick):
         """Remove a user from the group list"""
-        debug(_("Removing user %s") % nick)
-        if self.type != "group":
-            error (_("[INTERNAL] trying to remove user for a non group chat window"))
-            return
+        QuickChat.removeUser(self, nick)
         self.present_panel.presents.remove(nick)
         self.occupants.remove(nick)
 
     def setSubject(self, subject):
         """Set title for a group chat"""
-        debug(_("Setting subject to %s") % subject)
-        if self.type != "group":
-            error (_("[INTERNAL] trying to set subject for a non group chat window"))
-            return
+        QuickChat.setSubject(self, subject)
         self.subjectBox.SetValue(subject)
 
-
     def __eraseMenus(self):
         """erase all menus"""
         menuBar = self.GetMenuBar()
@@ -228,7 +217,10 @@
         self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font))
         self.chatWindow.AppendText("%s\n" % msg)
         if not mymess:
-            self.Raise()  #FIXME: too intrusive
+            #TODO: use notification system
+            self.RequestUserAttention() #FIXME: do this only if in background.
+            self.Show() #gof: FIXME: to check
+            #self.Raise()  #FIXME: too intrusive
 
     ### events ###