mailr13770 - /branches/gui_testing/gui/components/spectrum.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on July 20, 2011 - 11:39:
Author: bugman
Date: Wed Jul 20 11:39:07 2011
New Revision: 13770

URL: http://svn.gna.org/viewcvs/relax?rev=13770&view=rev
Log:
Replicated spectrum IDs are now shown in the spectrum list GUI element.


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=13770&r1=13769&r2=13770&view=diff
==============================================================================
--- branches/gui_testing/gui/components/spectrum.py (original)
+++ branches/gui_testing/gui/components/spectrum.py Wed Jul 20 11:39:07 2011
@@ -30,9 +30,10 @@
 
 # relax module imports.
 from status import Status; status = Status()
+from generic_fns.spectrum import replicated_flags, replicated_ids
 
 # relax GUI module imports.
-from gui.misc import add_border, float_to_gui
+from gui.misc import add_border, float_to_gui, str_to_gui
 from gui import paths
 
 
@@ -160,6 +161,10 @@
         if self.relax_times(index):
             index += 1
 
+        # The replicated spectra.
+        if self.replicates(index):
+            index += 1
+
         # Set the grid properties once finalised.
         for i in range(self.grid.GetNumberRows()):
             # Row properties.
@@ -299,6 +304,54 @@
         return True
 
 
+    def replicates(self, index):
+        """Add the replicated spectra 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, 'replicates') or not len(cdp.replicates):
+            return False
+
+        # Replicated spectra.
+        repl = replicated_flags()
+
+        # Append a column.
+        self.grid.AppendCols(numCols=1)
+
+        # Set the column heading.
+        self.grid.SetColLabelValue(index, "Replicate IDs")
+
+        # Set the values.
+        for i in range(len(cdp.spectrum_ids)):
+            # No replicates.
+            if not repl[cdp.spectrum_ids[i]]:
+                continue
+
+            # The replicated spectra.
+            id_list = replicated_ids(cdp.spectrum_ids[i])
+
+            # Convert to a string.
+            text = ''
+            for j in range(len(id_list)):
+                # Add the id.
+                text = "%s%s" % (text, id_list[j])
+
+                # Separator.
+                if j < len(id_list)-1:
+                    text = "%s, " % text
+
+            # Set the value.
+            self.grid.SetCellValue(i, index, str_to_gui(text))
+
+        # Successful.
+        return True
+
+
     def size_cols(self):
         """Set the column sizes."""
 




Related Messages


Powered by MHonArc, Updated Wed Jul 20 14:20:02 2011