[GRASS-SVN] r42873 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 21 15:16:16 EDT 2010


Author: martinl
Date: 2010-07-21 19:16:16 +0000 (Wed, 21 Jul 2010)
New Revision: 42873

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
Log:
wxGUI: fix r42872


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-07-21 11:57:16 UTC (rev 42872)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2010-07-21 19:16:16 UTC (rev 42873)
@@ -516,8 +516,20 @@
             event.Skip()
             return
         
-        if not haveVDigit:
-            from vdigit import errorMsg
+        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)
@@ -532,16 +544,7 @@
                                          switchPage=False)
             
             dlg.Destroy()
-            return
         
-        if not self.mapdisplay.toolbars['vdigit']: # enable tool
-            self.mapdisplay.AddToolbar('vdigit')
-        else: # tool already enabled
-            pass
-
-        # mark layer as 'edited'
-        self.mapdisplay.toolbars['vdigit'].StartEditing (maplayer)
-
     def OnStopEditing(self, event):
         """
         Stop editing the current vector map layer

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-07-21 11:57:16 UTC (rev 42872)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-07-21 19:16:16 UTC (rev 42873)
@@ -1104,17 +1104,13 @@
         return True
     
     def StartEditing (self, mapLayer):
-        """
-        Start editing selected vector map layer.
-
+        """!Start editing selected vector map layer.
+        
         @param mapLayer reference to MapLayer instance
         """
         # deactive layer
         self.mapcontent.ChangeLayerActive(mapLayer, False)
         
-        # clean map canvas
-        ### self.parent.MapWindow.EraseMap()
-        
         # unset background map if needed
         if mapLayer:
             if UserSettings.Get(group='vdigit', key='bgmap',
@@ -1137,18 +1133,16 @@
         self.mapLayer = mapLayer
         
         # open vector map
-        try:
-            if not self.parent.MapWindow.CheckPseudoDC():
-                raise gcmd.DigitError(parent=self.parent,
-                                      message=_("Unable to initialize display driver of vector "
-                                                "digitizer. See 'Command output' for details."))
-            self.parent.digit.SetMapName(mapLayer.GetName())
-        except gcmd.DigitError, e:
+        if not self.parent.MapWindow.CheckPseudoDC():
+            # gcmd.GMessage(parent = self.parent,
+            #              message = _("Unable to initialize display driver of vector "
+            #                          "digitizer. See 'Command output' for details."))
             self.mapLayer = None
             self.StopEditing()
-            print >> sys.stderr, e # wxMessageBox
             return False
         
+        self.parent.digit.SetMapName(mapLayer.GetName())
+        
         # update toolbar
         self.combo.SetValue(mapLayer.GetName())
         self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
@@ -1162,7 +1156,7 @@
         # create pseudoDC for drawing the map
         self.parent.MapWindow.pdcVector = vdigit.PseudoDC()
         self.parent.digit.driver.SetDevice(self.parent.MapWindow.pdcVector)
-
+        
         if not self.parent.MapWindow.resize:
             self.parent.MapWindow.UpdateMap(render=True)
         



More information about the grass-commit mailing list