[GRASS-SVN] r59910 - in grass/trunk/gui/wxpython: gui_core vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 23 12:23:04 PDT 2014


Author: martinl
Date: 2014-04-23 12:23:03 -0700 (Wed, 23 Apr 2014)
New Revision: 59910

Modified:
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI/vdigit: fix vdigit toolbar for simple features editing (work in progress)

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2014-04-23 18:58:35 UTC (rev 59909)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2014-04-23 19:23:03 UTC (rev 59910)
@@ -402,8 +402,9 @@
     if showType:
         cmd[1]['type'] = dlg.GetFeatureType()
         
+    curMapset = grass.gisenv()['MAPSET']
     if isNative:
-        listOfVectors = grass.list_grouped('vect')[grass.gisenv()['MAPSET']]
+        listOfVectors = grass.list_grouped('vect')[curMapset]
     else:
         listOfVectors = RunCommand('v.external',
                                    quiet = True,
@@ -438,7 +439,8 @@
         dlg.Destroy()
         return None
     
-    if not isNative:
+    if not isNative and \
+            not grass.find_file(outmap, element = 'vector', mapset = curMapset)['fullname']:
         # create link for OGR layers
         RunCommand('v.external',
                    overwrite = overwrite,

Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-04-23 18:58:35 UTC (rev 59909)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-04-23 19:23:03 UTC (rev 59910)
@@ -365,9 +365,9 @@
         menuItems = []
         if not self.tools or 'addArea' in self.tools:
             menuItems.append((self.icons["addArea"], self.OnAddArea))
-        if not self.tools or 'addBoundary' in self.tools:
+        if not self.fType and not self.tools or 'addBoundary' in self.tools:
             menuItems.append((self.icons["addBoundary"], self.OnAddBoundary))
-        if not self.tools or 'addCentroid' in self.tools:
+        if not self.fType and not self.tools or 'addCentroid' in self.tools:
             menuItems.append((self.icons["addCentroid"],  self.OnAddCentroid))
         
         self._onMenu(menuItems)
@@ -865,27 +865,25 @@
             return False
         
         # check feature type (only for OGR layers)
-        fType = self.digit.GetFeatureType()
+        self.fType = self.digit.GetFeatureType()
         self.EnableAll()
         self.EnableUndo(False)
         self.EnableRedo(False)
         
-        if fType == 'point':
-            for tool in (self.addLine, self.addBoundary, self.addCentroid,
-                         self.addArea, self.moveVertex, self.addVertex,
+        if self.fType == 'point':
+            for tool in (self.addLine, self.addArea, self.moveVertex, self.addVertex,
                          self.removeVertex, self.editLine):
                 self.EnableTool(tool, False)
-        elif fType == 'linestring':
-            for tool in (self.addPoint, self.addBoundary, self.addCentroid,
-                         self.addArea):
+        elif self.fType == 'linestring':
+            for tool in (self.addPoint, self.addArea):
                 self.EnableTool(tool, False)
-        elif fType == 'polygon':
-            for tool in (self.addPoint, self.addLine, self.addBoundary, self.addCentroid):
+        elif self.fType == 'polygon':
+            for tool in (self.addPoint, self.addLine):
                 self.EnableTool(tool, False)
-        elif fType:
+        elif self.fType:
             GError(parent = self,
                    message = _("Unsupported feature type '%(type)s'. Unable to edit "
-                               "OGR layer <%(layer)s>.") % { 'type' : fType,
+                               "OGR layer <%(layer)s>.") % { 'type' : self.fType,
                                                              'layer' : mapLayer.GetName() })
             self.digit.CloseMap()
             self.mapLayer = None



More information about the grass-commit mailing list