[GRASS-SVN] r32357 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 29 08:12:46 EDT 2008
Author: martinl
Date: 2008-07-29 08:12:46 -0400 (Tue, 29 Jul 2008)
New Revision: 32357
Modified:
grass/trunk/gui/wxpython/gui_modules/goutput.py
grass/trunk/gui/wxpython/gui_modules/nviz.py
Log:
wxGUI/nviz2: 3D vector data supported
EnsureCaretVisible() enabled in goutput module, trac #201 re-opened
Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py 2008-07-29 10:50:03 UTC (rev 32356)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py 2008-07-29 12:12:46 UTC (rev 32357)
@@ -367,7 +367,7 @@
for line in s.split(os.linesep):
p1 = self.gmstc.GetCurrentPos() # get caret position
self.gmstc.AddTextWrapped(line, wrap=None) # no wrapping && adds os.linesep
- # self.gmstc.EnsureCaretVisible()
+ self.gmstc.EnsureCaretVisible()
p2 = self.gmstc.GetCurrentPos()
self.gmstc.StartStyling(p1, 0xff)
self.gmstc.SetStyling(p2 - p1 + 1, self.gmstc.StyleOutput)
@@ -435,7 +435,7 @@
if len(line) > 0:
p1 = self.gmstc.GetCurrentPos()
self.gmstc.AddTextWrapped(line, wrap=60) # wrap && add os.linesep
- # self.gmstc.EnsureCaretVisible()
+ self.gmstc.EnsureCaretVisible()
p2 = self.gmstc.GetCurrentPos()
self.gmstc.StartStyling(p1, 0xff)
self.gmstc.SetStyling(p2 - p1 + 1, self.gmstc.StyleUnknown)
@@ -452,7 +452,7 @@
self.gmstc.AddTextWrapped(self.message, wrap=60) #wrap && add os.linesep
else:
self.gmstc.AddText(self.message + os.linesep)
- # self.gmstc.EnsureCaretVisible()
+ self.gmstc.EnsureCaretVisible()
p2 = self.gmstc.GetCurrentPos()
self.gmstc.StartStyling(p1, 0xff)
if self.type == 'error':
Modified: grass/trunk/gui/wxpython/gui_modules/nviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz.py 2008-07-29 10:50:03 UTC (rev 32356)
+++ grass/trunk/gui/wxpython/gui_modules/nviz.py 2008-07-29 12:12:46 UTC (rev 32357)
@@ -439,8 +439,7 @@
id = self.nvizClass.LoadSurface(str(layer.name), None, None)
if id < 0:
- raise gcmd.NvizError(parent=self.parent,
- message=_("Raster map <%s> not loaded" % layer.name))
+ print >> sys.stderr, _("Loading raster map <%s> failed") % layer.name
self.layers['raster']['name'].append(layer.name)
self.layers['raster']['id'].append(id)
@@ -475,8 +474,9 @@
id = data['surface']['object']['id']
if self.nvizClass.UnloadSurface(id) == 0:
- raise gcmd.NvizError(parent=self.parent,
- message=_("Unable to unload raster map <%s>" % layer.name))
+ print >> sys.stderr, _("Unable to unload raster map <%s>") % layer.name
+ else:
+ print _("Raster map <%s> unloaded") % layer.name
data['surface'].pop('object')
@@ -629,10 +629,10 @@
id = self.nvizClass.LoadVector(str(layer.name), True)
if id < 0:
- print >> sys.stderr, _("Vector map <%s> (%s) not loaded") % \
+ print >> sys.stderr, _("Loading vector map <%s> (%s) failed") % \
(layer.name, type)
continue
-
+
# update layer properties
self.SetLayerData(item, id, type)
@@ -679,9 +679,13 @@
else:
ret = self.nvizClass.UnloadVector(id, True)
if ret == 0:
- raise gcmd.NvizError(parent=self.parent,
- message=_("Unable to unload vector map <%s>" % layer.name))
+ print >> sys.stderr, _("Unable to unload vector map <%s> (%s)") % \
+ (layer.name, vtype)
+ else:
+ print >> sys.stderr, _("Vector map <%s> (%s) unloaded") % \
+ (layer.name, vtype)
+
data[vtype].pop('object')
idx = self.layers['v' + vtype]['id'].index(id)
@@ -1496,6 +1500,16 @@
self.win['vector'] = {}
#
+ # desc
+ #
+ desc = wx.StaticText(parent=panel, id=wx.ID_ANY,
+ label="")
+ self.win['vector']['desc'] = desc.GetId()
+ pageSizer.Add(item=desc, proportion=0,
+ flag=wx.EXPAND | wx.ALL,
+ border=10)
+
+ #
# vector lines
#
self.win['vector']['lines'] = {}
@@ -1506,7 +1520,7 @@
showLines.Bind(wx.EVT_CHECKBOX, self.OnVectorShow)
pageSizer.Add(item=showLines, proportion=0,
- flag=wx.ALL | wx.EXPAND, border=5)
+ flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
box = wx.StaticBox (parent=panel, id=wx.ID_ANY,
label=" %s " % (_("Vector lines")))
@@ -2846,6 +2860,26 @@
self.SetSurfaceWireColor(color.GetColour())
def UpdateVectorPage(self, layer, data):
+ vInfo = gcmd.Command(['v.info',
+ 'map=%s' % layer.name])
+ for line in vInfo.ReadStdOutput():
+ if 'Map is 3D' in line:
+ mapIs3D = int(line.replace('|', '').split(':')[1].strip())
+ break
+ if mapIs3D:
+ desc = _("Vector map <%s> is 3D") % layer.name
+ enable = False
+ else:
+ desc = _("Vector map <%s> is 2D") % layer.name
+ enable = True
+
+ self.FindWindowById(self.win['vector']['lines']['flat']).Enable(enable)
+ for v in ('lines', 'points'):
+ self.FindWindowById(self.win['vector'][v]['surface']).Enable(enable)
+ self.FindWindowById(self.win['vector'][v]['height']['slider']).Enable(enable)
+ self.FindWindowById(self.win['vector'][v]['height']['spin']).Enable(enable)
+
+ self.FindWindowById(self.win['vector']['desc']).SetLabel(desc)
#
# lines
#
More information about the grass-commit
mailing list