Author: bugman Date: Mon Apr 30 13:15:20 2012 New Revision: 15853 URL: http://svn.gna.org/viewcvs/relax?rev=15853&view=rev Log: Created the bruker.read GUI user function page and menu entry. Added: 1.3/gui/user_functions/bruker.py - copied, changed from r15848, 1.3/gui/user_functions/relax_data.py Modified: 1.3/gui/menu.py 1.3/gui/user_functions/__init__.py Modified: 1.3/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/menu.py?rev=15853&r1=15852&r2=15853&view=diff ============================================================================== --- 1.3/gui/menu.py (original) +++ 1.3/gui/menu.py Mon Apr 30 13:15:20 2012 @@ -314,6 +314,9 @@ self.uf = {} # Build the user function menus. + id = self.add_class(name="bruker", text="&bruker", icon=paths.icon_16x16.bruker) + self.add_uf(parent_id=id, name="bruker.read", text="&read", icon=paths.icon_16x16.open, fn=user_functions.bruker.read) + id = self.add_class(name="deselect", text="&deselect", icon=None) self.add_uf(parent_id=id, name="deselect.all", text="&all", icon=None, fn=user_functions.deselect.all) self.add_uf(parent_id=id, name="deselect.read", text="&read", icon=paths.icon_16x16.open, fn=user_functions.deselect.read) Modified: 1.3/gui/user_functions/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/__init__.py?rev=15853&r1=15852&r2=15853&view=diff ============================================================================== --- 1.3/gui/user_functions/__init__.py (original) +++ 1.3/gui/user_functions/__init__.py Mon Apr 30 13:15:20 2012 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2010-2011 Edward d'Auvergne # +# Copyright (C) 2010-2012 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -27,6 +27,7 @@ from relax_errors import RelaxError # GUI module imports. +from bruker import Bruker from deselect import Deselect from gpl import Gpl from grace import Grace @@ -51,6 +52,7 @@ # The package __all__ list. __all__ = ['base', + 'bruker', 'deselect', 'gpl', 'grace', @@ -87,6 +89,7 @@ """ # The user functions. + self.bruker = Bruker(parent) self.deselect = Deselect(parent) self.gpl = Gpl(parent) self.grace = Grace(parent) Copied: 1.3/gui/user_functions/bruker.py (from r15848, 1.3/gui/user_functions/relax_data.py) URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/bruker.py?p2=1.3/gui/user_functions/bruker.py&p1=1.3/gui/user_functions/relax_data.py&r1=15848&r2=15853&rev=15853&view=diff ============================================================================== --- 1.3/gui/user_functions/relax_data.py (original) +++ 1.3/gui/user_functions/bruker.py Mon Apr 30 13:15:20 2012 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2010-2011 Edward d'Auvergne # +# Copyright (C) 2010-2012 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -21,7 +21,7 @@ ############################################################################### # Module docstring. -"""The relaxation data user function GUI elements.""" +"""The Bruker Dynamics Center user function GUI elements.""" # Python module imports. from string import split @@ -37,52 +37,38 @@ # The container class. -class Relax_data(UF_base): +class Bruker(UF_base): """The container class for holding all GUI elements.""" - def delete(self, ri_id=None): - """The relax_data.delete user function. - - @keyword ri_id: The starting relaxation data ID string. - @type ri_id: str - """ - - # Create the wizard. - wizard, page = self.create_wizard(size_x=700, size_y=400, name='relax_data.delete', uf_page=Delete_page, return_page=True) - - # Default ID. - if ri_id: - page.ri_id.SetValue(str_to_gui(ri_id)) + def read(self): + """The bruker.read user function.""" # Execute the wizard. - wizard.run() - - - def read(self): - """The relax_data.read user function.""" - - # Execute the wizard. - wizard = self.create_wizard(size_x=1000, size_y=700, name='relax_data.read', uf_page=Read_page) + wizard = self.create_wizard(size_x=800, size_y=500, name='bruker.read', uf_page=Read_page) wizard.run() -class Delete_page(UF_page): - """The relax_data.read() user function page.""" +class Read_page(UF_page): + """The bruker.read() user function page.""" # Some class variables. - image_path = WIZARD_IMAGE_PATH + 'fid.png' - uf_path = ['relax_data', 'delete'] + height_desc = 140 + image_path = WIZARD_IMAGE_PATH + 'bruker.png' + uf_path = ['bruker', 'read'] def add_contents(self, sizer): - """Add the relaxation data deletion specific GUI elements. + """Add the Bruker Dynamics Center reading 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']) + # Add a file selection. + self.file = self.file_selection(sizer, "The Bruker Dynamics Center file:", message="Bruker Dynamics Center file selection", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file']) + + # The labels. + self.ri_id = self.input_field(sizer, "The relaxation data ID:", tooltip=self.uf._doc_args_dict['ri_id']) def on_execute(self): @@ -91,66 +77,6 @@ # The labels and frq. ri_id = gui_to_str(self.ri_id.GetValue()) - # Read the relaxation data. - self.execute('relax_data.delete', ri_id=ri_id) - - - def on_display(self): - """Clear previous data and update the label lists.""" - - # Clear the previous data. - self.ri_id.Clear() - - # No data, so don't try to fill the combo boxes. - if not hasattr(cdp, 'ri_ids'): - return - - # The relaxation data IDs. - for i in range(len(cdp.ri_ids)): - self.ri_id.Append(str_to_gui(cdp.ri_ids[i])) - - - -class Read_page(UF_page): - """The relax_data.read() user function page.""" - - # Some class variables. - height_desc = 140 - image_path = WIZARD_IMAGE_PATH + 'fid.png' - uf_path = ['relax_data', 'read'] - - def add_contents(self, sizer): - """Add the relaxation data reading 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:", message="Relaxation data file selection", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file']) - - # 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 exact spectrometer 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=3, spacer=0) - - - 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()) @@ -158,23 +84,5 @@ 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()) - - # Read the relaxation data. - self.execute('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) + # Read the Bruker data. + self.execute('bruker.read', ri_id=ri_id, file=file)