[GRASS-SVN] r47008 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 5 14:40:42 EDT 2011
Author: annakrat
Date: 2011-07-05 11:40:41 -0700 (Tue, 05 Jul 2011)
New Revision: 47008
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/wxnviz.py
Log:
wxNviz: isosurfaces - remove emission attribute, floatspin instead of spinctrl if available
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-07-05 14:46:36 UTC (rev 47007)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-07-05 18:40:41 UTC (rev 47008)
@@ -1177,7 +1177,7 @@
isosurfId = 0
for isosurf in data['isosurface']:
for attrb in ('color', 'mask',
- 'transp', 'shine', 'emit'):
+ 'transp', 'shine'):
if attrb not in isosurf or \
'update' not in isosurf[attrb]:
continue
@@ -1191,9 +1191,7 @@
# TODO: broken in NVIZ
self._display.UnsetIsosurfaceMask(id, isosurfId)
elif attrb == 'transp':
- self._display.UnsetIsosurfaceTransp(id, isosurfId)
- elif attrb == 'emit':
- self._display.UnsetIsosurfaceEmit(id, isosurfId)
+ self._display.UnsetIsosurfaceTransp(id, isosurfId)
else:
if type(value) == type('') and \
len(value) <= 0: # ignore empty values (TODO: warning)
@@ -1207,9 +1205,7 @@
elif attrb == 'transp':
self._display.SetIsosurfaceTransp(id, isosurfId, map, str(value))
elif attrb == 'shine':
- self._display.SetIsosurfaceShine(id, isosurfId, map, str(value))
- elif attrb == 'emit':
- self._display.SetIsosurfaceEmit(id, isosurfId, map, str(value))
+ self._display.SetIsosurfaceShine(id, isosurfId, map, str(value))
isosurf[attrb].pop('update')
isosurfId += 1
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-05 14:46:36 UTC (rev 47007)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2011-07-05 18:40:41 UTC (rev 47008)
@@ -40,6 +40,10 @@
import wx.lib.agw.foldpanelbar as fpb
except ImportError:
import wx.lib.foldpanelbar as fpb # versions <=2.5.5.1
+try:
+ import wx.lib.agw.floatspin as fs
+except ImportError:
+ fs = None
import grass.script as grass
@@ -1398,8 +1402,7 @@
('color', _("Color")),
('mask', _("Mask")),
('transp', _("Transparency")),
- ('shine', _("Shininess")),
- ('emit', _("Emission"))):
+ ('shine', _("Shininess"))):
self.win['volume'][code] = {}
# label
gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
@@ -1448,15 +1451,28 @@
size = (200, -1)
else:
size = (65, -1)
- value = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = size,
- initial = 0)
+ if fs:
+ value = fs.FloatSpin(parent = panel, id = wx.ID_ANY,
+ size = size, increment = 0.5, value = 0)
+ value.SetFormat("%f")
+ value.SetDigits(1)
+ else:
+ value = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = size,
+ initial = 0)
if code == 'topo':
- value.SetRange(minVal = -1e9, maxVal = 1e9)
- elif code in ('shine', 'transp', 'emit'):
- value.SetRange(minVal = 0, maxVal = 255)
+ if fs:
+ value.SetRange(min_val = -1e9, max_val = 1e9)
+ else:
+ value.SetRange(minVal = -1e9, maxVal = 1e9)
+ elif code in ('shine', 'transp'):
+ if fs:
+ value.SetRange(min_val = 0, max_val = 255)
+ else:
+ value.SetRange(minVal = 0, maxVal = 255)
+ if fs:
+ value.Bind(fs.EVT_FLOATSPIN, self.OnVolumeIsosurfMap)
else:
- value.SetRange(minVal = 0, maxVal = 100)
- value.Bind(wx.EVT_SPINCTRL, self.OnVolumeIsosurfMap)
+ value.Bind(wx.EVT_SPINCTRL, self.OnVolumeIsosurfMap)
value.Bind(wx.EVT_TEXT, self.OnVolumeIsosurfMap)
if value:
@@ -2280,9 +2296,10 @@
data = self.mapWindow.GetLayerByName(name, mapType = '3d-raster', dataType = 'nviz')
list = self.FindWindowById(self.win['volume']['isosurfs'])
id = list.GetSelection()
- data[nvizType]['isosurface'][id][attrb] = { 'map' : useMap,
- 'value' : str(value),
- 'update' : None }
+ if id != -1:
+ data[nvizType]['isosurface'][id][attrb] = { 'map' : useMap,
+ 'value' : str(value),
+ 'update' : None }
# update properties
event = wxUpdateProperties(data = data)
@@ -2941,7 +2958,7 @@
# collect properties
isosurfData = {}
for attrb in ('topo', 'color', 'mask',
- 'transp', 'shine', 'emit'):
+ 'transp', 'shine'):
if attrb == 'topo':
isosurfData[attrb] = {}
win = self.FindWindowById(self.win['volume'][attrb]['const'])
@@ -3562,7 +3579,7 @@
# isosurface attributes
#
for attrb in ('topo', 'color', 'mask',
- 'transp', 'shine', 'emit'):
+ 'transp', 'shine'):
# check required first
if attrb == 'topo':
self.FindWindowById(self.win['volume'][attrb]['const']).SetValue(0)
Modified: grass/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2011-07-05 14:46:36 UTC (rev 47007)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py 2011-07-05 18:40:41 UTC (rev 47008)
@@ -1084,7 +1084,7 @@
return self.SetIsosurfaceAttr(id, isosurf_id, ATT_SHINE, map, value)
def SetIsosurfaceEmit(self, id, isosurf_id, map, value):
- """!Set isosurface emission
+ """!Set isosurface emission (currently unused)
@param id volume id
@param isosurf_id isosurface id (0 - MAX_ISOSURFS)
@@ -1164,7 +1164,7 @@
return self.UnsetIsosurfaceAttr(id, isosurf_id, ATT_TRANSP)
def UnsetIsosurfaceEmit(self, id, isosurf_id):
- """!Unset isosurface emission
+ """!Unset isosurface emission (currently unused)
@param id volume id
@param isosurf_id isosurface id (0 - MAX_ISOSURFS)
More information about the grass-commit
mailing list