[GRASS-SVN] r58019 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 16 12:10:49 PDT 2013
Author: martinl
Date: 2013-10-16 12:10:48 -0700 (Wed, 16 Oct 2013)
New Revision: 58019
Modified:
grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: add r.report to the raster layer contextual menu
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2013-10-16 18:57:51 UTC (rev 58018)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2013-10-16 19:10:48 UTC (rev 58019)
@@ -404,7 +404,8 @@
for key in ('remove', 'rename', 'opacity', 'nviz', 'zoom',
'region', 'export', 'attr', 'edit0', 'edit1', 'save_ws',
'bgmap', 'topo', 'meta', 'null', 'zoom1', 'region1',
- 'color', 'hist', 'univar', 'prof', 'properties', 'sql', 'copy'):
+ 'color', 'hist', 'univar', 'prof', 'properties', 'sql', 'copy',
+ 'report'):
self.popupID[key] = wx.NewId()
# get current mapset
@@ -565,7 +566,9 @@
self.Bind (wx.EVT_MENU, self.OnHistogram, id = self.popupID['hist'])
self.popupMenu.Append(self.popupID['univar'], _("Univariate raster statistics"))
self.Bind (wx.EVT_MENU, self.OnUnivariateStats, id = self.popupID['univar'])
-
+ self.popupMenu.Append(self.popupID['report'], text = _("Report raster statistics"))
+ self.Bind(wx.EVT_MENU, self.OnReportStats, id = self.popupID['report'])
+
if numSelected == 1:
self.popupMenu.Append(self.popupID['prof'], _("Profile"))
self.Bind (wx.EVT_MENU, self.OnProfile, id = self.popupID['prof'])
@@ -816,6 +819,17 @@
if raster3d:
self._giface.RunCmd(['r3.univar', 'map=%s' % ','.join(raster3d)], switchPage=True)
+ def OnReportStats(self, event):
+ """!Print 2D statistics"""
+ rasters = []
+ # TODO: Implement self.GetSelectedLayers(ltype='raster')
+ for layer in self.GetSelectedLayers():
+ if self.GetLayerInfo(layer, key='type') == 'raster':
+ rasters.append(self.GetLayerInfo(layer, key = 'maplayer').GetName())
+
+ if rasters:
+ self._giface.RunCmd(['r.report', 'map=%s' % ','.join(rasters), 'units=h,c,p'], switchPage=True)
+
def OnStartEditing(self, event):
"""!Start editing vector map layer requested by the user
"""
More information about the grass-commit
mailing list