Author: bugman Date: Sun Apr 21 12:48:55 2013 New Revision: 19528 URL: http://svn.gna.org/viewcvs/relax?rev=19528&view=rev Log: The relax_disp.exp_type user function has been shifted to the new analysis wizard. Instead of being one of the elements on the relaxation dispersion analysis frame, it is now placed between the analysis selection page and the data pipe page of the new analysis wizard. The user function execution is delayed until the set up of the frame, just after the execution of the pipe.create user function. This will allow the frame to be set up differently for each experiment type. Modified: branches/relax_disp/gui/analyses/auto_relax_disp.py branches/relax_disp/gui/analyses/wizard.py Modified: branches/relax_disp/gui/analyses/auto_relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/gui/analyses/auto_relax_disp.py?rev=19528&r1=19527&r2=19528&view=diff ============================================================================== --- branches/relax_disp/gui/analyses/auto_relax_disp.py (original) +++ branches/relax_disp/gui/analyses/auto_relax_disp.py Sun Apr 21 12:48:55 2013 @@ -55,7 +55,7 @@ bitmap = paths.ANALYSIS_IMAGE_PATH+"relax_disp_200x200.png" label = 'Relax-disp' - def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, data_index=None): + def __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=524288, name='scrolledpanel', gui=None, analysis_name=None, pipe_name=None, pipe_bundle=None, uf_exec=[], data_index=None): """Build the automatic R1 and R2 analysis GUI frame elements. @param parent: The parent wx element. @@ -78,6 +78,8 @@ @type pipe_name: str @keyword pipe_bundle: The name of the data pipe bundle associated with this analysis. @type pipe_bundle: str + @keyword uf_exec: The list of user function on_execute methods returned from the new analysis wizard. + @type uf_exec: list of methods @keyword data_index: The index of the analysis in the relax data store (set to None if no data currently exists). @type data_index: None or int """ @@ -97,6 +99,10 @@ # Create the data pipe bundle if needed. if not has_bundle(pipe_bundle): self.gui.interpreter.apply('pipe.bundle', bundle=pipe_bundle, pipe=pipe_name) + + # Set up the experiment. + if not hasattr(cdp, 'exp_type'): + uf_exec[0](force_exec=True) # Generate a storage container in the relax data store, and alias it for easy access. data_index = ds.relax_gui.analyses.add(self.label) @@ -189,6 +195,14 @@ # Add the frame title. self.add_title(box, "Setup for the relaxation dispersion analysis") + # Display the experiment type. + table = { + "cpmg": "CPMG", + "cpmg fixed": "CPMG, fixed relaxation time period", + "r1rho": "R1rho" + } + Text_ctrl(box, self, text="Experiment type:", default=table[cdp.exp_type], tooltip="The relaxation dispersion experiment type.", editable=False, width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) + # Display the data pipe. Text_ctrl(box, self, text="The data pipe bundle:", default=self.data.pipe_bundle, tooltip="This is the data pipe bundle associated with this analysis.", editable=False, width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) @@ -197,9 +211,6 @@ # Add the spin GUI element. self.add_spin_systems(box, self) - - # Add the relax_disp.exp_type user function GUI element. - self.field_exp_type = Text_ctrl(box, self, text="Experiment type:", icon=fetch_icon("oxygen.actions.edit-rename", "16x16"), tooltip="Select the type of relaxation dispersion experiment run.", fn=self.relax_disp_exp_type, button=True, editable=False, width_text=self.width_text, width_button=self.width_button, spacer=self.spacer_horizontal) # Add the peak list selection GUI element, with spacing. box.AddSpacer(20) Modified: branches/relax_disp/gui/analyses/wizard.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/gui/analyses/wizard.py?rev=19528&r1=19527&r2=19528&view=diff ============================================================================== --- branches/relax_disp/gui/analyses/wizard.py (original) +++ branches/relax_disp/gui/analyses/wizard.py Sun Apr 21 12:48:55 2013 @@ -28,12 +28,13 @@ import wx from wx.lib import buttons -# relax GUI module imports. +# relax module imports. from gui import paths from gui.fonts import font from gui.input_elements.value import Value from gui.misc import bitmap_setup from gui.string_conv import gui_to_str, str_to_gui +from gui.uf_objects import Uf_storage; uf_store = Uf_storage() from gui.wizard import Wiz_page, Wiz_window @@ -60,6 +61,11 @@ # Add the new analysis panel. self.new_page = New_analysis_page(self.wizard) self.wizard.add_page(self.new_page, apply_button=False) + self.wizard.set_seq_next_fn(0, self.wizard_page_after_analysis) + + # The relax_disp.exp_type page. + self.relax_disp_page = uf_store['relax_disp.exp_type'].create_page(self.wizard, sync=True, execute=False) + self.wizard.add_page(self.relax_disp_page, apply_button=False) # Add the data pipe name panel. self.pipe_page = Data_pipe_page(self.wizard, height_desc=400) @@ -93,9 +99,30 @@ # The user function on_execute methods. uf_exec = [] + if analysis_name == 'Relaxation dispersion': + uf_exec.append(self.relax_disp_page.on_execute) # Return it. return analysis_type, analysis_name, pipe_name, pipe_bundle, uf_exec + + + def wizard_page_after_analysis(self): + """Set the page after the data pipe setup. + + @return: The index of the next page, which is the current page index plus one. + @rtype: int + """ + + # The selected analysis. + analysis_name = gui_to_str(self.new_page.analysis_name.GetValue()) + + # Go to the relax_disp.exp_type page. + if analysis_name == 'Relaxation dispersion': + return 1 + + # Otherwise go to the pipe setup. + else: + return 2