mailr13576 - in /branches/gui_testing/gui/analyses: __init__.py auto_noe.py auto_rx_base.py base.py


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

Header


Content

Posted by edward on July 13, 2011 - 11:09:
Author: bugman
Date: Wed Jul 13 11:09:30 2011
New Revision: 13576

URL: http://svn.gna.org/viewcvs/relax?rev=13576&view=rev
Log:
Better handling for the failure of auto analysis page setup.

This should now be more logical and appear to do nothing if failure occurs.


Modified:
    branches/gui_testing/gui/analyses/__init__.py
    branches/gui_testing/gui/analyses/auto_noe.py
    branches/gui_testing/gui/analyses/auto_rx_base.py
    branches/gui_testing/gui/analyses/base.py

Modified: branches/gui_testing/gui/analyses/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/__init__.py?rev=13576&r1=13575&r2=13576&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/__init__.py (original)
+++ branches/gui_testing/gui/analyses/__init__.py Wed Jul 13 11:09:30 2011
@@ -166,17 +166,7 @@
 
         # No more analyses, so in the initial state.
         if self._num_analyses == 0:
-            # Reset the flag.
-            self.init_state = True
-            self._current = None
-
-            # Delete the previous sizer.
-            old_sizer = self.gui.GetSizer()
-            old_sizer.DeleteWindows()
-
-            # Recreate the start screen.
-            self.gui.add_start_screen()
-
+            self.set_init_state()
 
     def get_page_from_name(self, name):
         """Return the page corresponding to the given name.
@@ -316,9 +306,6 @@
             self.gui.SetSizer(sizer)
             sizer.Layout()
 
-            # Set the flag.
-            self.init_state = False
-
         # The analysis classes.
         classes = {'noe': Auto_noe,
                    'r1':  Auto_r1,
@@ -333,7 +320,19 @@
         analysis = classes[analysis_type]
 
         # Initialise the class and append it to the analysis window object.
-        self._analyses.append(analysis(gui=self.gui, notebook=self.notebook, 
analysis_name=analysis_name, pipe_name=pipe_name, data_index=index))
+        obj = analysis(gui=self.gui, notebook=self.notebook, 
analysis_name=analysis_name, pipe_name=pipe_name, data_index=index)
+
+        # Failure.
+        if not obj.init_flag:
+            # Reset.
+            if self.init_state:
+                self.set_init_state()
+
+            # Stop operation.
+            return
+
+        # Append the class object to the analysis window object.
+        self._analyses.append(obj)
 
         # Add to the notebook.
         self.notebook.AddPage(self._analyses[-1].parent, analysis_name)
@@ -346,6 +345,9 @@
 
         # Switch to the new page.
         self.notebook.SetSelection(self._current)
+
+        # Set the initialisation flag.
+        self.init_state = False
 
         # Reset the main window layout.
         self.gui.Layout()
@@ -371,6 +373,21 @@
         event.Skip()
 
 
+    def set_init_state(self):
+        """Revert to the initial state."""
+
+        # Reset the flag.
+        self.init_state = True
+        self._current = None
+
+        # Delete the previous sizer.
+        old_sizer = self.gui.GetSizer()
+        old_sizer.DeleteWindows()
+
+        # Recreate the start screen.
+        self.gui.add_start_screen()
+
+
     def show_results_viewer(self, event):
         """Display the analysis results.
 

Modified: branches/gui_testing/gui/analyses/auto_noe.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_noe.py?rev=13576&r1=13575&r2=13576&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/auto_noe.py (original)
+++ branches/gui_testing/gui/analyses/auto_noe.py Wed Jul 13 11:09:30 2011
@@ -80,11 +80,15 @@
         # Store the main class.
         self.gui = gui
 
+        # Init.
+        self.init_flag = True
+
         # New data container.
         if data_index == None:
             # First create the data pipe (if this fails, then no data is set 
up).
             status = 
protected_exec(self.gui.user_functions.interpreter.pipe.create, pipe_name, 
'noe')
             if not status:
+                self.init_flag = False
                 return
 
             # Generate a storage container in the relax data store, and 
alias it for easy access.

Modified: branches/gui_testing/gui/analyses/auto_rx_base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/auto_rx_base.py?rev=13576&r1=13575&r2=13576&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/auto_rx_base.py (original)
+++ branches/gui_testing/gui/analyses/auto_rx_base.py Wed Jul 13 11:09:30 2011
@@ -78,11 +78,15 @@
         # Store the main class.
         self.gui = gui
 
+        # Init.
+        self.init_flag = True
+
         # New data container.
         if data_index == None:
             # First create the data pipe (if this fails, then no data is set 
up).
             status = 
protected_exec(self.gui.user_functions.interpreter.pipe.create, pipe_name, 
'relax_fit')
             if not status:
+                self.init_flag = False
                 return
 
             # Generate a storage container in the relax data store, and 
alias it for easy access.

Modified: branches/gui_testing/gui/analyses/base.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/base.py?rev=13576&r1=13575&r2=13576&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/base.py (original)
+++ branches/gui_testing/gui/analyses/base.py Wed Jul 13 11:09:30 2011
@@ -30,6 +30,7 @@
 
 # relax module imports.
 from generic_fns.mol_res_spin import count_spins
+from generic_fns.pipes import cdp_name
 
 # relax GUI module imports.
 from gui import paths
@@ -480,8 +481,14 @@
         @rtype:     str
         """
 
+        # The data pipe.
+        if hasattr(self.data, 'pipe_name'):
+            pipe = self.data.pipe_name
+        else:
+            pipe = cdp_name()
+
         # The count.
-        num = count_spins()
+        num = count_spins(pipe=pipe)
 
         # Return the formatted string.
         return "%s spins loaded and selected" % num




Related Messages


Powered by MHonArc, Updated Wed Jul 13 12:00:03 2011