[GRASS-SVN] r41577 - in grass/branches/develbranch_6/gui/wxpython: gui_modules vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 27 09:30:34 EDT 2010


Author: martinl
Date: 2010-03-27 09:30:34 -0400 (Sat, 27 Mar 2010)
New Revision: 41577

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
   grass/branches/develbranch_6/gui/wxpython/vdigit/undo.cpp
Log:
wxGUI/vdigit: fix undo tool (changesets start at 0)
(merge r41576 from relbr64)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-03-27 13:25:27 UTC (rev 41576)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-03-27 13:30:34 UTC (rev 41577)
@@ -1166,7 +1166,7 @@
         if self.mapLayer:
             Debug.msg (4, "VDigitToolbar.StopEditing(): layer=%s" % self.mapLayer.GetName())
             if UserSettings.Get(group='vdigit', key='saveOnExit', subkey='enabled') is False:
-                if self.parent.digit.GetUndoLevel() > 0:
+                if self.parent.digit.GetUndoLevel() > -1:
                     dlg = wx.MessageDialog(parent=self.parent,
                                            message=_("Do you want to save changes "
                                                      "in vector map <%s>?") % self.mapLayer.GetName(),
@@ -1176,7 +1176,7 @@
                         # revert changes
                         self.parent.digit.Undo(0)
                     dlg.Destroy()
-        
+            
             self.parent.statusbar.SetStatusText(_("Please wait, "
                                                   "closing and rebuilding topology of "
                                                   "vector map <%s>...") % self.mapLayer.GetName(),

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2010-03-27 13:25:27 UTC (rev 41576)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/vdigit.py	2010-03-27 13:30:34 UTC (rev 41577)
@@ -3,7 +3,7 @@
 
 @brief Vector digitizer extension
 
-Import:
+Usage:
 
 @code
   from vdigit import VDigit as VDigit
@@ -20,12 +20,10 @@
  - VDigitDuplicatesDialog
  - VDigitVBuildDialog
 
-(C) 2007-2009 by the GRASS Development Team
+(C) 2007-2010 by the GRASS Development Team
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
 
-This program is free software under the GNU General Public
-License (>=v2). Read the file COPYING that comes with GRASS
-for details.
-
 @author Martin Landa <landa.martin gmail.com>
 """
 
@@ -705,7 +703,10 @@
             self.toolbar.EnableUndo(False)
 
     def GetUndoLevel(self):
-        """!Get undo level (number of active changesets)"""
+        """!Get undo level (number of active changesets)
+        
+        Note: Changesets starts wiht 0
+        """
         if not self.digit:
             return -1
         

Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/undo.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/undo.cpp	2010-03-27 13:25:27 UTC (rev 41576)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/undo.cpp	2010-03-27 13:30:34 UTC (rev 41577)
@@ -7,7 +7,7 @@
    License (>=v2). Read the file COPYING that comes with GRASS
    for details.
 
-   (C) 2008-2009 by Martin Landa, and the GRASS development team
+   (C) 2008-2010 by Martin Landa, and the GRASS development team
 
    \author Martin Landa <landa.martin gmail.com>
 */
@@ -44,7 +44,7 @@
 
     if (level == 0) {
 	/* 0 -> undo all */
-	level = -changesetLast;
+	level = -(changesetLast + 1);
     }
 
     G_debug(2, "Digit.Undo(): changeset_last=%d, changeset_current=%d, level=%d",



More information about the grass-commit mailing list