Populates the View menu with show column toggle menu items for each column that is toggleable. It uses the information provided in self.columns.
(self)
| 393 | self.options.Set("FontScale", scale) |
| 394 | |
| 395 | def _createShowColMenuItems(self): |
| 396 | ''' |
| 397 | Populates the View menu with show column toggle menu items for |
| 398 | each column that is toggleable. It uses the information provided |
| 399 | in self.columns. |
| 400 | ''' |
| 401 | # For each column, create show / hide menu items, if hideable |
| 402 | self.col_menu_items = [[] for i in self.columns] |
| 403 | for col in self.columns: |
| 404 | if not col[4]: # Do not add menu item if column not hideable |
| 405 | continue |
| 406 | index = col[0] |
| 407 | options_key = "Show" + col[1] |
| 408 | menu_name = "Show " + col[6] |
| 409 | self.col_menu_items[index] = self.view_menu.AppendCheckItem( |
| 410 | wx.ID_ANY, |
| 411 | menu_name |
| 412 | ) |
| 413 | # Column show / hide, depending on user settings, if any |
| 414 | checked = self.options.Get( |
| 415 | options_key, |
| 416 | self.columns[index][5] |
| 417 | ) |
| 418 | self.col_menu_items[index].Check( |
| 419 | self.options.Get(options_key, checked) |
| 420 | ) |
| 421 | # Bind new menu item to toggleColumn method |
| 422 | self.view_menu.Bind( |
| 423 | wx.EVT_MENU, |
| 424 | lambda evt, index=index: self._toggleColumn(index, evt), |
| 425 | self.col_menu_items[index] |
| 426 | ) |
| 427 | |
| 428 | def _toggleColumn(self, index, event=None): |
| 429 | ''' |
no test coverage detected