comparison 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
comparison
equal deleted inserted replaced
509:35ccb3ff8245 510:db3436c85fb1
167 167
168 class WidgetMenuBar(base_menu.GenericMenuBar): 168 class WidgetMenuBar(base_menu.GenericMenuBar):
169 169
170 ITEM_TPL = "<img src='media/icons/misc/%s.png' />" 170 ITEM_TPL = "<img src='media/icons/misc/%s.png' />"
171 171
172 def __init__(self, parent, host, vertical=False): 172 def __init__(self, parent, host, vertical=False, styles=None):
173 styles = {'menu_bar': 'widgetHeader_buttonGroup'} 173 menu_styles = {'menu_bar': 'widgetHeader_buttonGroup'}
174 base_menu.GenericMenuBar.__init__(self, host, vertical=vertical, styles=styles) 174 if styles:
175 175 menu_styles.update(styles)
176 # regroup all the dynamic menu categories in a sub-menu 176 base_menu.GenericMenuBar.__init__(self, host, vertical=vertical, styles=menu_styles)
177 sub_menu = WidgetSubMenuBar(host, vertical=True) 177
178 parent.addMenus(sub_menu) 178 if hasattr(parent, 'addMenus'):
179 if len(sub_menu.getCategories()) > 0: 179 # regroup all the dynamic menu categories in a sub-menu
180 self.addMenuItem('', '', 'plugins', sub_menu) 180 sub_menu = WidgetSubMenuBar(host, vertical=True)
181 parent.addMenus(sub_menu)
182 if len(sub_menu.getCategories()) > 0:
183 self.addCategory('', '', 'plugins', sub_menu)
181 184
182 @classmethod 185 @classmethod
183 def getCategoryHTML(cls, menu_name_i18n, type_): 186 def getCategoryHTML(cls, menu_name_i18n, type_):
184 return cls.ITEM_TPL % type_ 187 return cls.ITEM_TPL % type_
185 188