[GRASS-SVN] r46277 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 14 13:09:33 EDT 2011
Author: mmetz
Date: 2011-05-14 10:09:33 -0700 (Sat, 14 May 2011)
New Revision: 46277
Modified:
grass/trunk/gui/wxpython/gui_modules/gcmd.py
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
add debug info, bug fix
Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py 2011-05-14 15:30:59 UTC (rev 46276)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py 2011-05-14 17:09:33 UTC (rev 46277)
@@ -597,29 +597,48 @@
ps = grass.start_command(prog, flags, overwrite, quiet, verbose, **kwargs)
+ Debug.msg(1, "gcmd.RunCommand(): command started")
+
if stdin:
ps.stdin.write(stdin)
ps.stdin.close()
ps.stdin = None
+ Debug.msg(1, "gcmd.RunCommand(): decoding string")
stdout, stderr = map(lambda x: utils.DecodeString(x) if type(x) is types.StringType else x, ps.communicate())
+ Debug.msg(1, "gcmd.RunCommand(): get return code")
ret = ps.returncode
- if ret != 0 and parent:
- GError(parent = parent,
- message = stderr)
+ Debug.msg(1, "gcmd.RunCommand(): print error")
+ if ret != 0 and parent:
+ Debug.msg(1, "gcmd.RunCommand(): error %s" % stderr)
+ if (stderr == None):
+ Debug.msg(1, "gcmd.RunCommand(): nothing to print ???")
+ else:
+ GError(parent = parent,
+ message = stderr)
+
+ if ret != 0:
+ return None
+ Debug.msg(1, "gcmd.RunCommand(): print read error")
if not read:
if not getErrorMsg:
return ret
else:
return ret, _formatMsg(stderr)
+ if stdout:
+ Debug.msg(1, "gcmd.RunCommand(): return stdout %s" % stdout)
+ else:
+ Debug.msg(1, "gcmd.RunCommand(): return stdout = None")
if not getErrorMsg:
return stdout
+ Debug.msg(1, "gcmd.RunCommand(): return ret, stdout")
if read and getErrorMsg:
return ret, stdout, _formatMsg(stderr)
+ Debug.msg(1, "gcmd.RunCommand(): return result")
return stdout, _formatMsg(stderr)
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-05-14 15:30:59 UTC (rev 46276)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-05-14 17:09:33 UTC (rev 46277)
@@ -658,14 +658,15 @@
"""!Insert layers for a vector into the layer combobox"""
layerchoices = utils.GetVectorNumberOfLayers(self, vector)
- if self.all:
+ if self.all or len(layerchoices) == 0:
layerchoices.insert(0, '-1')
if len(layerchoices) > 1:
self.SetItems(layerchoices)
self.SetStringSelection('1')
- else:
- self.SetItems(['1'])
- self.SetStringSelection('1')
+ elif len(layerchoices) == 1:
+ print layerchoices[0]
+ self.SetItems(layerchoices)
+ self.SetStringSelection(layerchoices[0])
if self.default:
self.SetStringSelection(str(self.default))
Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py 2011-05-14 15:30:59 UTC (rev 46276)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py 2011-05-14 17:09:33 UTC (rev 46277)
@@ -294,6 +294,8 @@
if not ret:
return layers
+ else:
+ Debug.msg(1, "GetVectorNumberOfLayers(): ret %s" % ret)
for line in ret.splitlines():
try:
More information about the grass-commit
mailing list