comparison src/cagou/core/cagou_widget.py @ 115:e0c41f209c28

CagouWidget: instances can now add their own extra widgets in header with headerInputAddExtra
author Goffi <goffi@goffi.org>
date Thu, 26 Jan 2017 20:39:29 +0100
parents 953ddf817b8a
children
comparison
equal deleted inserted replaced
114:15434a7787ed 115:e0c41f209c28
48 self.add_widget(choice) 48 self.add_widget(choice)
49 49
50 50
51 class CagouWidget(BoxLayout): 51 class CagouWidget(BoxLayout):
52 header_input = properties.ObjectProperty(None) 52 header_input = properties.ObjectProperty(None)
53 header_box = properties.ObjectProperty(None)
53 54
54 def __init__(self): 55 def __init__(self):
55 for p in G.host.getPluggedWidgets(): 56 for p in G.host.getPluggedWidgets():
56 if p['main'] == self.__class__: 57 if p['main'] == self.__class__:
57 self.plugin_info = p 58 self.plugin_info = p
73 74
74 def on_touch_down(self, touch): 75 def on_touch_down(self, touch):
75 if self.collide_point(*touch.pos): 76 if self.collide_point(*touch.pos):
76 G.host.selected_widget = self 77 G.host.selected_widget = self
77 super(CagouWidget, self).on_touch_down(touch) 78 super(CagouWidget, self).on_touch_down(touch)
79
80 def headerInputAddExtra(self, widget):
81 """add a widget on the right of header input"""
82 self.header_box.add_widget(widget)