comparison src/cagou/core/cagou_widget.py @ 20:29b507826eed

header's input field is now accessible with self.header_input and call onHeaderInput() on text entered
author Goffi <goffi@goffi.org>
date Mon, 08 Aug 2016 01:02:23 +0200
parents ba14b596b90e
children d09bd16dbbe2
comparison
equal deleted inserted replaced
19:c58b522607f4 20:29b507826eed
21 from sat.core import log as logging 21 from sat.core import log as logging
22 log = logging.getLogger(__name__) 22 log = logging.getLogger(__name__)
23 from kivy.uix.button import Button 23 from kivy.uix.button import Button
24 from kivy.uix.boxlayout import BoxLayout 24 from kivy.uix.boxlayout import BoxLayout
25 from kivy.uix.dropdown import DropDown 25 from kivy.uix.dropdown import DropDown
26 from kivy import properties
26 from cagou import G 27 from cagou import G
27 28
28 29
29 class HeaderWidgetButton(Button): 30 class HeaderWidgetButton(Button):
30 pass 31 pass
39 btn.bind(on_release=lambda btn, plugin_info=plugin_info: cagou_widget.switchWidget(plugin_info)) 40 btn.bind(on_release=lambda btn, plugin_info=plugin_info: cagou_widget.switchWidget(plugin_info))
40 self.add_widget(btn) 41 self.add_widget(btn)
41 42
42 43
43 class CagouWidget(BoxLayout): 44 class CagouWidget(BoxLayout):
45 header_input = properties.ObjectProperty(None)
44 46
45 def __init__(self): 47 def __init__(self):
46 BoxLayout.__init__(self, orientation="vertical") 48 BoxLayout.__init__(self, orientation="vertical")
47 self.selector = HeaderWidgetSelector(self) 49 self.selector = HeaderWidgetSelector(self)
48 50
49 def switchWidget(self, plugin_info): 51 def switchWidget(self, plugin_info):
50 self.selector.dismiss() 52 self.selector.dismiss()
51 factory = plugin_info["factory"] 53 factory = plugin_info["factory"]
52 new_widget = factory(plugin_info, None, None) 54 new_widget = factory(plugin_info, None, iter(G.host.profiles))
53 G.host.switchWidget(self, new_widget) 55 G.host.switchWidget(self, new_widget)
56
57 def onHeaderInput(self):
58 log.info(u"header input text entered")