mailr14724 - /1.3/gui/relax_prompt.py


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

Header


Content

Posted by edward on September 21, 2011 - 11:29:
Author: bugman
Date: Wed Sep 21 11:29:31 2011
New Revision: 14724

URL: http://svn.gna.org/viewcvs/relax?rev=14724&view=rev
Log:
The GUI prompt window is now also deactivated with the execution lock.

This will prevent race conditions as previously the user was able to execute 
any user function or
manipulate any of the data in the relax data store, while execution was in 
progress!


Modified:
    1.3/gui/relax_prompt.py

Modified: 1.3/gui/relax_prompt.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/gui/relax_prompt.py?rev=14724&r1=14723&r2=14724&view=diff
==============================================================================
--- 1.3/gui/relax_prompt.py (original)
+++ 1.3/gui/relax_prompt.py Wed Sep 21 11:29:31 2011
@@ -32,6 +32,7 @@
 # relax module imports
 from info import Info_box
 from prompt import interpreter
+from status import Status; status = Status()
 
 # relax GUI module imports
 from gui.icons import relax_icons
@@ -63,6 +64,9 @@
 
         # The shell.
         self.add_shell(sizer)
+
+        # Register functions with the observer objects.
+        status.observers.exec_lock.register('GUI prompt', self.enable)
 
 
     def add_shell(self, sizer):
@@ -97,6 +101,18 @@
 
         # Add the shell to the sizer.
         sizer.Add(self.prompt, 1, wx.EXPAND|wx.ALL, self.border)
+
+
+    def enable(self):
+        """Enable and disable the prompt with the execution lock."""
+
+        # Flag for enabling or disabling the prompt.
+        enable = False
+        if not status.exec_lock.locked():
+            enable = True
+
+        # Enable/disable.
+        self.prompt.Enable(enable)
 
 
     def handler_close(self, event):




Related Messages


Powered by MHonArc, Updated Wed Sep 21 12:00:02 2011