[GRASS-SVN] r62750 - grass/trunk/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 15 15:14:09 PST 2014


Author: martinl
Date: 2014-11-15 15:14:09 -0800 (Sat, 15 Nov 2014)
New Revision: 62750

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: add r|v.pack a r|v.unpack to layer manager's contextual menu


Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2014-11-15 20:44:27 UTC (rev 62749)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2014-11-15 23:14:09 UTC (rev 62750)
@@ -1131,10 +1131,12 @@
         """
         self._popupMenu((('rastImport',    self.OnImportGdalLayers),
                          ('rastLink',      self.OnLinkGdalLayers),
+                         ('rastUnpack',    self.OnUnpackRaster),
                          ('rastOut',       self.OnRasterOutputFormat),
                          (None, None),
                          ('vectImport',    self.OnImportOgrLayers),
                          ('vectLink',      self.OnLinkOgrLayers),
+                         ('vectUnpack',    self.OnUnpackVector),
                          ('vectOut',       self.OnVectorOutputFormat)))
         
     def OnWorkspaceNew(self, event = None):
@@ -1648,7 +1650,15 @@
         dlg = GdalOutputDialog(parent = self, ogr = True)
         dlg.CentreOnScreen()
         dlg.Show()
-    
+
+    def OnUnpackRaster(self, event):
+        """Unpack raster map handler"""
+        self.OnMenuCmd(cmd = ['r.unpack'])
+
+    def OnUnpackVector(self, event):
+        """Unpack vector map handler"""
+        self.OnMenuCmd(cmd = ['v.unpack'])
+
     def OnImportDxfFile(self, event, cmd = None):
         """Convert multiple DXF layers to GRASS vector map layers"""
         dlg = DxfImportDialog(parent = self, giface = self._giface)

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2014-11-15 20:44:27 UTC (rev 62749)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2014-11-15 23:14:09 UTC (rev 62750)
@@ -6,7 +6,7 @@
 Classes:
  - layertree::LayerTree
 
-(C) 2007-2013 by the GRASS Development Team
+(C) 2007-2014 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -56,12 +56,16 @@
                             label = _('Import raster data')),
     'rastLink'   : MetaIcon(img = 'layer-import',
                             label = _('Link external raster data')),
+    'rastUnpack' : MetaIcon(img = 'layer-import',
+                            label = _('Unpack raster map')),
     'rastOut'    : MetaIcon(img = 'layer-export',
                             label = _('Set raster output format')),
     'vectImport' : MetaIcon(img = 'layer-import',
                             label = _('Import vector data')),
     'vectLink'   : MetaIcon(img = 'layer-import',
                                     label = _('Link external vector data')),
+    'vectUnpack' : MetaIcon(img = 'layer-import',
+                            label = _('Unpack vector map')),
     'vectOut'    : MetaIcon(img = 'layer-export',
                             label = _('Set vector output format')),
     'wmsImport'  : MetaIcon(img = 'layer-wms-add',
@@ -384,7 +388,7 @@
                         'region', 'export', 'attr', 'edit', 'save_ws',
                         'bgmap', 'topo', 'meta', 'null', 'zoom1', 'region1',
                         'color', 'hist', 'univar', 'prof', 'properties', 'sql', 'copy',
-                        'report', 'export-pg'):
+                        'report', 'export-pg', 'pack'):
                 self.popupID[key] = wx.NewId()
         
         # get current mapset
@@ -467,6 +471,12 @@
                       id = self.popupID['export-pg'])
             if 'v.out.postgis' not in globalvar.grassCmd:
                 self.popupMenu.Enable(self.popupID['export-pg'], False)
+
+            item = wx.MenuItem(self.popupMenu, id = self.popupID['pack'], text = _("Create pack"))
+            self.popupMenu.AppendItem(item)
+            self.Bind(wx.EVT_MENU, lambda x: self.lmgr.OnMenuCmd(cmd = ['v.pack',
+                                                                        'input=%s' % mapLayer.GetName()]),
+                      id = self.popupID['pack'])
             
             lmapset = self.GetLayerInfo(self.layer_selected, key = 'maplayer').GetMapset()
             if lmapset != currentMapset:
@@ -562,6 +572,12 @@
                                                                             'input=%s' % mapLayer.GetName()]),
                           id = self.popupID['export'])
 
+                item = wx.MenuItem(self.popupMenu, id = self.popupID['pack'], text = _("Create pack"))
+                self.popupMenu.AppendItem(item)
+                self.Bind(wx.EVT_MENU, lambda x: self.lmgr.OnMenuCmd(cmd = ['r.pack',
+                                                                            'input=%s' % mapLayer.GetName()]),
+                          id = self.popupID['pack'])
+                
                 lmapset = self.GetLayerInfo(self.layer_selected, key = 'maplayer').GetMapset()
                 if lmapset != currentMapset:
                     self.popupMenu.Append(self.popupID['copy'], text = _("Make a copy in the current mapset"))



More information about the grass-commit mailing list