Mercurial > libervia-desktop-kivy
diff src/cagou/core/cagou_main.py @ 51:3f8599d9a766
core: menus first draft:
- menus are handled. Global menus are shown above notification for the moment, but may be displayed differently depending on plateform (e.g. using a button on mobile plateforms)
- menu are displayed after profile is connected
- backends menus are displayed but not working yet
- help/about menu has been added.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 11 Sep 2016 12:15:41 +0200 |
parents | fd9cbf6ae663 |
children | 647f32d0a004 |
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py Sat Sep 10 18:01:32 2016 +0200 +++ b/src/cagou/core/cagou_main.py Sun Sep 11 12:15:41 2016 +0200 @@ -48,6 +48,7 @@ from cagou_widget import CagouWidget from . import widgets_handler from .common import IconButton +from .menu import MenusWidget from importlib import import_module import os.path import glob @@ -138,10 +139,12 @@ def __init__(self, main_widget): super(CagouRootWidget, self).__init__(orientation=("vertical")) + # general menus + self.menus_widget = MenusWidget() + self.add_widget(self.menus_widget) # header self._head_widget = RootHeadWidget() self.add_widget(self._head_widget) - # body self._manager = ScreenManager() # main widgets @@ -340,7 +343,6 @@ ## widgets handling - def newWidget(self, widget): log.debug(u"new widget created: {}".format(widget)) if isinstance(widget, quick_chat.QuickChat) and widget.type == C.CHAT_GROUP: @@ -413,10 +415,19 @@ w.addTarget(t) return w + ## menus ## + + def _getMenusCb(self, backend_menus): + main_menu = self.app.root.menus_widget + 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) + ## misc ## def plugging_profiles(self): self.app.root.changeWidget(WidgetsHandler()) + self.bridge.getMenus("", C.NO_SECURITY_LIMIT, callback=self._getMenusCb) def setPresenceStatus(self, show='', status=None, profile=C.PROF_KEY_NONE): log.info(u"Profile presence status set to {show}/{status}".format(show=show, status=status))