comparison src/browser/sat_browser/xmlui.py @ 723:afbe061b2d66

browser_side (xmlui): allow to select a tab when adding it
author souliane <souliane@mailoo.org>
date Wed, 26 Aug 2015 09:15:56 +0200
parents 242dde89e698
children fc941d0d97f8
comparison
equal deleted inserted replaced
722:242dde89e698 723:afbe061b2d66
315 315
316 def __init__(self, xmlui_main, xmlui_parent): 316 def __init__(self, xmlui_main, xmlui_parent):
317 TabPanel.__init__(self) 317 TabPanel.__init__(self)
318 self.setStyleName('liberviaTabPanel') 318 self.setStyleName('liberviaTabPanel')
319 319
320 def _xmluiAddTab(self, label): 320 def _xmluiAddTab(self, label, selected):
321 tab_panel = VerticalContainer(self) 321 tab_panel = VerticalContainer(self)
322 self.add(tab_panel, label) 322 self.add(tab_panel, label)
323 if len(self.getChildren()) == 1: 323 count = len(self.getChildren())
324 self.selectTab(0) 324 if count == 1 or selected:
325 self.selectTab(count - 1)
325 return tab_panel 326 return tab_panel
326 327
327 328
328 class VerticalContainer(LiberviaContainer, xmlui.VerticalContainer, VerticalPanel): 329 class VerticalContainer(LiberviaContainer, xmlui.VerticalContainer, VerticalPanel):
329 __bases__ = (LiberviaContainer, xmlui.VerticalContainer, VerticalPanel) 330 __bases__ = (LiberviaContainer, xmlui.VerticalContainer, VerticalPanel)