diff options
author | Balint Seeber | 2013-04-11 19:49:46 -0700 |
---|---|---|
committer | Balint Seeber | 2013-04-11 19:49:46 -0700 |
commit | 5f0aaf3d5397675d6f87acd7ab20526ac1fb0d4e (patch) | |
tree | eb6e84e5443bdd967cfbd1b0990a0569411cf32c /gr-wxgui | |
parent | 24e5572daefa0c3644bd5818582426a8bad8454b (diff) | |
download | gnuradio-5f0aaf3d5397675d6f87acd7ab20526ac1fb0d4e.tar.gz gnuradio-5f0aaf3d5397675d6f87acd7ab20526ac1fb0d4e.tar.bz2 gnuradio-5f0aaf3d5397675d6f87acd7ab20526ac1fb0d4e.zip |
wxgui: Fixes to solve issues using GL sinks on OS X
plotter/plotter_base.py: Create explicit OpenGL context, check if window is shown before realising context & only create PaintDC is paint triggered by WM message (OS paint event)
Added SetSizeHints to WX sink windows so sizing occurs correctly
Diffstat (limited to 'gr-wxgui')
-rw-r--r-- | gr-wxgui/src/python/const_window.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/fft_window.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/histo_window.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/plotter_base.py | 11 | ||||
-rw-r--r-- | gr-wxgui/src/python/scope_window.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/waterfall_window.py | 1 |
6 files changed, 13 insertions, 3 deletions
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index 2ad89b2a3..a7ff2e5f3 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -150,6 +150,7 @@ class const_window(wx.Panel, pubsub.pubsub): wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) + self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.set_x_label('Inphase') self.plotter.set_y_label('Quadrature') diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py index fac83a4a3..cf21b893a 100644 --- a/gr-wxgui/src/python/fft_window.py +++ b/gr-wxgui/src/python/fft_window.py @@ -274,6 +274,7 @@ class fft_window(wx.Panel, pubsub.pubsub): wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) + self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/src/python/histo_window.py index a1b520f9c..e87e97825 100644 --- a/gr-wxgui/src/python/histo_window.py +++ b/gr-wxgui/src/python/histo_window.py @@ -117,6 +117,7 @@ class histo_window(wx.Panel, pubsub.pubsub): wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.bar_plotter(self) self.plotter.SetSize(wx.Size(*size)) + self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(False) diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py index b8a2ce709..6d9463458 100644 --- a/gr-wxgui/src/python/plotter/plotter_base.py +++ b/gr-wxgui/src/python/plotter/plotter_base.py @@ -87,7 +87,8 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): @param parent the parent widgit """ attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA) - wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList); + wx.glcanvas.GLCanvas.__init__(self, parent, wx.ID_ANY, attribList); # Specifically use the CTOR which does NOT create an implicit GL context + self._gl_ctx = wx.glcanvas.GLContext(self) # Create the explicit GL context self.use_persistence=False self.persist_alpha=2.0/15 self.clear_accum=True @@ -151,10 +152,14 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): Resize the view port if the width or height changed. Redraw the screen, calling the draw functions. """ + if not self.IsShownOnScreen(): # Cannot realise a GL context on OS X if window is not yet shown + return # create device context (needed on Windows, noop on X) - dc = wx.PaintDC(self) + dc = None + if event.GetEventObject(): # Only create DC if paint triggered by WM message (for OS X) + dc = wx.PaintDC(self) self.lock() - self.SetCurrent() + self.SetCurrent(self._gl_ctx) # Real the explicit GL context # check if gl was initialized if not self._gl_init_flag: diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py index dc90a6045..fa79a986e 100644 --- a/gr-wxgui/src/python/scope_window.py +++ b/gr-wxgui/src/python/scope_window.py @@ -492,6 +492,7 @@ class scope_window(wx.Panel, pubsub.pubsub): wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) self.plotter.SetSize(wx.Size(*size)) + self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_legend(True) self.plotter.enable_point_label(True) diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py index cd60104d7..a190899c3 100644 --- a/gr-wxgui/src/python/waterfall_window.py +++ b/gr-wxgui/src/python/waterfall_window.py @@ -207,6 +207,7 @@ class waterfall_window(wx.Panel, pubsub.pubsub): wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.waterfall_plotter(self) self.plotter.SetSize(wx.Size(*size)) + self.plotter.SetSizeHints(*size) self.plotter.set_title(title) self.plotter.enable_point_label(True) self.plotter.enable_grid_lines(False) |