--- /dev/null
+# Copyright
+
+"""Menu bar for Hooke.
+"""
+
+import wx
+
+
+class FileMenu (wx.Menu):
+ def __init__(self, *args, **kwargs):
+ super(FileMenu, self).__init__(*args, **kwargs)
+ self._c = {'exit': self.Append(wx.ID_EXIT)}
+
+
+class ViewMenu (wx.Menu):
+ def __init__(self, *args, **kwargs):
+ super(ViewMenu, self).__init__(*args, **kwargs)
+ self._c = {
+ 'folders': self.AppendCheckItem(id=wx.ID_ANY, text='Folders\tF5'),
+ 'playlist': self.AppendCheckItem(
+ id=wx.ID_ANY, text='Playlists\tF6'),
+ 'commands': self.AppendCheckItem(
+ id=wx.ID_ANY, text='Commands\tF7'),
+ 'assistant': self.AppendCheckItem(
+ id=wx.ID_ANY, text='Assistant\tF9'),
+ 'properties': self.AppendCheckItem(
+ id=wx.ID_ANY, text='Properties\tF8'),
+ 'results': self.AppendCheckItem(id=wx.ID_ANY, text='Results\tF10'),
+ 'output': self.AppendCheckItem(id=wx.ID_ANY, text='Output\tF11'),
+ 'note': self.AppendCheckItem(id=wx.ID_ANY, text='Note\tF12'),
+ }
+ for item in self._c.values():
+ item.Check()
+
+
+class PerspectiveMenu (wx.Menu):
+ def __init__(self, *args, **kwargs):
+ super(PerspectiveMenu, self).__init__(*args, **kwargs)
+ self._c = {}
+
+ def update(self, perspectives, selected, callback):
+ """Rebuild the perspectives menu.
+ """
+ for item in self.GetMenuItems():
+ self.UnBind(item)
+ self.DeleteItem(item)
+ self._c = {
+ 'save': self.Append(id=wx.ID_ANY, text='Save Perspective'),
+ 'delete': self.Append(id=wx.ID_ANY, text='Delete Perspective'),
+ }
+ self.AppendSeparator()
+ for label in perspectives:
+ self._c[label] = self.AppendRadioItem(id=wx.ID_ANY, text=label)
+ self.Bind(wx.EVT_MENU, callback, self._c[label])
+ if label == selected:
+ self._c[label].Check(True)
+
+
+class HelpMenu (wx.Menu):
+ def __init__(self, *args, **kwargs):
+ super(HelpMenu, self).__init__(*args, **kwargs)
+ self._c = {'about':self.Append(id=wx.ID_ABOUT)}
+
+
+class MenuBar (wx.MenuBar):
+ def __init__(self, *args, **kwargs):
+ super(MenuBar, self).__init__(*args, **kwargs)
+ self._c = {
+ 'file': FileMenu(),
+ 'view': ViewMenu(),
+ 'perspective': PerspectiveMenu(),
+ 'help': HelpMenu(),
+ }
+ self.Append(self._c['file'], 'File')
+ self.Append(self._c['view'], 'View')
+ self.Append(self._c['perspective'], 'Perspective')
+ self.Append(self._c['help'], 'Help')