Martin,
Are you thinking that we should change all calls to GRASS commands to use
the new cmd module?
Michael
On 5/16/07 2:09 AM, "landa@grass.itc.it" <landa@grass.itc.it> wrote:
Author: landa
Date: 2007-05-16 11:09:42 +0200 (Wed, 16 May 2007)
New Revision: 659Modified:
trunk/grassaddons/gui/gui_modules/mapdisp.py
Log:
fixing 'Zoom to saved region'Modified: trunk/grassaddons/gui/gui_modules/mapdisp.py
--- trunk/grassaddons/gui/gui_modules/mapdisp.py 2007-05-15 23:55:41 UTC (rev
658)
+++ trunk/grassaddons/gui/gui_modules/mapdisp.py 2007-05-16 09:09:42 UTC (rev
659)
@@ -851,21 +851,21 @@
zoomreg = {}dlg = SavedRegion(self, wx.ID_ANY, "Zoom to saved region extents",
- pos=wx.DefaultPosition, size=wx.DefaultSize,
- style=wx.DEFAULT_DIALOG_STYLE,
- loadsave='load')
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE,
+ loadsave='load')if dlg.ShowModal() == wx.ID_CANCEL:
dlg.Destroy()
returnwind = dlg.wind
- cmd = "g.region -ugp region=%s" % wind
+ cmdString = "g.region -ugp region=%s" % wind- try:
- p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True)
+ p = cmd.Command (cmdString)- output = p.stdout.read().split('\n')
+ if p.returncode == 0:
+ output = p.module_stdout.read().split('\n')
for line in output:
line = line.strip()
if '=' in line: key,val = line.split('=')
@@ -877,14 +877,6 @@
self.ZoomHistory(self.Map.region['n'],self.Map.region['s'],self.Map.region['e'
],self.Map.region['w'])
self.UpdateMap()- if p.stdout < 0:
- print >> sys.stderr, "Child was terminated by signal",
p.stdout
- elif p.stdout > 0:
- #print >> sys.stderr, p.stdout
- pass
- except OSError, e:
- print >> sys.stderr, "Execution failed:", e
-
dlg.Destroy()def SaveDisplayRegion(self, event):
_______________________________________________
grass-commit-addons mailing list
grass-commit-addons@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-commit-addons
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton