[GRASS-SVN] r49167 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 10 05:47:10 EST 2011
Author: martinl
Date: 2011-11-10 02:47:10 -0800 (Thu, 10 Nov 2011)
New Revision: 49167
Modified:
grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
Log:
wxGUI/vdigit: more detailed error message when action fails
Modified: grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdigit.py 2011-11-10 09:46:21 UTC (rev 49166)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdigit.py 2011-11-10 10:47:10 UTC (rev 49167)
@@ -29,7 +29,7 @@
from debug import Debug
from preferences import globalSettings as UserSettings
-from wxvdriver import DisplayDriver
+from wxvdriver import DisplayDriver, GetLastError
from grass.lib.gis import *
from grass.lib.vector import *
@@ -61,7 +61,8 @@
"""!Writing line failed
"""
GError(message = _('Writing new feature failed. '
- 'Operation cancelled.'),
+ 'Operation cancelled.\n\n'
+ 'Reason: %s') % GetLastError(),
parent = self.parent,
caption = self.caption)
Modified: grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-11-10 09:46:21 UTC (rev 49166)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-11-10 10:47:10 UTC (rev 49167)
@@ -29,8 +29,9 @@
from grass.lib.vector import *
from grass.lib.vedit import *
-log = None
-progress = None
+log = None
+progress = None
+last_error = ''
def print_error(msg, type):
"""!Redirect stderr"""
@@ -39,7 +40,9 @@
log.write(msg)
else:
print msg
-
+ global last_error
+ last_error += ' ' + msg
+
return 0
def print_progress(value):
@@ -52,6 +55,16 @@
return 0
+def GetLastError():
+ global last_error
+ ret = last_error
+ if ret[-1] != '.':
+ ret += '.'
+
+ last_error = '' # reset
+
+ return ret
+
errtype = CFUNCTYPE(UNCHECKED(c_int), String, c_int)
errfunc = errtype(print_error)
pertype = CFUNCTYPE(UNCHECKED(c_int), c_int)
@@ -76,6 +89,7 @@
locale.setlocale(locale.LC_NUMERIC, 'C')
G_set_error_routine(errfunc)
G_set_percent_routine(perfunc)
+ # G_set_fatal_error(FATAL_RETURN)
self.mapInfo = None # open vector map (Map_Info structure)
self.poMapInfo = None # pointer to self.mapInfo
More information about the grass-commit
mailing list