Author: bugman Date: Tue Jul 19 14:34:01 2011 New Revision: 13731 URL: http://svn.gna.org/viewcvs/relax?rev=13731&view=rev Log: Implemented all the relax_fit user function GUI pages and menu entries. Added: branches/gui_testing/gui/user_functions/relax_fit.py - copied, changed from r13706, branches/gui_testing/gui/user_functions/relax_data.py Modified: branches/gui_testing/gui/menu.py branches/gui_testing/gui/user_functions/__init__.py Modified: branches/gui_testing/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/menu.py?rev=13731&r1=13730&r2=13731&view=diff ============================================================================== --- branches/gui_testing/gui/menu.py (original) +++ branches/gui_testing/gui/menu.py Tue Jul 19 14:34:01 2011 @@ -225,6 +225,10 @@ [wx.NewId(), "&delete", paths.icon_16x16.remove, self.gui.user_functions.relax_data.delete], [wx.NewId(), "&read", paths.icon_16x16.open, self.gui.user_functions.relax_data.read] ]], + [wx.NewId(), "relax_&fit", None, None, [ + [wx.NewId(), "&relax_time", None, self.gui.user_functions.relax_fit.relax_time], + [wx.NewId(), "&select_model", None,self.gui.user_functions.relax_fit.select_model] + ]], [wx.NewId(), "resid&ue", paths.icon_16x16.residue, None, [ [wx.NewId(), "©", paths.icon_16x16.copy, self.gui.user_functions.residue.copy], [wx.NewId(), "crea&te", paths.icon_16x16.add, self.gui.user_functions.residue.create], Modified: branches/gui_testing/gui/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/__init__.py?rev=13731&r1=13730&r2=13731&view=diff ============================================================================== --- branches/gui_testing/gui/user_functions/__init__.py (original) +++ branches/gui_testing/gui/user_functions/__init__.py Tue Jul 19 14:34:01 2011 @@ -33,6 +33,7 @@ from pipes import Pipes from residue import Residue from relax_data import Relax_data +from relax_fit import Relax_fit from script import Script from select import Select from sequence import Sequence @@ -50,6 +51,7 @@ 'pipes', 'residue', 'relax_data', + 'relax_fit', 'script', 'select', 'sequence', @@ -78,6 +80,7 @@ self.pipes = Pipes(self.gui) self.residue = Residue(self.gui) self.relax_data = Relax_data(self.gui) + self.relax_fit = Relax_fit(self.gui) self.script = Script(self.gui) self.select = Select(self.gui) self.sequence = Sequence(self.gui) @@ -97,6 +100,7 @@ self.pipes.destroy() self.residue.destroy() self.relax_data.destroy() + self.relax_fit.destroy() self.select.destroy() self.sequence.destroy() self.spectrum.destroy() Copied: branches/gui_testing/gui/user_functions/relax_fit.py (from r13706, branches/gui_testing/gui/user_functions/relax_data.py) URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/user_functions/relax_fit.py?p2=branches/gui_testing/gui/user_functions/relax_fit.py&p1=branches/gui_testing/gui/user_functions/relax_data.py&r1=13706&r2=13731&rev=13731&view=diff ============================================================================== --- branches/gui_testing/gui/user_functions/relax_data.py (original) +++ branches/gui_testing/gui/user_functions/relax_fit.py Tue Jul 19 14:34:01 2011 @@ -37,146 +37,116 @@ # The container class. -class Relax_data(UF_base): +class Relax_fit(UF_base): """The container class for holding all GUI elements.""" - def delete(self, event): - """The relax_data.delete user function. + def relax_time(self, event): + """The relax_fit.relax_time user function. @param event: The wx event. @type event: wx event """ # Execute the wizard. - wizard = Wiz_window(size_x=700, size_y=400, title=self.get_title('relax_data', 'delete')) - page = Delete_page(wizard, self.gui) + wizard = Wiz_window(size_x=800, size_y=600, title=self.get_title('relax_fit', 'relax_time')) + page = Relax_time_page(wizard, self.gui) wizard.add_page(page) wizard.run() - def read(self, event): - """The relax_data.read user function. + def select_model(self, event): + """The relax_fit.select_model user function. @param event: The wx event. @type event: wx event """ # Execute the wizard. - wizard = Wiz_window(size_x=1000, size_y=800, title=self.get_title('relax_data', 'read')) - page = Read_page(wizard, self.gui) + wizard = Wiz_window(size_x=800, size_y=600, title=self.get_title('relax_fit', 'select_model')) + page = Select_model_page(wizard, self.gui) wizard.add_page(page) wizard.run() -class Delete_page(UF_page): - """The relax_data.read() user function page.""" +class Relax_time_page(UF_page): + """The relax_fit.relax_time() user function page.""" # Some class variables. - image_path = WIZARD_IMAGE_PATH + 'fid.png' - uf_path = ['relax_data', 'delete'] + uf_path = ['relax_fit', 'relax_time'] def add_contents(self, sizer): - """Add the relaxation data deletion specific GUI elements. + """Add the specific GUI elements. @param sizer: A sizer object. @type sizer: wx.Sizer instance """ - # The ID. - self.ri_id = self.combo_box(sizer, "The relaxation data ID:", tooltip=self.uf._doc_args_dict['ri_id']) + # The time. + self.time = self.input_field(sizer, "The delay time:", tooltip=self.uf._doc_args_dict['time']) + + # The spectrum ID. + self.spectrum_id = self.combo_box(sizer, "The spectrum ID:", tooltip=self.uf._doc_args_dict['spectrum_id']) + + # Spacing. + sizer.AddStretchSpacer() def on_execute(self): """Execute the user function.""" - # The labels and frq. - ri_id = gui_to_str(self.ri_id.GetValue()) + # The time. + time = gui_to_float(self.time.GetValue()) + + # The spectrum ID. + spectrum_id = gui_to_str(self.spectrum_id.GetValue()) # Read the relaxation data. - self.gui.interpreter.relax_data.delete(ri_id=ri_id) + self.gui.interpreter.relax_fit.relax_time(time=time, spectrum_id=spectrum_id) def on_display(self): - """Clear previous data and update the label lists.""" + """Clear previous data and update the spectrum ID list.""" # Clear the previous data. - self.ri_id.Clear() + self.spectrum_id.Clear() - # No data, so don't try to fill the combo boxes. - if not hasattr(cdp, 'ri_ids'): + # No data, so don't try to fill the combo box. + if not hasattr(cdp, 'spectrum_ids'): return - # The relaxation data IDs. - for i in range(len(cdp.ri_ids)): - self.ri_id.Append(cdp.ri_ids[i]) + # The spectrum IDs. + for i in range(len(cdp.spectrum_ids)): + self.spectrum_id.Append(cdp.spectrum_ids[i]) -class Read_page(UF_page): - """The relax_data.read() user function page.""" +class Select_model_page(UF_page): + """The relax_fit.select_model() user function page.""" # Some class variables. - desc_height = 180 - image_path = WIZARD_IMAGE_PATH + 'fid.png' - uf_path = ['relax_data', 'read'] + uf_path = ['relax_fit', 'select_model'] def add_contents(self, sizer): - """Add the relaxation data reading specific GUI elements. + """Add the specific GUI elements. @param sizer: A sizer object. @type sizer: wx.Sizer instance """ - # Add a file selection. - self.file = self.file_selection(sizer, "The relaxation data file:", title="Relaxation data file selection", tooltip=self.uf._doc_args_dict['file']) + # The model. + self.model = self.combo_box(sizer, "The model:", choices=['exp', 'inv'], tooltip=self.uf._doc_args_dict['model']) + self.model.SetValue('exp') - # The labels. - self.ri_id = self.input_field(sizer, "The relaxation data ID:", tooltip=self.uf._doc_args_dict['ri_id']) - self.ri_type = self.combo_box(sizer, "The relaxation data type:", choices=['R1', 'R2', 'NOE'], tooltip=self.uf._doc_args_dict['ri_type']) - - # The frequency. - self.frq = self.input_field(sizer, "The proton frequency in Hz:", tooltip=self.uf._doc_args_dict['frq']) - - # The spin ID restriction. - self.spin_id = self.spin_id_element(sizer, desc="Restrict data loading to certain spins:") - - # The parameter file settings. - self.free_file_format(sizer, data_cols=True, padding=5, spacer=0) + # Spacing. + sizer.AddStretchSpacer() def on_execute(self): """Execute the user function.""" - # The labels and frq. - ri_id = gui_to_str(self.ri_id.GetValue()) - ri_type = gui_to_str(self.ri_type.GetValue()) - frq = gui_to_float(self.frq.GetValue()) - - # The file name. - file = gui_to_str(self.file.GetValue()) - - # No file. - if not file: - return - - # Get the column numbers. - spin_id_col = gui_to_int(self.spin_id_col.GetValue()) - mol_name_col = gui_to_int(self.mol_name_col.GetValue()) - res_num_col = gui_to_int(self.res_num_col.GetValue()) - res_name_col = gui_to_int(self.res_name_col.GetValue()) - spin_num_col = gui_to_int(self.spin_num_col.GetValue()) - spin_name_col = gui_to_int(self.spin_name_col.GetValue()) - data_col = gui_to_int(self.data_col.GetValue()) - err_col = gui_to_int(self.err_col.GetValue()) - - # The column separator. - sep = str(self.sep.GetValue()) - if sep == 'white space': - sep = None - - # The spin ID. - spin_id = gui_to_str(self.spin_id.GetValue()) + # The model. + model = gui_to_str(self.model.GetValue()) # Read the relaxation data. - self.gui.interpreter.relax_data.read(ri_id=ri_id, ri_type=ri_type, frq=frq, file=file, spin_id_col=spin_id_col, mol_name_col=mol_name_col, res_num_col=res_num_col, res_name_col=res_name_col, spin_num_col=spin_num_col, spin_name_col=spin_name_col, data_col=data_col, error_col=err_col, sep=sep, spin_id=spin_id) + self.gui.interpreter.relax_fit.select_model(model=model)