diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-01-13 19:31:08 -0500 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-01-13 19:31:08 -0500 |
commit | f7f28bbd6e93a706a80dc8484f339fbd3aaf7a7e (patch) | |
tree | 760bce0d72cf296fee6e3f097d832b9919d8e170 | |
parent | 41e586635983488789d48e2dce57828aed560af8 (diff) | |
parent | c3fc18011f2712708dd70451437679f1c14736b9 (diff) |
Merge branch 'maint'
-rw-r--r-- | gr-wxgui/python/wxgui/stdgui2.py | 25 | ||||
-rw-r--r-- | grc/python/flow_graph.tmpl | 4 |
2 files changed, 13 insertions, 16 deletions
diff --git a/gr-wxgui/python/wxgui/stdgui2.py b/gr-wxgui/python/wxgui/stdgui2.py index d983dd58cd..dbd0307195 100644 --- a/gr-wxgui/python/wxgui/stdgui2.py +++ b/gr-wxgui/python/wxgui/stdgui2.py @@ -22,7 +22,6 @@ '''A simple wx gui for GNU Radio applications''' import ctypes -import os import wx import sys from gnuradio import gr @@ -36,7 +35,7 @@ class stdapp (wx.App): self._nstatus = nstatus self._max_noutput_items = max_noutput_items # If we're on Linux, also enable multi-threading Xlib access - if os.name == 'posix': + if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() @@ -47,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) @@ -70,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) @@ -86,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 @@ -98,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 diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index c18245e819..fe1155bb50 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -280,8 +280,8 @@ $short_id#slurp if __name__ == '__main__': #if $generate_options in ('wx_gui', 'qt_gui') import ctypes - import os - if os.name == 'posix': + import sys + if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() |