mailr14569 - in /1.3/gui: analyses/auto_rx_base.py user_functions/spectrum.py


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

Header


Content

Posted by edward on September 02, 2011 - 10:44:
Author: bugman
Date: Fri Sep  2 10:44:20 2011
New Revision: 14569

URL: http://svn.gna.org/viewcvs/relax?rev=14569&view=rev
Log:
Fixes for the spectrum.replicated user function GUI page for when the apply 
button is hit.

The spectrum IDs were continually appended to the ID boxes, so the lists 
could get quite long.


Modified:
    1.3/gui/analyses/auto_rx_base.py
    1.3/gui/user_functions/spectrum.py

Modified: 1.3/gui/analyses/auto_rx_base.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/auto_rx_base.py?rev=14569&r1=14568&r2=14569&view=diff
==============================================================================
--- 1.3/gui/analyses/auto_rx_base.py (original)
+++ 1.3/gui/analyses/auto_rx_base.py Fri Sep  2 10:44:20 2011
@@ -456,7 +456,7 @@
 
         # Set the ID in the spectrum.replicated page.
         page = self.wizard.get_page(self.page_indices['pts'])
-        page.spectrum_id1.SetValue(str_to_gui(id))
+        page.spectrum_id_boxes[0].SetValue(str_to_gui(id))
 
 
     def wizard_update_repl(self):
@@ -470,7 +470,7 @@
 
         # Set the ID in the spectrum.replicated page.
         page = self.wizard.get_page(self.page_indices['repl'])
-        page.spectrum_id1.SetValue(str_to_gui(id))
+        page.spectrum_id_boxes[0].SetValue(str_to_gui(id))
 
 
     def wizard_update_rmsd(self):

Modified: 1.3/gui/user_functions/spectrum.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/spectrum.py?rev=14569&r1=14568&r2=14569&view=diff
==============================================================================
--- 1.3/gui/user_functions/spectrum.py (original)
+++ 1.3/gui/user_functions/spectrum.py Fri Sep  2 10:44:20 2011
@@ -318,42 +318,40 @@
         """
 
         # The spectrum IDs.
-        self.spectrum_id1 = self.combo_box(sizer, "The 1st spectrum ID:", 
tooltip="The ID string of the first of the replicated spectra.")
-        self.spectrum_id2 = self.combo_box(sizer, "The 2nd spectrum ID:", 
tooltip="The ID string of the second spectrum which is a replicate of the 
first spectrum.")
-        self.spectrum_id3 = self.combo_box(sizer, "The 3rd spectrum ID:", 
tooltip="The ID string of the third spectrum which is a replicate of the 
first spectrum.")
-        self.spectrum_id4 = self.combo_box(sizer, "The 4th spectrum ID:", 
tooltip="The ID string of the fourth spectrum which is a replicate of the 
first spectrum.")
-        self.spectrum_id5 = self.combo_box(sizer, "The 5th spectrum ID:", 
tooltip="The ID string of the fifth spectrum which is a replicate of the 
first spectrum.")
+        self.spectrum_id_boxes = []
+        self.spectrum_id_boxes.append(self.combo_box(sizer, "The 1st 
spectrum ID:", tooltip="The ID string of the first of the replicated 
spectra."))
+        self.spectrum_id_boxes.append(self.combo_box(sizer, "The 2nd 
spectrum ID:", tooltip="The ID string of the second spectrum which is a 
replicate of the first spectrum."))
+        self.spectrum_id_boxes.append(self.combo_box(sizer, "The 3rd 
spectrum ID:", tooltip="The ID string of the third spectrum which is a 
replicate of the first spectrum."))
+        self.spectrum_id_boxes.append(self.combo_box(sizer, "The 4th 
spectrum ID:", tooltip="The ID string of the fourth spectrum which is a 
replicate of the first spectrum."))
+        self.spectrum_id_boxes.append(self.combo_box(sizer, "The 5th 
spectrum ID:", tooltip="The ID string of the fifth spectrum which is a 
replicate of the first spectrum."))
 
 
     def on_display(self):
         """Update the UI."""
 
-        # Set the spectrum ID names.
-        if hasattr(cdp, 'spectrum_ids'):
-            for id in cdp.spectrum_ids:
-                self.spectrum_id1.Append(str_to_gui(id))
-                self.spectrum_id2.Append(str_to_gui(id))
-                self.spectrum_id3.Append(str_to_gui(id))
-                self.spectrum_id4.Append(str_to_gui(id))
-                self.spectrum_id5.Append(str_to_gui(id))
-
-
-    def on_execute(self):
-        """Execute the user function."""
-
-        # Get the values.
-        val = []
-        val.append(gui_to_str(self.spectrum_id1.GetValue()))
-        val.append(gui_to_str(self.spectrum_id2.GetValue()))
-        val.append(gui_to_str(self.spectrum_id3.GetValue()))
-        val.append(gui_to_str(self.spectrum_id4.GetValue()))
-        val.append(gui_to_str(self.spectrum_id5.GetValue()))
-
-        # The ID list.
+        # Loop over each box.
+        for i in range(len(self.spectrum_id_boxes)):
+            # First clear all data.
+            self.spectrum_id_boxes[i].Clear()
+
+            # Set the spectrum ID names.
+            if hasattr(cdp, 'spectrum_ids'):
+                for id in cdp.spectrum_ids:
+                    self.spectrum_id_boxes[i].Append(str_to_gui(id))
+
+
+    def on_execute(self):
+        """Execute the user function."""
+
+        # Loop over each box.
         spectrum_ids = []
-        for i in range(len(val)):
-            if val[i] != None:
-                spectrum_ids.append(val[i])
+        for i in range(len(self.spectrum_id_boxes)):
+            # Get the value.
+            val = gui_to_str(self.spectrum_id_boxes[i].GetValue())
+
+            # Add the value to the list if not None.
+            if val != None:
+                spectrum_ids.append(val)
 
         # Execute (only if more than one ID is given).
         if len(spectrum_ids) > 1:




Related Messages


Powered by MHonArc, Updated Fri Sep 02 11:20:02 2011