diff src/cagou/core/cagou_widget.py @ 38:9f45098289cc

widgets handler, core: hidden widgets can now be shown with swipes: - a couple of methods have been added to handle visible and hidden widgets - a new getOrClone method allow to recreate a widget if it already has a parent (can happen even if the widget is not shown, e.g. in a carousel) - handler now display hidden widgets of the same class as the displayed one when swiping. For instance, if a chat widget is displayed, and header input is used to show an other one, it's now possible to go back to the former by swiping. QuickWidget.onDelete method can be used to handle if a widget must be really deleted (return True) or just hidden (any other value). - handler use a subclass of Carousel for this new feature, with some adjustement so event can be passed to children without too much delay (and frustration). This may need to be adjusted again in the future. - handler.cagou_widget now give the main displayed widget in the handler - handler.changeWidget must be used when widget need to be changed (it's better to use host.switchWidget which will call it itself)
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 15:27:48 +0200
parents 8b5827c43155
children 3f8599d9a766
line wrap: on
line diff
--- a/src/cagou/core/cagou_widget.py	Sun Aug 28 15:27:45 2016 +0200
+++ b/src/cagou/core/cagou_widget.py	Sun Aug 28 15:27:48 2016 +0200
@@ -32,7 +32,7 @@
     def __init__(self, cagou_widget, plugin_info):
         self.plugin_info = plugin_info
         super(HeaderWidgetChoice, self).__init__()
-        self.bind(on_release=lambda btn, plugin_info=plugin_info: cagou_widget.switchWidget(plugin_info))
+        self.bind(on_release=lambda btn: cagou_widget.switchWidget(plugin_info))
 
 
 class HeaderWidgetCurrent(ButtonBehavior, Image):