mailr19553 - /trunk/gui/wizards/peak_intensity.py


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

Header


Content

Posted by edward on April 21, 2013 - 18:46:
Author: bugman
Date: Sun Apr 21 18:46:12 2013
New Revision: 19553

URL: http://svn.gna.org/viewcvs/relax?rev=19553&view=rev
Log:
Simplified all of the peak analysis wizard wizard_update_*() methods.

They now all defer to the wizard_update_ids() method which updates the 
spectrum ID fields.


Modified:
    trunk/gui/wizards/peak_intensity.py

Modified: trunk/gui/wizards/peak_intensity.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/wizards/peak_intensity.py?rev=19553&r1=19552&r2=19553&view=diff
==============================================================================
--- trunk/gui/wizards/peak_intensity.py (original)
+++ trunk/gui/wizards/peak_intensity.py Sun Apr 21 18:46:12 2013
@@ -219,60 +219,57 @@
         page.uf_args['spectrum_id'].SetValue(id)
 
 
+    def wizard_update_ids(self, page_key=None, arg_key='spectrum_id', 
index=None):
+        """Update the spectrum ID on the page specified by the key based on 
previous data.
+
+        @keyword page_key:  The key of the page to update.
+        @type page_key:     str
+        @keyword arg_key:   The key of the page argument to change to the 
spectrum ID.
+        @type arg_key:      str
+        @keyword index:     The index for list type structures.
+        @type index:        None or int
+        """
+
+        # The spectrum.read_intensities page.
+        page = self.get_page(self.page_indices['read'])
+
+        # Set the spectrum ID.
+        id = page.uf_args['spectrum_id'].GetValue()
+
+        # Set the ID in the page.
+        page = self.get_page(self.page_indices[page_key])
+        if index == None:
+            page.uf_args[arg_key].SetValue(id)
+        else:
+            page.uf_args[arg_key].SetValue(value=id, index=index)
+
+
     def wizard_update_pts(self):
         """Update the spectrum.replicated page based on previous data."""
 
-        # The spectrum.read_intensities page.
-        page = self.get_page(self.page_indices['read'])
-
-        # Set the spectrum ID.
-        id = page.uf_args['spectrum_id'].GetValue()
-
-        # Set the ID in the spectrum.replicated page.
-        page = self.get_page(self.page_indices['pts'])
-        page.uf_args['spectrum_id'].SetValue(id)
+        # Update the spectrum ID.
+        self.wizard_update_ids(page_key='pts')
 
 
     def wizard_update_relax_fit_relax_time(self):
         """Update the relax_fit.relax_time page based on previous data."""
 
-        # The spectrum.read_intensities page.
-        page = self.get_page(self.page_indices['read'])
-
-        # Set the spectrum ID.
-        id = page.uf_args['spectrum_id'].GetValue()
-
-        # Set the ID in the relax_fit.relax_time page.
-        page = self.get_page(self.page_indices['relax_time'])
-        page.uf_args['spectrum_id'].SetValue(id)
+        # Update the spectrum ID.
+        self.wizard_update_ids(page_key='relax_time')
 
 
     def wizard_update_repl(self):
         """Update the spectrum.replicated page based on previous data."""
 
-        # The spectrum.read_intensities page.
-        page = self.get_page(self.page_indices['read'])
-
-        # Set the spectrum ID.
-        id = page.uf_args['spectrum_id'].GetValue()
-
-        # Set the ID in the spectrum.replicated page.
-        page = self.get_page(self.page_indices['repl'])
-        page.uf_args['spectrum_ids'].SetValue(value=id, index=0)
+        # Update the spectrum ID.
+        self.wizard_update_ids(page_key='repl', arg_key='spectrum_ids', 
index=0)
 
 
     def wizard_update_rmsd(self):
         """Update the spectrum.baseplane_rmsd page based on previous data."""
 
-        # The spectrum.read_intensities page.
-        page = self.get_page(self.page_indices['read'])
-
-        # Set the spectrum ID.
-        id = page.uf_args['spectrum_id'].GetValue()
-
-        # Set the ID in the spectrum.baseplane_rmsd page.
-        page = self.get_page(self.page_indices['rmsd'])
-        page.uf_args['spectrum_id'].SetValue(id)
+        # Update the spectrum ID.
+        self.wizard_update_ids(page_key='rmsd')
 
 
 




Related Messages


Powered by MHonArc, Updated Sun Apr 21 19:00:02 2013