[GRASS-SVN] r40998 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Feb 14 14:58:11 EST 2010
Author: cmbarton
Date: 2010-02-14 14:58:09 -0500 (Sun, 14 Feb 2010)
New Revision: 40998
Modified:
grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
Log:
Better display updating and error checking
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-02-14 15:01:56 UTC (rev 40997)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py 2010-02-14 19:58:09 UTC (rev 40998)
@@ -709,7 +709,6 @@
pos=(2, 3), span=(1, 6),
flag=wx.ALIGN_CENTER_VERTICAL)
-
self.CreateControl(panel, dict=self.win['vector']['lines'], name='height', size=300,
range=(0, 1000),
bind=(self.OnVectorHeight, self.OnVectorHeightFull, self.OnVectorHeightSpin))
@@ -727,7 +726,6 @@
flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
border=5)
-
#
# vector points
#
@@ -1837,7 +1835,8 @@
rasters = self.mapWindow.GetLayerNames('raster')
if event.GetSelection() == 0: # surface
if len(rasters) < 1:
- event.Veto()
+ self.FindWindowById(self.win['vector']['lines']['surface']).Enable(False)
+ self.FindWindowById(self.win['vector']['lines']['flat']).SetSelection(1)
return
self.FindWindowById(self.win['vector']['lines']['surface']).Enable(True)
@@ -1855,11 +1854,10 @@
def OnVectorLines(self, event):
"""!Set vector lines mode, apply changes if auto-rendering is enabled"""
+ data = self.mapWindow.GetSelectedLayer(type='nviz')
+
width = self.FindWindowById(self.win['vector']['lines']['width']).GetValue()
- color = self.FindWindowById(self.win['vector']['lines']['color']).GetColour()
- color = str(color[0]) + ':' + str(color[1]) + ':' + str(color[2])
-
mode = {}
if self.FindWindowById(self.win['vector']['lines']['flat']).GetSelection() == 0:
mode['type'] = 'surface'
@@ -1868,12 +1866,18 @@
else:
mode['type'] = 'flat'
- data = self.mapWindow.GetSelectedLayer(type='nviz')
- for attrb in ('width', 'color', 'mode'):
+ for attrb in ('width', 'mode'):
data['vector']['lines'][attrb]['update'] = None
data['vector']['lines']['width']['value'] = width
- data['vector']['lines']['color']['value'] = color
data['vector']['lines']['mode']['value'] = mode
+
+ color = self.FindWindowById(self.win['vector']['lines']['color']).GetColour()
+ if type(color) != wx._gdi.Colour:
+ pass #color picker not yet instantiated
+ else:
+ color = str(color[0]) + ':' + str(color[1]) + ':' + str(color[2])
+ data['vector']['lines']['color']['update'] = None
+ data['vector']['lines']['color']['value'] = color
# update properties
event = wxUpdateProperties(data=data)
@@ -1955,23 +1959,26 @@
def OnVectorPoints(self, event):
"""!Set vector points mode, apply changes if auto-rendering is enabled"""
+ data = self.mapWindow.GetSelectedLayer(type='nviz')
+
size = self.FindWindowById(self.win['vector']['points']['size']).GetValue()
+ marker = self.FindWindowById(self.win['vector']['points']['marker']).GetSelection()
# width = self.FindWindowById(self.win['vector']['points']['width']).GetValue()
- color = self.FindWindowById(self.win['vector']['points']['color']).GetColour()
- if type(color) != wx._gdi.Colour: return #color picker not yet instantiated
- color = str(color[0]) + ':' + str(color[1]) + ':' + str(color[2])
-
- marker = self.FindWindowById(self.win['vector']['points']['marker']).GetSelection()
-
- data = self.mapWindow.GetSelectedLayer(type='nviz')
- for attrb in ('size', 'color', 'marker'):
+ for attrb in ('size', 'marker'):
data['vector']['points'][attrb]['update'] = None
data['vector']['points']['size']['value'] = size
# data['vector']['points']['width']['value'] = width
- data['vector']['points']['color']['value'] = color
data['vector']['points']['marker']['value'] = marker
+ color = self.FindWindowById(self.win['vector']['points']['color']).GetColour()
+ if type(color) != wx._gdi.Colour:
+ pass #color picker not yet instantiated
+ else:
+ color = str(color[0]) + ':' + str(color[1]) + ':' + str(color[2])
+ data['vector']['points']['color']['update'] = None
+ data['vector']['points']['color']['value'] = color
+
# update properties
event = wxUpdateProperties(data=data)
wx.PostEvent(self.mapWindow, event)
@@ -2455,7 +2462,10 @@
surface = self.FindWindowById(self.win['vector'][vtype]['surface'])
surface.SetItems(rasters)
if len(rasters) > 0:
- surface.SetStringSelection(data[vtype]['mode']['surface'])
+ try:
+ surface.SetStringSelection(data[vtype]['mode']['surface'])
+ except:
+ pass
for type in ('slider', 'spin'):
win = self.FindWindowById(self.win['vector']['lines']['height'][type])
@@ -2646,6 +2656,4 @@
self.mapWindow.view['pos']['y'] = ycoord
event = wxUpdateView(zExag=True)
- wx.PostEvent(self.mapWindow, event)
-
-
+ wx.PostEvent(self.mapWindow, event)
\ No newline at end of file
More information about the grass-commit
mailing list