changeset 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 15434a7787ed
children 8576d70ff803
files src/cagou/core/cagou_widget.py src/cagou/kv/cagou_widget.kv
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/cagou/core/cagou_widget.py	Thu Jan 26 20:39:18 2017 +0100
+++ b/src/cagou/core/cagou_widget.py	Thu Jan 26 20:39:29 2017 +0100
@@ -50,6 +50,7 @@
 
 class CagouWidget(BoxLayout):
     header_input = properties.ObjectProperty(None)
+    header_box = properties.ObjectProperty(None)
 
     def __init__(self):
         for p in G.host.getPluggedWidgets():
@@ -75,3 +76,7 @@
         if self.collide_point(*touch.pos):
             G.host.selected_widget = self
         super(CagouWidget, self).on_touch_down(touch)
+
+    def headerInputAddExtra(self, widget):
+        """add a widget on the right of header input"""
+        self.header_box.add_widget(widget)
--- a/src/cagou/kv/cagou_widget.kv	Thu Jan 26 20:39:18 2017 +0100
+++ b/src/cagou/kv/cagou_widget.kv	Thu Jan 26 20:39:29 2017 +0100
@@ -50,7 +50,9 @@
 
 <CagouWidget>:
     header_input: header_input
+    header_box: header_box
     BoxLayout:
+        id: header_box
         size_hint: 1, None
         height: dp(32)
         HeaderWidgetCurrent: