[GRASS-SVN] r57420 - in grass/trunk/gui/wxpython: lmgr mapdisp wxplot
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 5 13:44:24 PDT 2013
Author: wenzeslaus
Date: 2013-08-05 13:44:24 -0700 (Mon, 05 Aug 2013)
New Revision: 57420
Modified:
grass/trunk/gui/wxpython/lmgr/layertree.py
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/wxplot/profile.py
Log:
wxGUI/profile: improved parameters for profile frame, fixing start of profile tool from lmgr
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2013-08-05 20:36:39 UTC (rev 57419)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2013-08-05 20:44:24 UTC (rev 57420)
@@ -638,20 +638,9 @@
message = _("Unable to create profile of "
"raster map."),
caption = _("Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
- return False
+ return
+ self.mapdisplay.Profile(rasters=[mapLayer.GetName()])
- if not hasattr (self, "profileFrame"):
- self.profileFrame = None
-
- if hasattr (self.mapdisplay, "profile") and self.mapdisplay.profile:
- self.profileFrame = self.mapdisplay.profile
-
- if not self.profileFrame:
- self.profileFrame = ProfileFrame(parent = self.mapdisplay, mapwindow = self.mapdisplay.GetMapWindow(),
- rasterList = [mapLayer.GetName()])
- # show new display
- self.profileFrame.Show()
-
def OnRasterColorTable(self, event):
"""!Set color table for raster map"""
name = self.GetLayerInfo(self.layer_selected, key = 'maplayer').GetName()
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2013-08-05 20:36:39 UTC (rev 57419)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2013-08-05 20:44:24 UTC (rev 57420)
@@ -869,17 +869,20 @@
def OnProfile(self, event):
"""!Launch profile tool
"""
- self.profileController = ProfileController(self._giface, mapWindow=self.GetMapWindow())
rasters = []
layers = self._giface.GetLayerList().GetSelectedLayers()
for layer in layers:
if layer.type == 'raster':
rasters.append(layer.maplayer.name)
+ self.Profile(rasters=rasters)
+ def Profile(self, rasters=None):
+ """!Launch profile tool"""
+ self.profileController = ProfileController(self._giface,
+ mapWindow=self.GetMapWindow())
win = ProfileFrame(parent=self, rasterList=rasters,
+ units=self.Map.projinfo['units'],
controller=self.profileController)
-
- win.CentreOnParent()
win.Show()
# Open raster select dialog to make sure that a raster (and
# the desired raster) is selected to be profiled
Modified: grass/trunk/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/profile.py 2013-08-05 20:36:39 UTC (rev 57419)
+++ grass/trunk/gui/wxpython/wxplot/profile.py 2013-08-05 20:44:24 UTC (rev 57420)
@@ -43,8 +43,8 @@
class ProfileFrame(BasePlotFrame):
"""!Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot.
"""
- def __init__(self, parent, controller, size=wx.Size(700, 400),
- rasterList = [], **kwargs):
+ def __init__(self, parent, controller, units, size=wx.Size(700, 400),
+ rasterList = None, **kwargs):
BasePlotFrame.__init__(self, parent=parent, size=size, **kwargs)
self.controller = controller
@@ -53,11 +53,15 @@
self.toolbar = ProfileToolbar(parent = self)
self.SetToolBar(self.toolbar)
self.SetTitle(_("GRASS Profile Analysis Tool"))
-
+ self._units = units
+
#
# Init variables
#
- self.rasterList = rasterList
+ if rasterList is None:
+ self.rasterList = []
+ else:
+ self.rasterList = rasterList
self.plottype = 'profile'
self.coordstr = '' # string of coordinates for r.profile
self.seglist = [] # segment endpoint list
@@ -76,8 +80,10 @@
self.raster = {}
# determine units (axis labels)
- if self.parent.Map.projinfo['units'] != '':
- self.xlabel = _('Distance (%s)') % self.parent.Map.projinfo['units']
+ # maybe, we should not accept these invalid units
+ # but ok, trying to handle it here
+ if self._units is not None and self._units != '':
+ self.xlabel = _('Distance (%s)') % self._units
else:
self.xlabel = _("Distance along transect")
self.ylabel = _("Cell values")
More information about the grass-commit
mailing list