[GRASS-dev] Shell scripts

Huidae Cho grass4u at gmail.com
Sat Dec 5 20:02:51 EST 2009


Glynn,

Current python implementation is not meant to be a permanent solution
because we cannot just write a python wrapper for every single display
command (including new ones).  Shell versions didn't work correctly
either because of wrong command lines they write to GRASS_PYCMDFILE or
the bug in the GUI that I've fixed.

What the new python scripts do is to append d.* command lines to
GRASS_PYCMDFILE.  Then, the GUI picks up the file and renders new
images.  Your suggestion should work fine and looks very useful.  One
concern is that not all d.* commands render on the GUI (e.g., d.font,
d.fontlist).  However, this can be taken care of in the GUI, I think.

I vote for extending R_open_driver().

Huidae


On Sat, Dec 05, 2009 at 10:20:08AM +0000, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > > The remaining question is whether d.path.sh and the p.* scripts should
> > > be converted to Python or removed. I don't think that d.path.sh works
> > > with the GUI. The p.* scripts appear to be an attempt to implement
> > > d.mon-like behaviour for the GUI, but I don't know whether this is
> > > functional.
> > 
> > The p.* scripts are semi-functional and should be rewritten to Python.
> > Not having d.mon/d.rast/d.vect/d.zoom commands is for me, Helena, others
> > the obstacle to not use GRASS 7 as primary version.
> > Since the needed (wx)GUI pieces are there, I still hope that someone skilled
> > is rewriting it in Python. For us it is essential to continue with command line
> > in GRASS 7.
> 
> So now we have both shell and python versions, and still no actual
> explanation.
> 
> AFAICT, the GUI has a mode where writing commands to the file
> specified by the GRASS_PYCMDFILE GRASS variable will cause them to be
> picked up by the GUI, right?
> 
> In which case, wouldn't a more useful approach be to extend
> R_open_driver() with e.g.:
> 
> 	const char *cmdfile = G__getenv("GRASS_PYCMDFILE");
> 	if (cmdfile) {
> 	    FILE *fp = fopen(cmdfile, "a");
> 	    if (fp) {
> 	        fprintf(fp, "%s\n", G_recreate_command());
> 	        exit(0);
> 	    }
> 	}
> 
> so that you can automatically redirect all d.* commands to the GUI?
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list