diff src/cagou/core/cagou_main.py @ 85:c2a7234d13d2

menu: use of garden's contextmenu for menus
author Goffi <goffi@goffi.org>
date Sat, 24 Dec 2016 14:20:49 +0100
parents 46d962910801
children c711be670ecd
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Sat Dec 24 14:20:40 2016 +0100
+++ b/src/cagou/core/cagou_main.py	Sat Dec 24 14:20:49 2016 +0100
@@ -50,6 +50,7 @@
 from kivy.clock import Clock
 from kivy.uix.label import Label
 from kivy.uix.boxlayout import BoxLayout
+from kivy.uix.floatlayout import FloatLayout
 from kivy.uix.screenmanager import ScreenManager, Screen, FallOutTransition, RiseInTransition
 from kivy.uix.dropdown import DropDown
 from cagou_widget import CagouWidget
@@ -151,16 +152,23 @@
         self.manager.switch_to(screen)
 
 
-class CagouRootWidget(BoxLayout):
+class RootMenus(MenusWidget):
+    pass
+
+
+class RootBody(BoxLayout):
+    pass
+
+
+class CagouRootWidget(FloatLayout):
+    root_menus = properties.ObjectProperty()
+    root_body = properties.ObjectProperty
 
     def __init__(self, main_widget):
-        super(CagouRootWidget, self).__init__(orientation=("vertical"))
-        # general menus
-        self.menus_widget = MenusWidget()
-        self.add_widget(self.menus_widget)
+        super(CagouRootWidget, self).__init__()
         # header
         self._head_widget = RootHeadWidget()
-        self.add_widget(self._head_widget)
+        self.root_body.add_widget(self._head_widget)
         # body
         self._manager = ScreenManager()
         # main widgets
@@ -173,7 +181,7 @@
         # extra (file chooser, audio record, etc)
         extra_screen = Screen(name='extra')
         self._manager.add_widget(extra_screen)
-        self.add_widget(self._manager)
+        self.root_body.add_widget(self._manager)
 
     def changeWidget(self, widget, screen_name="main"):
         """change main widget"""
@@ -530,7 +538,7 @@
     ## menus ##
 
     def _getMenusCb(self, backend_menus):
-        main_menu = self.app.root.menus_widget
+        main_menu = self.app.root.root_menus
         self.menus.addMenus(backend_menus)
         self.menus.addMenu(C.MENU_GLOBAL, (_(u"Help"), _(u"About")), callback=main_menu.onAbout)
         main_menu.update(C.MENU_GLOBAL)