changeset 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 37285f2d37c8
children 482b9bcf0ca4
files frontends/src/primitivus/chat.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Fri Nov 11 19:49:21 2011 +0100
+++ b/frontends/src/primitivus/chat.py	Fri Nov 11 19:50:24 2011 +0100
@@ -229,7 +229,10 @@
             return
         my_jid = self.host.profiles[profile]['whoami']
         self.content.append(ChatText(self, timestamp or None, nick, mymess, msg))
-        self.text_list.set_focus(len(self.content)-1)
+        if self.text_list.get_focus()[1] == len(self.content)-2:
+            #we don't change focus if user is not at the bottom
+            #as that mean that he is probably watching discussion history
+            self.text_list.set_focus(len(self.content)-1)
         self.host.redraw()
         if not self.host.notify.hasFocus():
             if self.type=="one2one":
@@ -245,7 +248,10 @@
             me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
         """
         self.content.append(sat_widgets.ClickableText(msg))
-        self.text_list.set_focus(len(self.content)-1)
+        if self.text_list.get_focus()[1] == len(self.content)-2:
+            #we don't change focus if user is not at the bottom
+            #as that mean that he is probably watching discussion history
+            self.text_list.set_focus(len(self.content)-1)
         self.host.redraw()
         if not self.host.notify.hasFocus():
             if self.type=="one2one":