[GRASS-SVN] r59008 - grass/trunk/gui/wxpython/vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 12 10:59:46 PST 2014


Author: martinl
Date: 2014-02-12 10:59:46 -0800 (Wed, 12 Feb 2014)
New Revision: 59008

Modified:
   grass/trunk/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI: fix digitizer when opening vector map on level 1


Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-02-12 18:39:29 UTC (rev 59007)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py	2014-02-12 18:59:46 UTC (rev 59008)
@@ -16,7 +16,7 @@
 """
 import wx
 
-from grass.script import core as grass
+from grass import script as grass
 from grass.pydispatch.signal import Signal
 
 from gui_core.toolbars  import BaseToolbar, BaseIcons
@@ -822,6 +822,19 @@
 
         @param mapLayer MapLayer to be edited
         """
+        if grass.vector_info(mapLayer.GetName())['level'] != 2:
+            dlg = wx.MessageDialog(parent = self.MapWindow,
+                                   message = _("Topology for vector map <%s> is not available. "
+                                               "Topology is required by digitizer.\nDo you want to "
+                                               "rebuild topology (takes some time) and open the vector map "
+                                               "for editing?") % mapLayer.GetName(),
+                                   caption=_("Digitizer error"),
+                                   style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION | wx.CENTRE)
+            if dlg.ShowModal() == wx.ID_YES:
+                RunCommand('v.build', map=mapLayer.GetName())
+            else:
+                return
+        
         # deactive layer
         self.Map.ChangeLayerActive(mapLayer, False)
         



More information about the grass-commit mailing list