Author: bugman Date: Thu Sep 5 15:39:36 2013 New Revision: 20850 URL: http://svn.gna.org/viewcvs/relax?rev=20850&view=rev Log: The spectrum list GUI element is now more robust to missing data. The cdp.spectrum_ids data structure no longer needs to exist. Modified: branches/relax_disp/gui/components/spectrum.py Modified: branches/relax_disp/gui/components/spectrum.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/gui/components/spectrum.py?rev=20850&r1=20849&r2=20850&view=diff ============================================================================== --- branches/relax_disp/gui/components/spectrum.py (original) +++ branches/relax_disp/gui/components/spectrum.py Thu Sep 5 15:39:36 2013 @@ -303,6 +303,10 @@ # Append a column. self.element.InsertColumn(index, u("\u03BDCPMG (Hz) or Spin-lock \u03BD1 (Hz)")) + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True + # Set the values. for i in range(len(cdp.spectrum_ids)): # Set the CPMG frequency. @@ -328,7 +332,10 @@ # Append a column. self.element.InsertColumn(index, u("Experiment type")) - return True + + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True # Set the values. for i in range(len(cdp.spectrum_ids)): @@ -352,12 +359,14 @@ @rtype: bool """ - # No type info. - if not hasattr(cdp, 'spectrometer_frq') or not len(cdp.spectrometer_frq): - return False - # Append a column. self.element.InsertColumn(index, u("\u03C9H (MHz)")) + + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True + if not hasattr(cdp, 'spectrometer_frq') or not len(cdp.spectrometer_frq): + return True # Set the values. for i in range(len(cdp.spectrum_ids)): @@ -394,6 +403,10 @@ 'ref': 'Reference' } + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True + # Set the values. for i in range(len(cdp.spectrum_ids)): # No value. @@ -423,6 +436,10 @@ # Append a column. self.element.InsertColumn(index, str_to_gui("Delay times (s)")) + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True + # Set the values. for i in range(len(cdp.spectrum_ids)): # No value. @@ -454,6 +471,10 @@ # Append a column. self.element.InsertColumn(index, str_to_gui("Replicate IDs")) + + # No data. + if not hasattr(cdp, 'spectrum_ids'): + return True # Set the values. for i in range(len(cdp.spectrum_ids)):