mailr15776 - /1.3/gui/analyses/__init__.py


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

Header


Content

Posted by edward on April 17, 2012 - 20:08:
Author: bugman
Date: Tue Apr 17 20:08:34 2012
New Revision: 15776

URL: http://svn.gna.org/viewcvs/relax?rev=15776&view=rev
Log:
The relax GUI is now robust and able to withstand a call to the reset user 
function.

This could have occurred if the user ran a script with a reset() call, or if 
reset() was typed at
the GUI version of the relax prompt.


Modified:
    1.3/gui/analyses/__init__.py

Modified: 1.3/gui/analyses/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/__init__.py?rev=15776&r1=15775&r2=15776&view=diff
==============================================================================
--- 1.3/gui/analyses/__init__.py (original)
+++ 1.3/gui/analyses/__init__.py Tue Apr 17 20:08:34 2012
@@ -31,6 +31,7 @@
 
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
+from data.gui import Gui
 import dep_check
 from generic_fns import pipes
 from status import Status; status = Status()
@@ -529,6 +530,10 @@
         # The index.
         self._current = event.GetSelection()
 
+        # Handel calls to the reset user function!
+        if not hasattr(ds, 'relax_gui'):
+            return
+
         # Switch to the major data pipe of that page if not the current one.
         if self._switch_flag and pipes.cdp_name() != 
ds.relax_gui.analyses[self._current].pipe_name:
             self.gui.interpreter.apply('pipe.switch', 
ds.relax_gui.analyses[self._current].pipe_name)
@@ -636,7 +641,8 @@
             index = self._num_analyses - 1
 
             # Delete the tab.
-            self.notebook.DeletePage(index)
+            if hasattr(self, 'notebook'):
+                self.notebook.DeletePage(index)
 
             # Delete the tab object.
             self._analyses.pop(index)
@@ -660,7 +666,12 @@
         old_sizer.DeleteWindows()
 
         # Delete the notebook.
-        del self.notebook
+        if hasattr(self, 'notebook'):
+            del self.notebook
+
+        # Recreate the GUI data store object (needed if the reset user 
function is called).
+        if not hasattr(ds, 'relax_gui'):
+            ds.relax_gui = Gui()
 
         # Recreate the start screen.
         self.gui.add_start_screen()




Related Messages


Powered by MHonArc, Updated Tue Apr 17 20:20:13 2012