[GRASS-SVN] r58739 - in grass/trunk/gui/wxpython: iclass vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 17 10:25:29 PST 2014


Author: martinl
Date: 2014-01-17 10:25:29 -0800 (Fri, 17 Jan 2014)
New Revision: 58739

Modified:
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/vdigit/wxdigit.py
   grass/trunk/gui/wxpython/vdigit/wxdisplay.py
Log:
g.gui.iclass: allow to import training areas from other mapsets


Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2014-01-17 12:26:51 UTC (rev 58738)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2014-01-17 18:25:29 UTC (rev 58739)
@@ -567,12 +567,12 @@
         
         wx.BeginBusyCursor()
         wx.Yield()
-
+        
         # close, build, copy and open again the temporary vector
         digitClass = self.GetFirstWindow().GetDigit()
         
         # open vector map to be imported
-        if digitClass.OpenMap(vector) is None:
+        if digitClass.OpenMap(vector, update=False) is None:
             GError(parent = self, message = _("Unable to open vector map <%s>") % vector)
             return
         

Modified: grass/trunk/gui/wxpython/vdigit/wxdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdigit.py	2014-01-17 12:26:51 UTC (rev 58738)
+++ grass/trunk/gui/wxpython/vdigit/wxdigit.py	2014-01-17 18:25:29 UTC (rev 58739)
@@ -1611,7 +1611,7 @@
         """!Get display driver instance"""
         return self._display
     
-    def OpenMap(self, name, tmp = False):
+    def OpenMap(self, name, update=True, tmp = False):
         """!Open vector map for editing
         
         @param map name of vector map to be set up
@@ -1624,7 +1624,7 @@
         else:
             mapset = grass.gisenv()['MAPSET']
         
-        self.poMapInfo = self._display.OpenMap(str(name), str(mapset), True, tmp)
+        self.poMapInfo = self._display.OpenMap(str(name), str(mapset), update, tmp)
         
         if self.poMapInfo:
             self.InitCats()

Modified: grass/trunk/gui/wxpython/vdigit/wxdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdisplay.py	2014-01-17 12:26:51 UTC (rev 58738)
+++ grass/trunk/gui/wxpython/vdigit/wxdisplay.py	2014-01-17 18:25:29 UTC (rev 58739)
@@ -884,16 +884,18 @@
         @return 0 on success
         @return non-zero on error
         """
-        ret = 0
-        if self.poMapInfo:
+        if not self.poMapInfo:
+            return 0
+
+        if self.poMapInfo.contents.mode == GV_MODE_RW:
             # rebuild topology
             Vect_build_partial(self.poMapInfo, GV_BUILD_NONE)
             Vect_build(self.poMapInfo)
 
-            # close map and store topo/cidx
-            ret = Vect_close(self.poMapInfo)
-            del self.mapInfo
-            self.poMapInfo = self.mapInfo = None
+        # close map and store topo/cidx
+        ret = Vect_close(self.poMapInfo)
+        del self.mapInfo
+        self.poMapInfo = self.mapInfo = None
         
         return ret
     



More information about the grass-commit mailing list