comparison frontends/src/primitivus/chat.py @ 430:7c7ec2347b56

primitivus: chat window is not scrolled anymore when user is watching history and a new message is received
author Goffi <goffi@goffi.org>
date Fri, 11 Nov 2011 19:50:24 +0100
parents e66d300c5d42
children cf005701624b
comparison
equal deleted inserted replaced
429:37285f2d37c8 430:7c7ec2347b56
227 jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp) 227 jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp)
228 except TypeError: 228 except TypeError:
229 return 229 return
230 my_jid = self.host.profiles[profile]['whoami'] 230 my_jid = self.host.profiles[profile]['whoami']
231 self.content.append(ChatText(self, timestamp or None, nick, mymess, msg)) 231 self.content.append(ChatText(self, timestamp or None, nick, mymess, msg))
232 self.text_list.set_focus(len(self.content)-1) 232 if self.text_list.get_focus()[1] == len(self.content)-2:
233 #we don't change focus if user is not at the bottom
234 #as that mean that he is probably watching discussion history
235 self.text_list.set_focus(len(self.content)-1)
233 self.host.redraw() 236 self.host.redraw()
234 if not self.host.notify.hasFocus(): 237 if not self.host.notify.hasFocus():
235 if self.type=="one2one": 238 if self.type=="one2one":
236 self.host.notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid) 239 self.host.notify.sendNotification(_("Primitivus: %s is talking to you") % from_jid)
237 elif self.getUserNick().lower() in msg.lower(): 240 elif self.getUserNick().lower() in msg.lower():
243 @type: one of: 246 @type: one of:
244 normal: general info like "toto has joined the room" 247 normal: general info like "toto has joined the room"
245 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" 248 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
246 """ 249 """
247 self.content.append(sat_widgets.ClickableText(msg)) 250 self.content.append(sat_widgets.ClickableText(msg))
248 self.text_list.set_focus(len(self.content)-1) 251 if self.text_list.get_focus()[1] == len(self.content)-2:
252 #we don't change focus if user is not at the bottom
253 #as that mean that he is probably watching discussion history
254 self.text_list.set_focus(len(self.content)-1)
249 self.host.redraw() 255 self.host.redraw()
250 if not self.host.notify.hasFocus(): 256 if not self.host.notify.hasFocus():
251 if self.type=="one2one": 257 if self.type=="one2one":
252 self.host.notify.sendNotification(_("Primitivus: there is a message about you")) 258 self.host.notify.sendNotification(_("Primitivus: there is a message about you"))
253 elif self.getUserNick().lower() in msg.lower(): 259 elif self.getUserNick().lower() in msg.lower():