Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
493:636b6c477a87 | 494:5d8632a7bfde |
---|---|
189 self._register_box = None | 189 self._register_box = None |
190 RootPanel().add(self.panel) | 190 RootPanel().add(self.panel) |
191 self.notification = notification.Notification() | 191 self.notification = notification.Notification() |
192 DOM.addEventPreview(self) | 192 DOM.addEventPreview(self) |
193 self._register = RegisterCall() | 193 self._register = RegisterCall() |
194 self._register.call('getMenus', self.panel.menu.createMenus) | 194 self._register.call('getMenus', self.gotMenus) |
195 self._register.call('registerParams', None) | 195 self._register.call('registerParams', None) |
196 self._register.call('isRegistered', self._isRegisteredCB) | 196 self._register.call('isRegistered', self._isRegisteredCB) |
197 self.initialised = False | 197 self.initialised = False |
198 self.init_cache = [] # used to cache events until initialisation is done | 198 self.init_cache = [] # used to cache events until initialisation is done |
199 self.cached_params = {} | 199 self.cached_params = {} |
313 panel = self.tab_panel.tabBar.getTabWidget(tab_index) | 313 panel = self.tab_panel.tabBar.getTabWidget(tab_index) |
314 panel.addWidget(wid) | 314 panel.addWidget(wid) |
315 | 315 |
316 def displayNotification(self, title, body): | 316 def displayNotification(self, title, body): |
317 self.notification.notify(title, body) | 317 self.notification.notify(title, body) |
318 | |
319 def gotMenus(self, menus): | |
320 """Put the menus data in cache and build the main menu bar | |
321 | |
322 @param menus (list[tuple]): menu data | |
323 """ | |
324 self.menus = {} | |
325 for raw_menu in menus: | |
326 id_, type_, path, path_i18n = raw_menu | |
327 menus_data = self.menus.setdefault(type_, []) | |
328 menus_data.append((id_, path, path_i18n)) | |
329 self.panel.menu.createMenus() | |
318 | 330 |
319 def _isRegisteredCB(self, result): | 331 def _isRegisteredCB(self, result): |
320 registered, warning = result | 332 registered, warning = result |
321 if not registered: | 333 if not registered: |
322 self._register_box = register.RegisterBox(self.logged) | 334 self._register_box = register.RegisterBox(self.logged) |