changeset 37:6cf08d0ee460

chat: forbid scrolling on X axis + don't delete widget until explicitly requested (with force attribute)
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 15:27:45 +0200
parents bd3ecac18870
children 9f45098289cc
files src/cagou/plugins/plugin_wid_chat.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_chat.py	Sun Aug 28 15:27:42 2016 +0200
+++ b/src/cagou/plugins/plugin_wid_chat.py	Sun Aug 28 15:27:45 2016 +0200
@@ -96,7 +96,7 @@
         quick_chat.QuickChat.__init__(self, host, target, type_, occupants, subject, profiles=profiles)
         cagou_widget.CagouWidget.__init__(self)
         self.header_input.hint_text = u"You are talking with {}".format(target)
-        scroll_view = ScrollView(size_hint=(1,0.8), scroll_y=0)
+        scroll_view = ScrollView(size_hint=(1,0.8), scroll_y=0, do_scroll_x=False)
         self.messages_widget = MessagesWidget()
         scroll_view.add_widget(self.messages_widget)
         self.add_widget(scroll_view)
@@ -165,6 +165,13 @@
 
         G.host.bridge.discoInfos(jid_.domain, self.profile, callback=discoCb, errback=discoEb)
 
+    def onDelete(self, force=False):
+        if force==True:
+            return True
+        if len(list(G.host.widgets.getWidgets(self.__class__, self.target, profiles=self.profiles))) > 1:
+            # we don't keep duplicate widgets
+            return True
+        return False
 
 
 PLUGIN_INFO["factory"] = Chat.factory