mailr17798 - in /trunk: generic_fns/reset.py gui/controller.py gui/relax_gui.py test_suite/gui_tests/base_classes.py


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

Header


Content

Posted by edward on October 12, 2012 - 11:48:
Author: bugman
Date: Fri Oct 12 11:48:22 2012
New Revision: 17798

URL: http://svn.gna.org/viewcvs/relax?rev=17798&view=rev
Log:
Redesigned the reset user function backend.

This now no only clears out the relax data store, but it also resets the GUI 
if present.  Some of
the reset code comes from the tearDown() method of the GUI tests.  All 
windows but the main GUI
window are closed and the relax controller gauges are set to zero and the log 
window text cleared.

These changes should allow GUI tests after an error or failure to pass, 
something which is currently
problematic.


Modified:
    trunk/generic_fns/reset.py
    trunk/gui/controller.py
    trunk/gui/relax_gui.py
    trunk/test_suite/gui_tests/base_classes.py

Modified: trunk/generic_fns/reset.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/reset.py?rev=17798&r1=17797&r2=17798&view=diff
==============================================================================
--- trunk/generic_fns/reset.py (original)
+++ trunk/generic_fns/reset.py Fri Oct 12 11:48:22 2012
@@ -19,6 +19,13 @@
 #                                                                            
 #
 
###############################################################################
 
+# Dependencies.
+import dep_check
+
+# Python module imports.
+if dep_check.wx_module:
+    import wx
+
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
 
@@ -28,3 +35,15 @@
 
     # Run the relax data storage object reset method.
     ds.__reset__()
+
+    # Clean up and reset the GUI.
+    if dep_check.wx_module:
+        # The wx application.
+        app = wx.GetApp()
+
+        # Nothing to do.
+        if app == None or not hasattr(app, 'gui'):
+            return
+
+        # Call the GUI reset.
+        app.gui.reset()

Modified: trunk/gui/controller.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/controller.py?rev=17798&r1=17797&r2=17798&view=diff
==============================================================================
--- trunk/gui/controller.py (original)
+++ trunk/gui/controller.py Fri Oct 12 11:48:22 2012
@@ -335,6 +335,30 @@
             self.update_gauge()
 
 
+    def reset(self):
+        """Reset the relax controller to its initial state."""
+
+        # Stop the timer.
+        if self.timer.IsRunning():
+            self.timer.Stop()
+
+        # Reset the Rx gauges.
+        if hasattr(self, 'mc_gauge_rx'):
+            wx.CallAfter(self.mc_gauge_rx.SetValue, 0)
+
+        # Reset the model-free gauges.
+        if hasattr(self, 'mc_gauge_mf'):
+            wx.CallAfter(self.mc_gauge_mf.SetValue, 0)
+        if hasattr(self, 'progress_gauge_mf'):
+            wx.CallAfter(self.progress_gauge_mf.SetValue, 0)
+
+        # Reset the main gauge.
+        wx.CallAfter(self.main_gauge.SetValue, 0)
+
+        # Clear the log.
+        wx.CallAfter(self.log_panel.clear)
+
+
     def setup_frame(self):
         """Set up the relax controller frame.
         @return:    The sizer object.
@@ -692,6 +716,19 @@
             self.on_goto_end(event)
 
 
+    def clear(self):
+        """Remove all text from the log."""
+
+        # Turn of the read only state.
+        self.SetReadOnly(False)
+
+        # Remove all text.
+        self.ClearAll()
+
+        # Make the control read only again.
+        self.SetReadOnly(True)
+
+
     def find(self, event):
         """Find the text in the log control.
 

Modified: trunk/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/relax_gui.py?rev=17798&r1=17797&r2=17798&view=diff
==============================================================================
--- trunk/gui/relax_gui.py (original)
+++ trunk/gui/relax_gui.py Fri Oct 12 11:48:22 2012
@@ -513,6 +513,26 @@
         open_file(file)
 
 
+    def reset(self):
+        """Reset the GUI."""
+
+        # Close some GUI windows, if open.
+        windows = ['pipe_editor', 'relax_prompt', 'results_viewer', 
'spin_viewer']
+        for window in windows:
+            if hasattr(self, window):
+                # Get the object.
+                win_obj = getattr(self, window)
+
+                # Close the window.
+                win_obj.Close()
+
+        # Flush all wx events to make sure the GUI is ready for the next 
test.
+        wx.Yield()
+
+        # Reset the relax controller.
+        self.controller.reset()
+
+
     def run_test_suite(self, event=None, categories=['system', 'unit', 
'gui']):
         """Execute the full test suite.
 

Modified: trunk/test_suite/gui_tests/base_classes.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/gui_tests/base_classes.py?rev=17798&r1=17797&r2=17798&view=diff
==============================================================================
--- trunk/test_suite/gui_tests/base_classes.py (original)
+++ trunk/test_suite/gui_tests/base_classes.py Fri Oct 12 11:48:22 2012
@@ -241,16 +241,3 @@
 
         # Reset relax.
         reset()
-
-        # Close some GUI windows, if open.
-        windows = ['pipe_editor', 'relax_prompt', 'results_viewer', 
'spin_viewer']
-        for window in windows:
-            if hasattr(self.app.gui, window):
-                # Get the object.
-                win_obj = getattr(self.app.gui, window)
-
-                # Close the window.
-                win_obj.Close()
-
-        # Flush all wx events to make sure the GUI is ready for the next 
test.
-        wx.Yield()




Related Messages


Powered by MHonArc, Updated Mon Oct 15 10:40:02 2012