Author: bugman Date: Wed Jul 20 11:05:32 2011 New Revision: 13766 URL: http://svn.gna.org/viewcvs/relax?rev=13766&view=rev Log: The spectrum list GUI element now displays relaxation delay times if set. Modified: branches/gui_testing/gui/components/spectrum.py Modified: branches/gui_testing/gui/components/spectrum.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/components/spectrum.py?rev=13766&r1=13765&r2=13766&view=diff ============================================================================== --- branches/gui_testing/gui/components/spectrum.py (original) +++ branches/gui_testing/gui/components/spectrum.py Wed Jul 20 11:05:32 2011 @@ -32,7 +32,7 @@ from status import Status; status = Status() # relax GUI module imports. -from gui.misc import add_border +from gui.misc import add_border, float_to_gui from gui import paths @@ -156,6 +156,10 @@ if self.noe_spectrum_type(index): index += 1 + # The relaxation times. + if self.relax_times(index): + index += 1 + # Set the grid properties once finalised. for i in range(self.grid.GetNumberRows()): # Row properties. @@ -264,6 +268,35 @@ flag = True + def relax_times(self, index): + """Add the relaxation delay time info to the grid. + + @param index: The column index for the data. + @type index: int + @return: True if relaxation times exist, False otherwise. + @rtype: bool + """ + + # No type info. + if not hasattr(cdp, 'relax_times') or not len(cdp.relax_times): + return False + + # Append a column. + self.grid.AppendCols(numCols=1) + + # Set the column heading. + self.grid.SetColLabelValue(index, "Delay times") + + # Set the values. + for i in range(len(cdp.spectrum_ids)): + # No value. + if cdp.spectrum_ids[i] not in cdp.relax_times.keys(): + continue + + # Set the value. + self.grid.SetCellValue(i, index, float_to_gui(cdp.relax_times[cdp.spectrum_ids[i]])) + + def size_cols(self): """Set the column sizes."""