Author: bugman Date: Wed May 16 11:30:01 2012 New Revision: 16309 URL: http://svn.gna.org/viewcvs/relax?rev=16309&view=rev Log: Created the Free_file_format.GetValue() method for returning a dict of args. This abstracts the GUI element's input fields. Modified: branches/uf_redesign/gui/components/free_file_format.py Modified: branches/uf_redesign/gui/components/free_file_format.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/components/free_file_format.py?rev=16309&r1=16308&r2=16309&view=diff ============================================================================== --- branches/uf_redesign/gui/components/free_file_format.py (original) +++ branches/uf_redesign/gui/components/free_file_format.py Wed May 16 11:30:01 2012 @@ -151,6 +151,37 @@ main_sizer.Add(button_sizer, 0, wx.ALL, 0) + def GetValue(self): + """Return the free file format settings as a keyword dictionary. + + @return: The dictionary of free file format settings. + @rtype: dict + """ + + # Initialise. + settings = {} + + # Get the column numbers. + settings['spin_id_col'] = gui_to_int(self.spin_id_col.GetValue()) + settings['mol_name_col'] = gui_to_int(self.mol_name_col.GetValue()) + settings['res_num_col'] = gui_to_int(self.res_num_col.GetValue()) + settings['res_name_col'] = gui_to_int(self.res_name_col.GetValue()) + settings['spin_num_col'] = gui_to_int(self.spin_num_col.GetValue()) + settings['spin_name_col'] = gui_to_int(self.spin_name_col.GetValue()) + if hasattr(self, 'data_col'): + settings['data_col'] = gui_to_int(self.data_col.GetValue()) + if hasattr(self, 'err_col'): + settings['err_col'] = gui_to_int(self.err_col.GetValue()) + + # The column separator. + settings['sep'] = str(self.sep.GetValue()) + if settings['sep'] == 'white space': + settings['sep'] = None + + # Return the settings. + return settings + + def reset(self, event): """Reset the free file format widget contents to the original values.