callbacks={\r
'close': self._on_close,\r
'about': self._on_about,\r
+ 'view_panel': self._on_panel_visibility,\r
+ 'save_perspective': self._on_save_perspective,\r
+ 'delete_perspective': self._on_delete_perspective,\r
})\r
self.SetMenuBar(self._c['menu bar'])\r
\r
active_file = self.GetActiveFile()\r
active_file.note = self.panelNote.Editor.GetValue()\r
\r
- def _on_view(self, event):\r
- menu_id = event.GetId()\r
- menu_item = self._c['menu bar'].FindItemById(menu_id)\r
- menu_label = menu_item.GetLabel()\r
-\r
- pane = self._c['manager'].GetPane(menu_label)\r
- pane.Show(not pane.IsShown())\r
+ def _on_panel_visibility(self, _class, method, panel_name, visible):\r
+ pane = self._c['manager'].GetPane(panel_name)\r
+ print visible\r
+ pane.Show(visible)\r
#if we don't do the following, the Folders pane does not resize properly on hide/show\r
if pane.caption == 'Folders' and pane.IsShown() and pane.IsDocked():\r
#folders_size = pane.GetSize()\r
self._callbacks = callbacks
self._c = {}
for i,panelname in enumerate(sorted(panel.PANELS.keys())):
- text = '%s\tF%d' % (panelname.capitalize, i+5)
+ text = '%s\tF%d' % (panelname.capitalize(), i+5)
self._c[panelname] = self.AppendCheckItem(id=wx.ID_ANY, text=text)
for item in self._c.values():
item.Check()
+ self.Bind(event=wx.EVT_MENU, handler=self.view_panel, id=item.GetId())
+
+ def view_panel(self, event):
+ _id = event.GetId()
+ item = self.FindItemById(_id)
+ label = item.GetLabel()
+ selected = item.IsChecked()
+ in_callback(self, panel_name=label, visible=selected)
class PerspectiveMenu (Menu):