mailr14170 - in /branches/gui_testing/gui: analyses/__init__.py pipe_editor.py relax_gui.py spin_viewer/frame.py


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

Header


Content

Posted by edward on August 05, 2011 - 12:04:
Author: bugman
Date: Fri Aug  5 12:04:31 2011
New Revision: 14170

URL: http://svn.gna.org/viewcvs/relax?rev=14170&view=rev
Log:
The observers of pipe alterations should now all be thread safe.

Pipe changes in relax were causing segfaults in the GUI.


Modified:
    branches/gui_testing/gui/analyses/__init__.py
    branches/gui_testing/gui/pipe_editor.py
    branches/gui_testing/gui/relax_gui.py
    branches/gui_testing/gui/spin_viewer/frame.py

Modified: branches/gui_testing/gui/analyses/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/analyses/__init__.py?rev=14170&r1=14169&r2=14170&view=diff
==============================================================================
--- branches/gui_testing/gui/analyses/__init__.py (original)
+++ branches/gui_testing/gui/analyses/__init__.py Fri Aug  5 12:04:31 2011
@@ -580,7 +580,7 @@
         self._current = index
 
         # Switch to the page.
-        self.notebook.SetSelection(self._current)
-
-        # Notify the observers of the change.
-        status.observers.gui_analysis.notify()
+        wx.CallAfter(self.notebook.SetSelection, self._current)
+
+        # Notify the observers of the change.
+        wx.CallAfter(status.observers.gui_analysis.notify)

Modified: branches/gui_testing/gui/pipe_editor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/pipe_editor.py?rev=14170&r1=14169&r2=14170&view=diff
==============================================================================
--- branches/gui_testing/gui/pipe_editor.py (original)
+++ branches/gui_testing/gui/pipe_editor.py Fri Aug  5 12:04:31 2011
@@ -353,6 +353,13 @@
 
 
     def update_grid(self):
+        """Update the grid in a thread safe way using wx.CallAfter."""
+
+        # Thread safe.
+        wx.CallAfter(self.update_grid_safe)
+
+
+    def update_grid_safe(self):
         """Update the grid with the pipe data."""
 
         # First freeze the grid, so that the GUI element doesn't update 
until the end.

Modified: branches/gui_testing/gui/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/relax_gui.py?rev=14170&r1=14169&r2=14170&view=diff
==============================================================================
--- branches/gui_testing/gui/relax_gui.py (original)
+++ branches/gui_testing/gui/relax_gui.py Fri Aug  5 12:04:31 2011
@@ -505,4 +505,4 @@
             pipe = ''
 
         # Set the status.
-        self.bar.SetStatusText(pipe, 2)
+        wx.CallAfter(self.bar.SetStatusText, pipe, 2)

Modified: branches/gui_testing/gui/spin_viewer/frame.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/spin_viewer/frame.py?rev=14170&r1=14169&r2=14170&view=diff
==============================================================================
--- branches/gui_testing/gui/spin_viewer/frame.py (original)
+++ branches/gui_testing/gui/spin_viewer/frame.py Fri Aug  5 12:04:31 2011
@@ -161,11 +161,17 @@
 
 
     def refresh(self, event=None):
-        """Event handler for the refresh action.
+        """Event handler for the refresh action (thread safe).
 
         @param event:   The wx event.
         @type event:    wx event
         """
+
+        wx.CallAfter(self.refresh_safe)
+
+
+    def refresh_safe(self):
+        """Refresh the spin viewer window."""
 
         # Change the cursor to busy.
         wx.BeginBusyCursor()




Related Messages


Powered by MHonArc, Updated Fri Aug 05 12:20:03 2011