-\r
-\r
-class Notebook (aui.AuiNotebook):\r
- def __init__(self, *args, **kwargs):\r
- super(Notebook, self).__init__(*args, **kwargs)\r
- self.SetArtProvider(aui.AuiDefaultTabArt())\r
- #uncomment if we find a nice icon\r
- #page_bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16))\r
- self.AddPage(self._welcome_window(), 'Welcome')\r
-\r
- def _welcome_window(self):\r
- #TODO: move into panel.welcome\r
- ctrl = wx.html.HtmlWindow(parent=self, size=wx.Size(400, 300))\r
- lines = [\r
- '<h1>Welcome to Hooke</h1>',\r
- '<h3>Features</h3>',\r
- '<ul>',\r
- '<li>View, annotate, measure force files</li>',\r
- '<li>Worm-like chain fit of force peaks</li>',\r
- '<li>Automatic convolution-based filtering of empty files</li>',\r
- '<li>Automatic fit and measurement of multiple force peaks</li>',\r
- '<li>Handles force-clamp force experiments (experimental)</li>',\r
- '<li>It is extensible through plugins and drivers</li>',\r
- '</ul>',\r
- '<p>See the <a href="%s">DocumentationIndex</a>'\r
- % 'http://code.google.com/p/hooke/wiki/DocumentationIndex',\r
- 'for more information</p>',\r
- ]\r
- ctrl.SetPage('\n'.join(lines))\r
- return ctrl\r
-\r
-\r
-class NavBar (wx.ToolBar):\r
- def __init__(self, *args, **kwargs):\r
- super(NavBar, self).__init__(*args, **kwargs)\r
- self.SetToolBitmapSize(wx.Size(16,16))\r
- self._c = {\r
- 'previous': self.AddLabelTool(\r
- id=wx.ID_PREVIEW_PREVIOUS,\r
- label='Previous',\r
- bitmap=wx.ArtProvider_GetBitmap(\r
- wx.ART_GO_BACK, wx.ART_OTHER, wx.Size(16, 16)),\r
- shortHelp='Previous curve'),\r
- 'next': self.AddLabelTool(\r
- id=wx.ID_PREVIEW_NEXT,\r
- label='Next',\r
- bitmap=wx.ArtProvider_GetBitmap(\r
- wx.ART_GO_FORWARD, wx.ART_OTHER, wx.Size(16, 16)),\r
- shortHelp='Next curve'),\r
- }\r
- self.Realize()\r
-\r
-\r
-class FileMenu (wx.Menu):\r
- def __init__(self, *args, **kwargs):\r
- super(FileMenu, self).__init__(*args, **kwargs)\r
- self._c = {'exit': self.Append(wx.ID_EXIT)}\r
-\r
-\r
-class ViewMenu (wx.Menu):\r
- def __init__(self, *args, **kwargs):\r
- super(ViewMenu, self).__init__(*args, **kwargs)\r
- self._c = {\r
- 'folders': self.AppendCheckItem(id=wx.ID_ANY, text='Folders\tF5'),\r
- 'playlist': self.AppendCheckItem(\r
- id=wx.ID_ANY, text='Playlists\tF6'),\r
- 'commands': self.AppendCheckItem(\r
- id=wx.ID_ANY, text='Commands\tF7'),\r
- 'assistant': self.AppendCheckItem(\r
- id=wx.ID_ANY, text='Assistant\tF9'),\r
- 'properties': self.AppendCheckItem(\r
- id=wx.ID_ANY, text='Properties\tF8'),\r
- 'results': self.AppendCheckItem(id=wx.ID_ANY, text='Results\tF10'),\r
- 'output': self.AppendCheckItem(id=wx.ID_ANY, text='Output\tF11'),\r
- 'note': self.AppendCheckItem(id=wx.ID_ANY, text='Note\tF12'),\r
- }\r
- for item in self._c.values():\r
- item.Check()\r
-\r
-\r
-class PerspectiveMenu (wx.Menu):\r
- def __init__(self, *args, **kwargs):\r
- super(PerspectiveMenu, self).__init__(*args, **kwargs)\r
- self._c = {}\r
-\r
- def update(self, perspectives, selected, callback):\r
- """Rebuild the perspectives menu.\r
- """\r
- for item in self.GetMenuItems():\r
- self.UnBind(item)\r
- self.DeleteItem(item)\r
- self._c = {\r
- 'save': self.Append(id=wx.ID_ANY, text='Save Perspective'),\r
- 'delete': self.Append(id=wx.ID_ANY, text='Delete Perspective'),\r
- }\r
- self.AppendSeparator()\r
- for label in perspectives:\r
- self._c[label] = self.AppendRadioItem(id=wx.ID_ANY, text=label)\r
- self.Bind(wx.EVT_MENU, callback, self._c[label])\r
- if label == selected:\r
- self._c[label].Check(True)\r
- \r
-\r
-class HelpMenu (wx.Menu):\r
- def __init__(self, *args, **kwargs):\r
- super(HelpMenu, self).__init__(*args, **kwargs)\r
- self._c = {'about':self.Append(id=wx.ID_ABOUT)}\r
-\r
-\r
-class MenuBar (wx.MenuBar):\r
- def __init__(self, *args, **kwargs):\r
- super(MenuBar, self).__init__(*args, **kwargs)\r
- self._c = {\r
- 'file': FileMenu(),\r
- 'view': ViewMenu(),\r
- 'perspective': PerspectiveMenu(),\r
- 'help': HelpMenu(),\r
- }\r
- self.Append(self._c['file'], 'File')\r
- self.Append(self._c['view'], 'View')\r
- self.Append(self._c['perspective'], 'Perspective')\r
- self.Append(self._c['help'], 'Help')\r
-\r
-\r
-class StatusBar (wx.StatusBar):\r
- def __init__(self, *args, **kwargs):\r
- super(StatusBar, self).__init__(*args, **kwargs)\r
- self.SetStatusWidths([-2, -3])\r
- self.SetStatusText('Ready', 0)\r
- self.SetStatusText(u'Welcome to Hooke (version %s)' % version(), 1)\r