[GRASS-dev] Re: [grass-addons] r659 - trunk/grassaddons/gui/gui_modules

Michael Barton michael.barton at asu.edu
Wed May 16 11:37:32 EDT 2007


Seems like a good idea, especially for updating in the future. For all new
commands, I'll follow this syntax. As we all have time, we can go back and
change the existing code. It shouldn't be a huge task.

Michael


On 5/16/07 8:32 AM, "Martin Landa" <landa.martin at gmail.com> wrote:

> Michael,
> 
> 2007/5/16, Michael Barton <michael.barton at asu.edu>:
> 
>> Are you thinking that we should change all calls to GRASS commands to use
>> the new cmd module?
> 
> yes, I think so.
> 
> Martin
> 
>> Michael
>> 
>> 
>> On 5/16/07 2:09 AM, "landa at grass.itc.it" <landa at grass.itc.it> wrote:
>> 
>>> Author: landa
>>> Date: 2007-05-16 11:09:42 +0200 (Wed, 16 May 2007)
>>> New Revision: 659
>>> 
>>> Modified:
>>>    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()
>>>              return
>>> 
>>>          wind = 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 at 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
>> 
>> 
>> 
> 

__________________________________________
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





More information about the grass-dev mailing list