summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-wxgui/python/wxgui/stdgui2.py9
-rw-r--r--grc/python/flow_graph.tmpl10
2 files changed, 19 insertions, 0 deletions
diff --git a/gr-wxgui/python/wxgui/stdgui2.py b/gr-wxgui/python/wxgui/stdgui2.py
index 71436d72c4..b38589988e 100644
--- a/gr-wxgui/python/wxgui/stdgui2.py
+++ b/gr-wxgui/python/wxgui/stdgui2.py
@@ -21,6 +21,8 @@
'''A simple wx gui for GNU Radio applications'''
+import ctypes
+import os
import wx
import sys
from gnuradio import gr
@@ -33,6 +35,13 @@ class stdapp (wx.App):
self.title = title
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':
+ try:
+ x11 = ctypes.cdll.LoadLibrary('libX11.so')
+ x11.XInitThreads()
+ except:
+ print "Warning: failed to XInitThreads()"
# All our initialization must come before calling wx.App.__init__.
# OnInit is called from somewhere in the guts of __init__.
wx.App.__init__ (self, redirect=False)
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 8b44f55126..3e9520a14f 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -275,6 +275,16 @@ $short_id#slurp
#end def
#if $generate_options != 'hb'
if __name__ == '__main__':
+ #if $generate_options in ('wx_gui', 'qt_gui')
+ import ctypes
+ import os
+ if os.name == 'posix':
+ try:
+ x11 = ctypes.cdll.LoadLibrary('libX11.so')
+ x11.XInitThreads()
+ except:
+ print "Warning: failed to XInitThreads()"
+ #end if
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
#set $params_eq_list = list()
#for $param in $parameters