| 1312 | widths = [100, 140, 300] |
| 1313 | |
| 1314 | def __init__(self, parent, help_entries): |
| 1315 | super().__init__(parent, title="Help", |
| 1316 | style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) |
| 1317 | |
| 1318 | sizer = wx.BoxSizer(wx.VERTICAL) |
| 1319 | grid_sizer = wx.FlexGridSizer(0, 3, 8, 6) |
| 1320 | # create and add the entries |
| 1321 | bold = self.GetFont().MakeBold() |
| 1322 | for r, row in enumerate(self.headers + help_entries): |
| 1323 | for (col, width) in zip(row, self.widths): |
| 1324 | label = wx.StaticText(self, label=col) |
| 1325 | if r == 0: |
| 1326 | label.SetFont(bold) |
| 1327 | label.Wrap(width) |
| 1328 | grid_sizer.Add(label, 0, 0, 0) |
| 1329 | # finalize layout, create button |
| 1330 | sizer.Add(grid_sizer, 0, wx.ALL, 6) |
| 1331 | ok = wx.Button(self, wx.ID_OK) |
| 1332 | sizer.Add(ok, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8) |
| 1333 | self.SetSizer(sizer) |
| 1334 | sizer.Fit(self) |
| 1335 | self.Layout() |
| 1336 | self.Bind(wx.EVT_CLOSE, self._on_close) |
| 1337 | ok.Bind(wx.EVT_BUTTON, self._on_close) |
| 1338 | |
| 1339 | def _on_close(self, event): |
| 1340 | _HelpDialog._instance = None # remove global reference |