diff src/browser/sat_browser/base_widget.py @ 510:db3436c85fb1

browser_side: the status menu is now based on GenericMenuBar instead of PopupMenuPanel
author souliane <souliane@mailoo.org>
date Thu, 21 Aug 2014 16:44:39 +0200
parents 4aa627b059df
children 4c6d7db9b45c
line wrap: on
line diff
--- a/src/browser/sat_browser/base_widget.py	Thu Aug 21 16:18:51 2014 +0200
+++ b/src/browser/sat_browser/base_widget.py	Thu Aug 21 16:44:39 2014 +0200
@@ -169,15 +169,18 @@
 
     ITEM_TPL = "<img src='media/icons/misc/%s.png' />"
 
-    def __init__(self, parent, host, vertical=False):
-        styles = {'menu_bar': 'widgetHeader_buttonGroup'}
-        base_menu.GenericMenuBar.__init__(self, host, vertical=vertical, styles=styles)
+    def __init__(self, parent, host, vertical=False, styles=None):
+        menu_styles = {'menu_bar': 'widgetHeader_buttonGroup'}
+        if styles:
+            menu_styles.update(styles)
+        base_menu.GenericMenuBar.__init__(self, host, vertical=vertical, styles=menu_styles)
 
-        # regroup all the dynamic menu categories in a sub-menu
-        sub_menu = WidgetSubMenuBar(host, vertical=True)
-        parent.addMenus(sub_menu)
-        if len(sub_menu.getCategories()) > 0:
-            self.addMenuItem('', '', 'plugins', sub_menu)
+        if hasattr(parent, 'addMenus'):
+            # regroup all the dynamic menu categories in a sub-menu
+            sub_menu = WidgetSubMenuBar(host, vertical=True)
+            parent.addMenus(sub_menu)
+            if len(sub_menu.getCategories()) > 0:
+                self.addCategory('', '', 'plugins', sub_menu)
 
     @classmethod
     def getCategoryHTML(cls, menu_name_i18n, type_):