[GRASS-SVN] r56335 - grass/trunk/gui/wxpython/nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 20 10:09:03 PDT 2013


Author: annakrat
Date: 2013-05-20 10:09:03 -0700 (Mon, 20 May 2013)
New Revision: 56335

Modified:
   grass/trunk/gui/wxpython/nviz/mapwindow.py
Log:
wxNVIZ: fix different glcontext handling in wx 2.9

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2013-05-20 17:07:41 UTC (rev 56334)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2013-05-20 17:09:03 UTC (rev 56335)
@@ -93,7 +93,10 @@
         
         self.init = False
         self.initView = False
-        
+        self.context = None
+        if CheckWxVersion(version=[2, 9]):
+            self.context = glcanvas.GLContext(self)
+
         # render mode 
         self.render = { 'quick' : False,
                         # do not render vector lines in quick mode
@@ -340,11 +343,18 @@
     
     def OnSize(self, event):
         size = self.GetClientSize()
+        if CheckWxVersion(version=[2, 9]):
+            context = self.context
+        else:
+            context = self.GetContext()
         if self.size != size \
-            and self.GetContext():
+            and context:
             Debug.msg(3, "GLCanvas.OnSize(): w = %d, h = %d" % \
                       (size.width, size.height))
-            self.SetCurrent()
+            if CheckWxVersion(version=[2, 9]):
+                self.SetCurrent(self.context)
+            else:
+                self.SetCurrent()
             self._display.ResizeWindow(size.width,
                                        size.height)
         
@@ -367,7 +377,10 @@
         
 
     def DoPaint(self):
-        self.SetCurrent()
+        if CheckWxVersion(version=[2, 9]):
+            self.SetCurrent(self.context)
+        else:
+            self.SetCurrent()
         
         if not self.initView:
             self._display.InitView()



More information about the grass-commit mailing list