comparison 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
comparison
equal deleted inserted replaced
37:6cf08d0ee460 38:9f45098289cc
30 30
31 class HeaderWidgetChoice(ButtonBehavior, BoxLayout): 31 class HeaderWidgetChoice(ButtonBehavior, BoxLayout):
32 def __init__(self, cagou_widget, plugin_info): 32 def __init__(self, cagou_widget, plugin_info):
33 self.plugin_info = plugin_info 33 self.plugin_info = plugin_info
34 super(HeaderWidgetChoice, self).__init__() 34 super(HeaderWidgetChoice, self).__init__()
35 self.bind(on_release=lambda btn, plugin_info=plugin_info: cagou_widget.switchWidget(plugin_info)) 35 self.bind(on_release=lambda btn: cagou_widget.switchWidget(plugin_info))
36 36
37 37
38 class HeaderWidgetCurrent(ButtonBehavior, Image): 38 class HeaderWidgetCurrent(ButtonBehavior, Image):
39 pass 39 pass
40 40