You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

2 years ago
  1. import wx # type: ignore
  2. from gooey.gui import events
  3. from gooey.gui.pubsub import pub
  4. from gooey.gui.util import wx_util
  5. class Tabbar(wx.Panel):
  6. def __init__(self, parent, buildSpec, configPanels, *args, **kwargs):
  7. super(Tabbar, self).__init__(parent, *args, **kwargs)
  8. self._parent = parent
  9. self.notebook = wx.Notebook(self, style=wx.BK_DEFAULT)
  10. self.buildSpec = buildSpec
  11. self.configPanels = configPanels
  12. self.options = list(self.buildSpec['widgets'].keys())
  13. self.layoutComponent()
  14. def layoutComponent(self):
  15. for group, panel in zip(self.options, self.configPanels):
  16. panel.Reparent( self.notebook)
  17. self.notebook.AddPage(panel, group)
  18. self.notebook.Layout()
  19. sizer = wx.BoxSizer(wx.VERTICAL)
  20. sizer.Add(self.notebook, 1, wx.EXPAND)
  21. self.SetSizer(sizer)
  22. self.Layout()
  23. def getSelectedGroup(self):
  24. return self.options[self.notebook.Selection]
  25. def getActiveConfig(self):
  26. return self.configPanels[self.notebook.Selection]
  27. def show(self, b):
  28. self.Show(b)