mailr13288 - in /branches/gui_testing/gui/analyses: __init__.py results.py


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

Header


Content

Posted by edward on June 29, 2011 - 14:17:
Author: bugman
Date: Wed Jun 29 14:17:44 2011
New Revision: 13288

URL: http://svn.gna.org/viewcvs/relax?rev=13288&view=rev
Log:
Create the new Analysis_controller.get_page_from_name() method for returning 
an analysis page.

This is used by the results viewer to obtain the corresponding page.


Modified:
    branches/gui_testing/gui/analyses/__init__.py
    branches/gui_testing/gui/analyses/results.py

Modified: branches/gui_testing/gui/analyses/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/__init__.py?rev=13288&r1=13287&r2=13288&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/__init__.py (original)
+++ branches/gui_testing/gui/analyses/__init__.py Wed Jun 29 14:17:44 2011
@@ -119,6 +119,29 @@
 
             # Recreate the start screen.
             self.add_start_screen()
+
+
+    def get_page_from_name(self, name):
+        """Return the page corresponding to the given name.
+
+        @return:    The page which matches the given name, or nothing 
otherwise.
+        @rtype:     wx.Frame object or None
+        """
+
+        # Determine the analysis index.
+        found = False
+        for index in range(len(ds.relax_gui.analyses)):
+            # Match.
+            if name == ds.relax_gui.analyses[index].analysis_name:
+                found = True
+                break
+
+        # No analysis found, so return nothing.
+        if not found:
+            return
+
+        # Return the analysis page.
+        return ds.relax_gui.analyses[index]
 
 
     def load_from_store(self):

Modified: branches/gui_testing/gui/analyses/results.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/results.py?rev=13288&r1=13287&r2=13288&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/results.py (original)
+++ branches/gui_testing/gui/analyses/results.py Wed Jun 29 14:17:44 2011
@@ -167,28 +167,16 @@
         # Clear the list.
         self.list.Clear()
 
-        # Determine the analysis index.
-        found = False
-        for index in range(len(ds.relax_gui.analyses)):
-            # Match.
-            if gui_to_str(self.analysis_list.GetValue()) == 
ds.relax_gui.analyses[index].analysis_name:
-                found = True
-                break
-
-        # No analysis chosen.
-        if not found:
+        # Get the page corresponding to the choice.
+        page = 
self.gui.analysis.get_page_from_name(gui_to_str(self.analysis_list.GetValue()))
+
+        # Nothing to do.
+        if not hasattr(page, 'results_list'):
             return
 
-        # Alias.
-        data = ds.relax_gui.analyses[index]
-
-        # Nothing to do.
-        if not hasattr(data, 'results_list'):
-            return
-
         # Update the list.
-        for i in range(len(data.results_list)):
-            self.list.Append(str_to_gui(data.results_list[i]))
+        for i in range(len(page.results_list)):
+            self.list.Append(str_to_gui(page.results_list[i]))
 
 
     def open_result_file(self, event):




Related Messages


Powered by MHonArc, Updated Wed Jun 29 14:40:03 2011