[GRASS-SVN] r29504 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 26 07:10:53 EST 2007


Author: martinl
Date: 2007-12-26 07:10:47 -0500 (Wed, 26 Dec 2007)
New Revision: 29504

Modified:
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: New item in contextual menu - print metadata of raster/vector map layers (r./v.info)

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2007-12-25 22:53:53 UTC (rev 29503)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2007-12-26 12:10:47 UTC (rev 29504)
@@ -215,7 +215,8 @@
             self.popupID4 = wx.NewId()
             self.popupID5 = wx.NewId()
             self.popupID6 = wx.NewId()
-
+            self.popupID7 = wx.NewId()
+            
         self.popupMenu = wx.Menu()
         # general item
         self.popupMenu.Append(self.popupID1, text=_("Remove"))
@@ -272,10 +273,29 @@
             self.popupMenu.Append(self.popupID4, _("Histogram"))
             self.Bind (wx.EVT_MENU, self.OnHistogram, id=self.popupID4)
 
+        self.popupMenu.Append(self.popupID7, _("Metadata"))
+        self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID7)
+
         ## self.PopupMenu(self.popupMenu, pos)
         self.PopupMenu(self.popupMenu)
         self.popupMenu.Destroy()
 
+    def OnMetadata(self, event):
+        """Print metadata of raster/vector map layer
+        TODO: Dialog to modify metadata
+        """
+        mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
+        mltype = self.GetPyData(self.layer_selected)[0]['type']
+
+        if mltype == 'raster':
+            cmd = ['r.info']
+        elif mltype == 'vector':
+            cmd = ['v.info']
+        cmd.append('map=%s' % mapLayer.name)
+
+        # print output to command log area
+        self.gismgr.goutput.RunCmd(cmd)
+
     def OnHistogram(self, event):
         """
         Plot histogram for given raster map layer



More information about the grass-commit mailing list