Author: bugman Date: Tue Dec 21 10:56:55 2010 New Revision: 11922 URL: http://svn.gna.org/viewcvs/relax?rev=11922&view=rev Log: Added a toolbar to the spin view window. The view can now be refreshed, and any data pipe switched to. Added: branches/bieri_gui/gui_bieri/oxygen_icons/16x16/actions/view-refresh.png (with props) branches/bieri_gui/gui_bieri/oxygen_icons/22x22/actions/view-refresh.png (with props) branches/bieri_gui/gui_bieri/oxygen_icons/32x32/actions/view-refresh.png (with props) branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/view-refresh.png (with props) Modified: branches/bieri_gui/gui_bieri/components/mol_res_spin_tree.py branches/bieri_gui/gui_bieri/paths.py Modified: branches/bieri_gui/gui_bieri/components/mol_res_spin_tree.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/components/mol_res_spin_tree.py?rev=11922&r1=11921&r2=11922&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/components/mol_res_spin_tree.py (original) +++ branches/bieri_gui/gui_bieri/components/mol_res_spin_tree.py Tue Dec 21 10:56:55 2010 @@ -29,7 +29,7 @@ # relax module imports. from generic_fns.mol_res_spin import molecule_loop, residue_loop, spin_loop -from generic_fns.pipes import get_pipe +from generic_fns.pipes import cdp_name, get_pipe, pipe_names # GUI module imports. from gui_bieri import paths @@ -320,6 +320,7 @@ + class Tree_window(wx.Frame): """A window element for the tree view.""" @@ -335,11 +336,14 @@ # Some default values. self.size_x = 500 - self.size_y = 1000 + self.size_y = 800 self.border = 0 # Set up the window. sizer = self.setup_window() + + # Build the toolbar. + self.toolbar() # Add the tree view panel. self.tree_panel = Mol_res_spin_tree(self.gui, parent=self, id=-1) @@ -354,10 +358,24 @@ """ # First update. - self.tree_panel._tree_update() + self.refresh() # Then show the window using the baseclass method. wx.Frame.Show(self, show) + + + def refresh(self, event=None): + """Event handler for the refresh action. + + @param event: The wx event. + @type event: wx event + """ + + # Update the data pipe selector. + self.update_pipes() + + # Update the tree. + self.tree_panel._tree_update() def handler_close(self, event): @@ -393,3 +411,62 @@ # Return the sizer. return sizer + + + def toolbar(self): + """Create the toolbar.""" + + # Init. + self.bar = self.CreateToolBar(wx.TB_HORIZONTAL) + + # The refresh button. + id = wx.NewId() + self.bar.AddLabelTool(id, "Refresh", wx.Bitmap(paths.icon_32x32.view_refresh, wx.BITMAP_TYPE_ANY), shortHelp="Refresh", longHelp="Refresh the spin view") + self.Bind(wx.EVT_TOOL, self.refresh, id=id) + + # A separator. + self.bar.AddSeparator() + + # asdf + text = wx.StaticText(self.bar, -1, ' Current data pipe: ', style=wx.ALIGN_LEFT) + self.bar.AddControl(text) + + # The pipe selection. + self.pipe_name = wx.ComboBox(self.bar, -1, "", style=wx.CB_DROPDOWN|wx.CB_READONLY, choices=[]) + self.bar.AddControl(self.pipe_name) + self.Bind(wx.EVT_COMBOBOX, self.update_pipes, self.pipe_name) + self.update_pipes(None) + + + def update_pipes(self, event=None): + """Update the spin view data pipe selector. + + @param event: The wx event. + @type event: wx event + """ + + # The selected pipe. + if event: + pipe = str(event.GetString()) + else: + pipe = cdp_name() + if not pipe: + pipe = '' + + # Clear the previous data. + self.pipe_name.Clear() + + # Set the pipe name to the cdp. + self.pipe_name.SetValue(pipe) + + # The list of pipe names. + for name in pipe_names(): + self.pipe_name.Append(name) + + # Switch. + if pipe: + # Switch data pipes. + self.gui.user_functions.interpreter.pipe.switch(pipe) + + # Update the tree view. + self.tree_panel._tree_update() Added: branches/bieri_gui/gui_bieri/oxygen_icons/16x16/actions/view-refresh.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/16x16/actions/view-refresh.png?rev=11922&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/16x16/actions/view-refresh.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: branches/bieri_gui/gui_bieri/oxygen_icons/22x22/actions/view-refresh.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/22x22/actions/view-refresh.png?rev=11922&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/22x22/actions/view-refresh.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: branches/bieri_gui/gui_bieri/oxygen_icons/32x32/actions/view-refresh.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/32x32/actions/view-refresh.png?rev=11922&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/32x32/actions/view-refresh.png ------------------------------------------------------------------------------ svn:mime-type = image/png Added: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/view-refresh.png URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/view-refresh.png?rev=11922&view=auto ============================================================================== Binary file - no diff available. Propchange: branches/bieri_gui/gui_bieri/oxygen_icons/48x48/actions/view-refresh.png ------------------------------------------------------------------------------ svn:mime-type = image/png Modified: branches/bieri_gui/gui_bieri/paths.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/paths.py?rev=11922&r1=11921&r2=11922&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/paths.py (original) +++ branches/bieri_gui/gui_bieri/paths.py Tue Dec 21 10:56:55 2010 @@ -79,6 +79,7 @@ self.settings_reset = path + 'actions' + sep + 'edit-delete.png' self.ref = path + 'actions' + sep + 'flag-blue.png' self.uf_script = path + 'mimetypes' + sep + 'application-x-desktop.png' + self.view_refresh = path + 'actions' + sep + 'view-refresh.png' @@ -102,6 +103,7 @@ self.pipe = path + 'pipe.png' self.residue = path + 'residue.png' self.spin = path + 'spin.png' + self.view_refresh = path + 'actions' + sep + 'view-refresh.png' @@ -117,6 +119,7 @@ self.cancel = path + 'actions' + sep + 'dialog-cancel.png' self.close = path + 'actions' + sep + 'dialog-close.png' self.ok = path + 'actions' + sep + 'dialog-ok.png' + self.view_refresh = path + 'actions' + sep + 'view-refresh.png' @@ -133,6 +136,7 @@ self.cancel = path + 'actions' + sep + 'dialog-cancel.png' self.forwards = path + 'actions' + sep + 'go-next-view.png' self.remove = path + 'actions' + sep + 'list-remove.png' + self.view_refresh = path + 'actions' + sep + 'view-refresh.png' # relax icons. path = ICON_RELAX_PATH + '48x48' + sep