diff browser_side/panels.py @ 294:a6b3715f0bd6

browser_side: bug fixes for switching between unibox and rich text editor: - handle non selectable widget in UniBox._getTarget - reset the selection when selected LiberviaWidget is closed
author souliane <souliane@mailoo.org>
date Mon, 16 Dec 2013 16:39:03 +0100
parents 7c79d4d66161
children 6e36b44cbd34
line wrap: on
line diff
--- a/browser_side/panels.py	Sun Dec 15 12:01:25 2013 +0100
+++ b/browser_side/panels.py	Mon Dec 16 16:39:03 2013 +0100
@@ -187,7 +187,7 @@
         target = self._selected_cache
 
         def getSelectedOrStatus():
-            if target:
+            if target and target.isSelectable():
                 _type, msg = target.getWarningData()
                 target_hook = None  # we use the selected widget, not a hook
             else:
@@ -284,6 +284,8 @@
                 Window.alert("Sole the first group of the selected panel is taken in consideration: '%s'" % groups[0])
         elif isinstance(self._selected_cache, ChatPanel):
             target = self._selected_cache.target
+        else:
+            target = None
         return (_txt, target)
 
     def __onComposing(self):
@@ -300,6 +302,11 @@
     def onSelectedChange(self, selected):
         self._selected_cache = selected
 
+    def onWidgetClosed(self, lib_wid):
+        """Called when a libervia widget is closed"""
+        if self._selected_cache == lib_wid:
+            self.onSelectedChange(None)
+
     """def complete(self):
 
         #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done