commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/07: wxgui: Make sure to only start the f


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/07: wxgui: Make sure to only start the flow graph once all init is done
Date: Sat, 18 Jan 2014 20:31:59 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit 07ed54784afac1b6b74f5896e22675f7dd203e27
Author: Sylvain Munaut <address@hidden>
Date:   Sun Dec 15 14:54:31 2013 +0100

    wxgui: Make sure to only start the flow graph once all init is done
    
    Currently we start the flow graph in the stdframe constructor.
    However at that point, the frame isn't attached to the app and it's not
    "shown" yet which means some UI operations can still fail.
    
    This is a race condition which happens on OSX. You can reproduce it on
    linux as well by adding a sleep(1) after starting the flow graph.
    
    Signed-off-by: Sylvain Munaut <address@hidden>
---
 gr-wxgui/python/wxgui/stdgui2.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gr-wxgui/python/wxgui/stdgui2.py b/gr-wxgui/python/wxgui/stdgui2.py
index 53b389d..dbd0307 100644
--- a/gr-wxgui/python/wxgui/stdgui2.py
+++ b/gr-wxgui/python/wxgui/stdgui2.py
@@ -46,16 +46,20 @@ class stdapp (wx.App):
         wx.App.__init__ (self, redirect=False)
 
     def OnInit (self):
-        frame = stdframe (self.top_block_maker, self.title, self._nstatus,
-                          self._max_noutput_items)
+        frame = stdframe (self.top_block_maker, self.title, self._nstatus)
         frame.Show (True)
         self.SetTopWindow (frame)
+
+        if(self._max_noutput_items is not None):
+            frame.top_block().start (self._max_noutput_items)
+        else:
+            frame.top_block().start ()
+
         return True
 
 
 class stdframe (wx.Frame):
-    def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2,
-                  max_nouts=None):
+    def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2):
         # print "stdframe.__init__"
         wx.Frame.__init__(self, None, -1, title)
 
@@ -69,7 +73,7 @@ class stdframe (wx.Frame):
         self.SetMenuBar (mainmenu)
 
         self.Bind (wx.EVT_CLOSE, self.OnCloseWindow)
-        self.panel = stdpanel (self, self, top_block_maker, max_nouts)
+        self.panel = stdpanel (self, self, top_block_maker)
         vbox = wx.BoxSizer(wx.VERTICAL)
         vbox.Add(self.panel, 1, wx.EXPAND)
         self.SetSizer(vbox)
@@ -85,8 +89,7 @@ class stdframe (wx.Frame):
         return self.panel.top_block
 
 class stdpanel (wx.Panel):
-    def __init__ (self, parent, frame, top_block_maker,
-                  max_nouts=None):
+    def __init__ (self, parent, frame, top_block_maker):
         # print "stdpanel.__init__"
         wx.Panel.__init__ (self, parent, -1)
         self.frame = frame
@@ -97,11 +100,6 @@ class stdpanel (wx.Panel):
         self.SetAutoLayout (True)
         vbox.Fit (self)
 
-        if(max_nouts is not None):
-            self.top_block.start (max_nouts)
-        else:
-            self.top_block.start ()
-
 class std_top_block (gr.top_block):
     def __init__ (self, parent, panel, vbox, argv):
         # Call the hier_block2 constructor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]