[GRASS-SVN] r45566 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 5 10:18:06 EST 2011


Author: martinl
Date: 2011-03-05 07:18:06 -0800 (Sat, 05 Mar 2011)
New Revision: 45566

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
Log:
#1299 (Provide user-friendly error message when trying to edit vectors in Windows)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py	2011-03-05 14:31:02 UTC (rev 45565)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py	2011-03-05 15:18:06 UTC (rev 45566)
@@ -537,32 +537,9 @@
         
         if not self.mapdisplay.toolbars['vdigit']: # enable tool
             self.mapdisplay.AddToolbar('vdigit')
-        else: # tool already enabled
-            pass
         
-        # mark layer as 'edited'
-                
-        if not self.mapdisplay.toolbars['vdigit'].StartEditing(maplayer) or \
-                not haveVDigit:
-            if not haveVDigit:
-                from vdigit import errorMsg
-            else:
-                errorMsg = _("Unable to initialize display driver of vector "
-                             "digitizer")
-            msg = _("Unable to start wxGUI vector digitizer.\nDo you want to start "
-                    "TCL/TK digitizer (v.digit) instead?\n\n"
-                    "Details: %s" % errorMsg)
-            
-            self.mapdisplay.toolbars['map'].combo.SetValue (_("2D view"))
-            dlg = wx.MessageDialog(parent = self.mapdisplay,
-                                   message = msg,
-                                   caption=_("Vector digitizer failed"),
-                                   style = wx.YES_NO | wx.CENTRE)
-            if dlg.ShowModal() == wx.ID_YES:
-                self.lmgr.goutput.RunCmd(['v.digit', 'map=%s' % maplayer.GetName()],
-                                         switchPage=False)
-            
-            dlg.Destroy()
+        if self.mapdisplay.toolbars['vdigit']:
+            self.mapdisplay.toolbars['vdigit'].StartEditing(maplayer)
         
     def OnStopEditing(self, event):
         """

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2011-03-05 14:31:02 UTC (rev 45565)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py	2011-03-05 15:18:06 UTC (rev 45566)
@@ -330,14 +330,15 @@
                         "TCL/TK digitizer (v.digit) instead?\n\n"
                         "Details: %s" % errorMsg)
                 
-                self.mapdisplay.toolbars['map'].combo.SetValue (_("2D view"))
-                dlg = wx.MessageDialog(parent = self.mapdisplay,
+                self.toolbars['map'].combo.SetValue (_("2D view"))
+                dlg = wx.MessageDialog(parent = self,
                                        message = msg,
                                        caption=_("Vector digitizer failed"),
                                        style = wx.YES_NO | wx.CENTRE)
                 if dlg.ShowModal() == wx.ID_YES:
-                    self.lmgr.goutput.RunCmd(['v.digit', 'map=%s' % maplayer.GetName()],
-                                             switchPage=False)
+                    mapName = self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].GetName()
+                    self._layerManager.goutput.RunCmd(['v.digit', 'map=%s' % mapName],
+                                                      switchPage=False)
                 dlg.Destroy()
                 
                 self.toolbars['map'].combo.SetValue (_("2D view"))



More information about the grass-commit mailing list