Mercurial > libervia-web
diff src/browser/libervia_main.py @ 494:5d8632a7bfde
browser_side: refactorisation of menus and LiberviaWidget's header
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 15 Jul 2014 18:43:55 +0200 |
parents | 0bbbef1d53a8 |
children | 587fe75d1b16 |
line wrap: on
line diff
--- a/src/browser/libervia_main.py Tue Jul 15 13:39:36 2014 +0200 +++ b/src/browser/libervia_main.py Tue Jul 15 18:43:55 2014 +0200 @@ -191,7 +191,7 @@ self.notification = notification.Notification() DOM.addEventPreview(self) self._register = RegisterCall() - self._register.call('getMenus', self.panel.menu.createMenus) + self._register.call('getMenus', self.gotMenus) self._register.call('registerParams', None) self._register.call('isRegistered', self._isRegisteredCB) self.initialised = False @@ -316,6 +316,18 @@ def displayNotification(self, title, body): self.notification.notify(title, body) + def gotMenus(self, menus): + """Put the menus data in cache and build the main menu bar + + @param menus (list[tuple]): menu data + """ + self.menus = {} + for raw_menu in menus: + id_, type_, path, path_i18n = raw_menu + menus_data = self.menus.setdefault(type_, []) + menus_data.append((id_, path, path_i18n)) + self.panel.menu.createMenus() + def _isRegisteredCB(self, result): registered, warning = result if not registered: