[GRASS-SVN] r47115 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 14 10:37:53 EDT 2011
Author: annakrat
Date: 2011-07-14 07:37:52 -0700 (Thu, 14 Jul 2011)
New Revision: 47115
Modified:
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
Log:
wxNviz: transparency for constant planes
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-07-14 13:08:22 UTC (rev 47114)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-07-14 14:37:52 UTC (rev 47115)
@@ -1094,6 +1094,10 @@
self._display.SetSurfaceColor(id = id, map = False, value = data['color'])
self._display.SetSurfaceTopo(id = id, map = False, value = data['value'])
self._display.SetSurfaceRes(id, data['resolution'], data['resolution'])
+ if data['transp'] == 0:
+ self._display.UnsetSurfaceTransp(id)
+ else:
+ self._display.SetSurfaceTransp(id, map = False, value = data['transp'])
def UpdateSurfaceProperties(self, id, data):
"""!Update surface map object properties"""
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-14 13:08:22 UTC (rev 47114)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-14 14:37:52 UTC (rev 47115)
@@ -966,16 +966,28 @@
value.Bind(wx.EVT_SPINCTRL, self.OnSetConstantProp)
gridSizer.Add(item = value, pos = (1, 1))
+ # transparency
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Transparency:")), pos = (2, 0),
+ flag = wx.ALIGN_CENTER_VERTICAL)
+
+ transp = wx.SpinCtrl(panel, id = wx.ID_ANY,
+ min = 0, max = 100,
+ size = (65, -1))
+ self.win['constant']['transp'] = transp.GetId()
+ transp.Bind(wx.EVT_SPINCTRL, self.OnSetConstantProp)
+ gridSizer.Add(item = transp, pos = (2, 1))
+
# color
gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
- label = _("Color:")), pos = (2, 0),
+ label = _("Color:")), pos = (3, 0),
flag = wx.ALIGN_CENTER_VERTICAL)
color = csel.ColourSelect(panel, id = wx.ID_ANY,
colour = (0,0,0),
size = globalvar.DIALOG_COLOR_SIZE)
self.win['constant']['color'] = color.GetId()
color.Bind(csel.EVT_COLOURSELECT, self.OnSetConstantProp)
- gridSizer.Add(item = color, pos = (2, 1))
+ gridSizer.Add(item = color, pos = (3, 1))
boxSizer.Add(item = gridSizer, proportion = 0, flag = wx.ALL,
border = 5)
pageSizer.Add(item = boxSizer, proportion = 0,
@@ -1780,7 +1792,9 @@
for attr, value in data['constant'].iteritems():
if attr == 'color':
value = self._getColorFromString(value)
- if attr in ('color', 'value', 'resolution'):
+ if attr in ('color', 'value', 'resolution', 'transp'):
+ if attr == 'transp':
+ self.FindWindowById(self.win['constant'][attr]).SetValue(self._getPercent(value))
self.FindWindowById(self.win['constant'][attr]).SetValue(value)
def OnSetConstantProp(self, event):
@@ -1790,11 +1804,12 @@
if layerIdx == wx.NOT_FOUND:
return
data = self.mapWindow.constants[layerIdx]
- for attr in ('resolution', 'value'):
+ for attr in ('resolution', 'value', 'transp'):
data['constant'][attr] = self.FindWindowById(self.win['constant'][attr]).GetValue()
data['constant']['color'] = self._getColorString(
self.FindWindowById(self.win['constant']['color']).GetValue())
-
+ data['constant']['transp'] = self._getPercent(data['constant']['transp'], toPercent = False)
+
# update properties
event = wxUpdateProperties(data = data)
wx.PostEvent(self.mapWindow, event)
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-07-14 13:08:22 UTC (rev 47114)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2011-07-14 14:37:52 UTC (rev 47115)
@@ -517,6 +517,7 @@
'constant' : {
'color' : (100, 100, 100, 255),
'value' : 0.0,
+ 'transp' : 0,
'resolution': 6
},
'vector' : {
More information about the grass-commit
mailing list