comparison 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
comparison
equal deleted inserted replaced
119:ded2431cea5a 120:1ca5f254ce41
126 126
127 def setPresents(self, nicks): 127 def setPresents(self, nicks):
128 """Set the users presents in the contact list for a group chat 128 """Set the users presents in the contact list for a group chat
129 @param nicks: list of nicknames 129 @param nicks: list of nicknames
130 """ 130 """
131 debug (_("Adding users %s to room") % nicks) 131 QuickChat.setPresents(self, nicks)
132 if self.type != "group":
133 error (_("[INTERNAL] trying to set presents nicks for a non group chat window"))
134 return
135 for nick in nicks: 132 for nick in nicks:
136 self.present_panel.presents.replace(nick) 133 self.present_panel.presents.replace(nick)
137 self.occupants.add(nick) 134 self.occupants.add(nick)
138 135
139 136
141 """Add user if it is not in the group list""" 138 """Add user if it is not in the group list"""
142 debug (_("Replacing user %s") % nick) 139 debug (_("Replacing user %s") % nick)
143 if self.type != "group": 140 if self.type != "group":
144 error (_("[INTERNAL] trying to replace user for a non group chat window")) 141 error (_("[INTERNAL] trying to replace user for a non group chat window"))
145 return 142 return
146 self.present_panel.presents.replace(nick) 143 QuickChat.replaceUser(self, nick)
147 self.occupants.add(nick) 144
148
149 def removeUser(self, nick): 145 def removeUser(self, nick):
150 """Remove a user from the group list""" 146 """Remove a user from the group list"""
151 debug(_("Removing user %s") % nick) 147 QuickChat.removeUser(self, nick)
152 if self.type != "group":
153 error (_("[INTERNAL] trying to remove user for a non group chat window"))
154 return
155 self.present_panel.presents.remove(nick) 148 self.present_panel.presents.remove(nick)
156 self.occupants.remove(nick) 149 self.occupants.remove(nick)
157 150
158 def setSubject(self, subject): 151 def setSubject(self, subject):
159 """Set title for a group chat""" 152 """Set title for a group chat"""
160 debug(_("Setting subject to %s") % subject) 153 QuickChat.setSubject(self, subject)
161 if self.type != "group":
162 error (_("[INTERNAL] trying to set subject for a non group chat window"))
163 return
164 self.subjectBox.SetValue(subject) 154 self.subjectBox.SetValue(subject)
165
166 155
167 def __eraseMenus(self): 156 def __eraseMenus(self):
168 """erase all menus""" 157 """erase all menus"""
169 menuBar = self.GetMenuBar() 158 menuBar = self.GetMenuBar()
170 for i in range(menuBar.GetMenuCount()): 159 for i in range(menuBar.GetMenuCount()):
226 self.chatWindow.AppendText("[%s] " % nick) 215 self.chatWindow.AppendText("[%s] " % nick)
227 _font = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL) 216 _font = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL)
228 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font)) 217 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font))
229 self.chatWindow.AppendText("%s\n" % msg) 218 self.chatWindow.AppendText("%s\n" % msg)
230 if not mymess: 219 if not mymess:
231 self.Raise() #FIXME: too intrusive 220 #TODO: use notification system
221 self.RequestUserAttention() #FIXME: do this only if in background.
222 self.Show() #gof: FIXME: to check
223 #self.Raise() #FIXME: too intrusive
232 224
233 ### events ### 225 ### events ###
234 226
235 def onSendFile(self, e): 227 def onSendFile(self, e):
236 debug(_("Send File")) 228 debug(_("Send File"))