[GRASS-SVN] r55967 - in grass/trunk/gui/wxpython: core gui_core nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 24 01:03:16 PDT 2013
Author: annakrat
Date: 2013-04-24 01:03:16 -0700 (Wed, 24 Apr 2013)
New Revision: 55967
Modified:
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/gui_core/preferences.py
grass/trunk/gui/wxpython/nviz/mapwindow.py
Log:
wxGUI/nviz: fix for strange vector rendering on wxGTK
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2013-04-24 03:07:29 UTC (rev 55966)
+++ grass/trunk/gui/wxpython/core/settings.py 2013-04-24 08:03:16 UTC (rev 55967)
@@ -190,6 +190,9 @@
'scrollDirection' : {
'selection' : 0,
},
+ 'nvizDepthBuffer' : {
+ 'value' : 16,
+ },
},
#
# projection
Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py 2013-04-24 03:07:29 UTC (rev 55966)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py 2013-04-24 08:03:16 UTC (rev 55967)
@@ -49,6 +49,7 @@
from core.utils import ListOfMapsets, GetColorTables, ReadEpsgCodes, StoreEnvVariable
from core.settings import UserSettings
from gui_core.dialogs import SymbolDialog
+from gui_core.widgets import IntegerValidator
class PreferencesBaseDialog(wx.Dialog):
"""!Base preferences dialog"""
@@ -784,6 +785,36 @@
sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
+
+ #
+ # advanced
+ #
+
+ # see initialization of nviz GLWindow
+ if globalvar.CheckWxVersion(version=[2, 8, 11]) and \
+ sys.platform not in ('win32', 'darwin'):
+ box = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Advanced display settings"))
+ sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+
+ gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
+ row = 0
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("3D view depth buffer (possible values are 16, 24, 32):")),
+ flag = wx.ALIGN_LEFT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 0))
+ value = self.settings.Get(group='display', key='nvizDepthBuffer', subkey='value')
+ textCtrl = wx.TextCtrl(parent=panel, id=wx.ID_ANY, value=str(value), validator=IntegerValidator())
+ self.winId['display:nvizDepthBuffer:value'] = textCtrl.GetId()
+ gridSizer.Add(item = textCtrl,
+ flag = wx.ALIGN_RIGHT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 1))
+
+ gridSizer.AddGrowableCol(0)
+ sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
+ border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
+
panel.SetSizer(border)
# bindings
Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py 2013-04-24 03:07:29 UTC (rev 55966)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py 2013-04-24 08:03:16 UTC (rev 55967)
@@ -30,6 +30,7 @@
import wx
from wx.lib.newevent import NewEvent
from wx import glcanvas
+from wx.glcanvas import WX_GL_DEPTH_SIZE
import grass.script as grass
@@ -40,6 +41,7 @@
from nviz.workspace import NvizSettings
from nviz.animation import Animation
from nviz import wxnviz
+from core.globalvar import CheckWxVersion
wxUpdateProperties, EVT_UPDATE_PROP = NewEvent()
wxUpdateView, EVT_UPDATE_VIEW = NewEvent()
@@ -72,8 +74,19 @@
self.parent = parent # MapFrame
self.tree = tree
self.lmgr = lmgr
-
- glcanvas.GLCanvas.__init__(self, parent, id)
+
+ # for wxGTK we need to set WX_GL_DEPTH_SIZE to draw vectors correctly
+ # but we don't know the right value
+ # in wxpython 2.9, there is IsDisplaySupported
+ if CheckWxVersion(version=[2, 8, 11]) and \
+ sys.platform not in ('win32', 'darwin'):
+ depthBuffer = int(UserSettings.Get(group='display', key='nvizDepthBuffer', subkey='value'))
+ attribs=[WX_GL_DEPTH_SIZE, depthBuffer, 0]
+ glcanvas.GLCanvas.__init__(self, parent, id, attribList=attribs)
+ else:
+ glcanvas.GLCanvas.__init__(self, parent, id)
+
+
MapWindow.__init__(self, parent = parent, giface = giface, frame = frame,
Map = Map)
self.Hide()
@@ -179,9 +192,21 @@
self.Bind(wx.EVT_CLOSE, self.OnClose)
+ if CheckWxVersion(version=[2, 8, 11]) and \
+ sys.platform not in ('win32', 'darwin'):
+ wx.CallLater(3000, self._warningDepthBuffer)
+
# cplanes cannot be initialized now
wx.CallAfter(self.InitCPlanes)
+ def _warningDepthBuffer(self):
+ if not self.initView:
+ message=_("Opening 3D view was not successful. "
+ "Please try to change the value of depth buffer "
+ "in GUI Settings dialog > tab Map Display > Advanced "
+ "and restart GUI.")
+ GMessage(message)
+
def InitFly(self):
"""!Initialize fly through dictionary"""
fly = {'interval' : 10, # interval for timerFly
More information about the grass-commit
mailing list