def _AppendSubtitle(self, sizer: wx.Sizer, text: str) -> wx.StaticText: self._AppendSpacer(sizer, 3) line = wx.StaticLine(self, style=wx.HORIZONTAL) sizer.Add(line, wx.GBPosition(sizer.GetRows(), 0), wx.GBSpan(1, 5), flag=wx.EXPAND) statictext = wx.StaticText(self, label=text) font = wx.Font(wx.FontInfo(9)) statictext.SetFont(font) sizer.Add(statictext, wx.GBPosition(sizer.GetRows(), 0), wx.GBSpan(1, 5), flag=wx.ALIGN_CENTER) self._AppendSpacer(sizer, 0) return statictext
def _AppendControl(self, sizer: wx.Sizer, label_str: str, ctrl: wx.Control): """Append a control, its label, and its info badge to the last row of the sizer. Returns the automaticaly created label and info badge (wx.StaticText for now). """ label = wx.StaticText(self, label=label_str) label.SetFont(self._label_font) rows = sizer.GetRows() sizer.Add(label, wx.GBPosition(rows, 1), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) sizer.Add(ctrl, wx.GBPosition(rows, 2), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) sizer.Add(0, self._info_length, wx.GBPosition(rows, 4), wx.GBSpan(1, 1)) info_badge = wx.StaticBitmap(self, bitmap=self._info_bitmap) info_badge.Show(False) sizer.Add(info_badge, wx.GBPosition(rows, 3), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER) self.labels[ctrl.GetId()] = label self.badges[ctrl.GetId()] = info_badge
def _AppendSpacer(self, sizer: wx.Sizer, height: int): """Append a horizontal spacer with the given height. Note: The VGAP value still applies, i.e. there is an additional gap between the spacer and the next row. """ rows = sizer.GetRows() sizer.Add(0, height, wx.GBPosition(rows, 0), wx.GBSpan(1, 5))