Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
293:7c79d4d66161 | 294:a6b3715f0bd6 |
---|---|
185 - target_type: one of PUBLIC, GROUP, ONE2ONE, STATUS, MISC | 185 - target_type: one of PUBLIC, GROUP, ONE2ONE, STATUS, MISC |
186 - msg: HTML message which will appear in the privacy warning banner """ | 186 - msg: HTML message which will appear in the privacy warning banner """ |
187 target = self._selected_cache | 187 target = self._selected_cache |
188 | 188 |
189 def getSelectedOrStatus(): | 189 def getSelectedOrStatus(): |
190 if target: | 190 if target and target.isSelectable(): |
191 _type, msg = target.getWarningData() | 191 _type, msg = target.getWarningData() |
192 target_hook = None # we use the selected widget, not a hook | 192 target_hook = None # we use the selected widget, not a hook |
193 else: | 193 else: |
194 _type, msg = "STATUS", "This will be your new status message" | 194 _type, msg = "STATUS", "This will be your new status message" |
195 target_hook = (txt, None) | 195 target_hook = (txt, None) |
282 target = "@%s" % (groups[0] if len(groups) > 0 else "@") | 282 target = "@%s" % (groups[0] if len(groups) > 0 else "@") |
283 if len(groups) > 1: | 283 if len(groups) > 1: |
284 Window.alert("Sole the first group of the selected panel is taken in consideration: '%s'" % groups[0]) | 284 Window.alert("Sole the first group of the selected panel is taken in consideration: '%s'" % groups[0]) |
285 elif isinstance(self._selected_cache, ChatPanel): | 285 elif isinstance(self._selected_cache, ChatPanel): |
286 target = self._selected_cache.target | 286 target = self._selected_cache.target |
287 else: | |
288 target = None | |
287 return (_txt, target) | 289 return (_txt, target) |
288 | 290 |
289 def __onComposing(self): | 291 def __onComposing(self): |
290 """Callback when the user is composing a text.""" | 292 """Callback when the user is composing a text.""" |
291 if hasattr(self._selected_cache, "target"): | 293 if hasattr(self._selected_cache, "target"): |
297 self.__size = size | 299 self.__size = size |
298 self.host.resize() | 300 self.host.resize() |
299 | 301 |
300 def onSelectedChange(self, selected): | 302 def onSelectedChange(self, selected): |
301 self._selected_cache = selected | 303 self._selected_cache = selected |
304 | |
305 def onWidgetClosed(self, lib_wid): | |
306 """Called when a libervia widget is closed""" | |
307 if self._selected_cache == lib_wid: | |
308 self.onSelectedChange(None) | |
302 | 309 |
303 """def complete(self): | 310 """def complete(self): |
304 | 311 |
305 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done | 312 #self.visible=False #XXX: self.visible is not unset in pyjamas when ENTER is pressed and a completion is done |
306 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this | 313 #XXX: fixed directly on pyjamas, if the patch is accepted, no need to walk around this |