Merge commit 'v3.3.1' into try-3.3.1
[debian/gnuradio] / gr-wxgui / src / python / fftsink2.py
index ad2a09c96edd6b8770885bf2ba81d7855546c115..3277cd3ffa6784165160ee5c6d71312657ad5b56 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -24,22 +24,18 @@ from gnuradio import gr
 p = gr.prefs()
 style = p.get_string('wxgui', 'style', 'auto')
 
-# In 3.2 we'll change 'auto' to mean 'gl' if possible, then fallback
-if style == 'auto':
-    style = 'nongl'
-
-if style == 'nongl':
-    from fftsink_nongl import fft_sink_f, fft_sink_c
-elif style == 'gl':
-    try:
-        import wx
-        wx.glcanvas.GLCanvas
-    except AttributeError:
-        raise RuntimeError("wxPython doesn't support glcanvas")
-
+if style == 'auto' or style == 'gl':
     try:
+        import wx.glcanvas
         from OpenGL.GL import *
+        from fftsink_gl import fft_sink_f, fft_sink_c
     except ImportError:
-        raise RuntimeError("Unable to import OpenGL. Are Python wrappers for OpenGL installed?")
-
-    from fftsink_gl import fft_sink_f, fft_sink_c
+        if style == 'gl':
+            raise RuntimeError("Unable to import OpenGL.  Are Python wrappers for OpenGL installed?")
+        else:
+            # Fall backto non-gl sinks
+            from fftsink_nongl import fft_sink_f, fft_sink_c
+elif style == 'nongl':
+    from fftsink_nongl import fft_sink_f, fft_sink_c
+else:
+    raise RuntimeError("Unknown wxgui style")