Author: bugman Date: Wed Jun 15 17:07:29 2011 New Revision: 13048 URL: http://svn.gna.org/viewcvs/relax?rev=13048&view=rev Log: Added a new menu entry 'File->Close analysis' which will close the currently selected analysis. The notebook tab, analysis object, and data store object are all deleted. Modified: branches/gui_testing/gui/menu.py branches/gui_testing/gui/relax_gui.py Modified: branches/gui_testing/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/menu.py?rev=13048&r1=13047&r2=13048&view=diff ============================================================================== --- branches/gui_testing/gui/menu.py (original) +++ branches/gui_testing/gui/menu.py Wed Jun 15 17:07:29 2011 @@ -50,6 +50,7 @@ # The 'File' menu entries. menu = wx.Menu() menu.AppendItem(self.build_menu_item(menu, id=1, text="&New analysis\tCtrl+N", icon=paths.icon_16x16.new)) + menu.AppendItem(self.build_menu_item(menu, id=6, text="&Close analysis", icon=paths.icon_16x16.document_close)) menu.AppendSeparator() menu.AppendItem(self.build_menu_item(menu, id=2, text="&Open relax state\tCtrl+O", icon=paths.icon_16x16.open)) menu.AppendItem(self.build_menu_item(menu, id=3, text="S&ave relax state\tCtrl+S", icon=paths.icon_16x16.save)) @@ -60,6 +61,7 @@ # The 'File' menu actions. self.gui.Bind(wx.EVT_MENU, self.gui.new, id=1) + self.gui.Bind(wx.EVT_MENU, self.gui.close_analysis, id=6) self.gui.Bind(wx.EVT_MENU, self.gui.state_load, id=2) self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save, id=3) self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save_as, id=4) Modified: branches/gui_testing/gui/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=13048&r1=13047&r2=13048&view=diff ============================================================================== --- branches/gui_testing/gui/relax_gui.py (original) +++ branches/gui_testing/gui/relax_gui.py Wed Jun 15 17:07:29 2011 @@ -225,6 +225,25 @@ sizer.AddStretchSpacer() + def close_analysis(self, event): + """Close the currently opened analysis. + + @param event: The wx event. + @type event: wx event + """ + + # Get the current analysis index. + index = self.notebook.GetSelection() + + # Ask if this should be done. + msg = "Are you sure you would like to close the current %s analysis tab?" % ds.relax_gui.analyses[index].analysis_type + if not question(msg, default=False): + return + + # Delete. + self.delete_analysis(index) + + def contact_relax(self, event): """Write an email to the relax mailing-list using the standard mailing program.""" webbrowser.open_new('mailto:relax-users@xxxxxxx')