MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / __init__

Method __init__

gui/chrome_tabs.py:95–133  ·  view source on GitHub ↗

Instance of Notebook. Initializes general layout, includes methods for setting current page, replacing pages, any public function for the notebook width modes: - 0: legacy (all tabs have equal width) - 1: all tabs take just enough space to fit

(self, parent, can_add=True, tabWidthMode=0)

Source from the content-addressed store, hash-verified

93class ChromeNotebook(wx.Panel):
94
95 def __init__(self, parent, can_add=True, tabWidthMode=0):
96 """
97 Instance of Notebook. Initializes general layout, includes methods
98 for setting current page, replacing pages, any public function for the
99 notebook
100
101 width modes:
102 - 0: legacy (all tabs have equal width)
103 - 1: all tabs take just enough space to fit text
104 """
105 super().__init__(parent, wx.ID_ANY, size=(-1, -1))
106
107 self._pages = []
108 self._active_page = None
109
110 main_sizer = wx.BoxSizer(wx.VERTICAL)
111
112 tabs_sizer = wx.BoxSizer(wx.VERTICAL)
113 self.tabs_container = _TabsContainer(self, can_add=can_add, tabWidthMode=tabWidthMode)
114 tabs_sizer.Add(self.tabs_container, 0, wx.EXPAND)
115
116 if 'wxMSW' in wx.PlatformInfo:
117 style = wx.DOUBLE_BORDER
118 else:
119 style = wx.SIMPLE_BORDER
120
121 back_color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
122
123 content_sizer = wx.BoxSizer(wx.VERTICAL)
124 self.page_container = wx.Panel(self, style=style)
125 self.page_container.SetBackgroundColour(back_color)
126 content_sizer.Add(self.page_container, 1, wx.EXPAND, 5)
127
128 main_sizer.Add(tabs_sizer, 0, wx.EXPAND, 5)
129 main_sizer.Add(content_sizer, 1, wx.EXPAND | wx.BOTTOM, 2)
130
131 self.SetSizer(main_sizer)
132 self.Bind(wx.EVT_SIZE, self.OnSize)
133 self.Layout()
134
135 def GetPage(self, i):
136 return self._pages[i]

Callers

nothing calls this directly

Calls 3

_TabsContainerClass · 0.85
SetBackgroundColourMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected