From db627dafee41444f42c2c44b0aa971f41883a44f Mon Sep 17 00:00:00 2001
From: Sylvain Munaut
Date: Tue, 15 Jan 2013 05:16:39 -0800
Subject: wxgui: dead code removal and formatting cleanup

---
 gr-wxgui/src/python/plotter/plotter_base.py | 67 +++++++++++++----------------
 1 file changed, 31 insertions(+), 36 deletions(-)

(limited to 'gr-wxgui/src/python/plotter/plotter_base.py')

diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py
index 2fdd0f20a..41c94e5e0 100644
--- a/gr-wxgui/src/python/plotter/plotter_base.py
+++ b/gr-wxgui/src/python/plotter/plotter_base.py
@@ -88,9 +88,9 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
 		"""
 		attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA)
 		wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList);
-                self.use_persistence=False
-                self.persist_alpha=2.0/15
-                self.clear_accum=True
+		self.use_persistence=False
+		self.persist_alpha=2.0/15
+		self.clear_accum=True
 		self._gl_init_flag = False
 		self._resized_flag = True
 		self._init_fcns = list()
@@ -100,12 +100,12 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
 		self.Bind(wx.EVT_SIZE, self._on_size)
 		self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
 
-        def set_use_persistence(self,enable):
-                self.use_persistence=enable
-                self.clear_accum=True
+	def set_use_persistence(self,enable):
+		self.use_persistence=enable
+		self.clear_accum=True
 
-        def set_persist_alpha(self,analog_alpha):
-                self.persist_alpha=analog_alpha
+	def set_persist_alpha(self,analog_alpha):
+		self.persist_alpha=analog_alpha
 
 	def new_gl_cache(self, draw_fcn, draw_pri=50):
 		"""
@@ -141,7 +141,7 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
 		"""
 		self.lock()
 		self._resized_flag = True
-                self.clear_accum=True
+		self.clear_accum=True
 		self.unlock()
 
 	def _on_paint(self, event):
@@ -153,12 +153,14 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
 		"""
 		self.lock()
 		self.SetCurrent()
-		#check if gl was initialized
+
+		# check if gl was initialized
 		if not self._gl_init_flag:
 			GL.glClearColor(*BACKGROUND_COLOR_SPEC)
 			for fcn in self._init_fcns: fcn()
 			self._gl_init_flag = True
-		#check for a change in window size
+
+		# check for a change in window size
 		if self._resized_flag:
 			self.width, self.height = self.GetSize()
 			GL.glMatrixMode(GL.GL_PROJECTION)
@@ -169,35 +171,28 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
 			GL.glViewport(0, 0, self.width, self.height)
 			for cache in self._gl_caches: cache.changed(True)
 			self._resized_flag = False
-		#clear, draw functions, swap
-		GL.glClear(GL.GL_COLOR_BUFFER_BIT)
-
-                if False:
-                  GL.glEnable (GL.GL_LINE_SMOOTH)
-                  GL.glEnable (GL.GL_POLYGON_SMOOTH)
-                  GL.glEnable (GL.GL_BLEND)
-                  GL.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
-                  GL.glHint (GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST) #GL.GL_DONT_CARE)
-                  GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST)
-                  #GL.glLineWidth (1.5)
-
-                  GL.glEnable(GL.GL_MULTISAMPLE) #Enable Multisampling anti-aliasing
 
+		# clear buffer
+		GL.glClear(GL.GL_COLOR_BUFFER_BIT)
 
+		# draw functions
 		for fcn in self._draw_fcns: fcn[1]()
 
-                if self.use_persistence:
-                  if self.clear_accum:
-                    #GL.glClear(GL.GL_ACCUM_BUFFER_BIT)
-                    try:
-                        GL.glAccum(GL.GL_LOAD, 1.0)
-                    except:
-						pass
-                    self.clear_accum=False
-
-                  GL.glAccum(GL.GL_MULT, 1.0-self.persist_alpha)
-                  GL.glAccum(GL.GL_ACCUM, self.persist_alpha)
-                  GL.glAccum(GL.GL_RETURN, 1.0)
+		# apply persistence
+		if self.use_persistence:
+			if self.clear_accum:
+				#GL.glClear(GL.GL_ACCUM_BUFFER_BIT)
+				try:
+					GL.glAccum(GL.GL_LOAD, 1.0)
+				except:
+					pass
+				self.clear_accum=False
+
+			GL.glAccum(GL.GL_MULT, 1.0-self.persist_alpha)
+			GL.glAccum(GL.GL_ACCUM, self.persist_alpha)
+			GL.glAccum(GL.GL_RETURN, 1.0)
+
+		# show result
 		self.SwapBuffers()
 		self.unlock()
 
-- 
cgit 


From 6b9b1f762eacd6ad53727cf116d12a76d6e8b6b8 Mon Sep 17 00:00:00 2001
From: Balint Seeber
Date: Fri, 18 Jan 2013 16:28:10 -0800
Subject: Added PaintDC to 'plotter_base' so WX GL sinks will work under
 Windows. Changed 'notebook' SetSelection (deprecated) to ChangeSelection.

---
 gr-wxgui/src/python/plotter/plotter_base.py | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'gr-wxgui/src/python/plotter/plotter_base.py')

diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py
index 41c94e5e0..f1cbaf3c7 100644
--- a/gr-wxgui/src/python/plotter/plotter_base.py
+++ b/gr-wxgui/src/python/plotter/plotter_base.py
@@ -151,6 +151,8 @@ 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.
 		"""
+		# create device context (needed on Windows, noop on X)
+		dc = wx.PaintDC(self)
 		self.lock()
 		self.SetCurrent()
 
-- 
cgit