[GRASSGUI] wxgrass gui status: was [GRASS-dev] Vect_snap_lines (list of lines)

Michael Barton michael.barton at asu.edu
Sat May 12 15:27:53 EDT 2007


Below is an example from the first part of the file. It is modeled on menu
structures from the wxPython book. The indents don't matter; they are only
to make it easier to work with.

Michael


On 5/12/07 11:30 AM, "Daniel Calvelo" <dca.gis at gmail.com> wrote:

> On 5/12/07, Glynn Clements <glynn at gclements.plus.com> wrote:
> [on dumping tcl's menu structure to python]
>>> But sadly, I would be able to cut and past the commands in
>>> less time than it would take me to figure out such a script.
>> 
>> Can you give an example of the required Python syntax?
> 
> It's in gui_modules/menudata.py and is modelled after gmmenu.tcl. It's
> just 4-tuples of strings (label, description, python command called,
> grass module), where all four empty means a separator. These are
> arranged in a tree (of tuples, but arrays would do) corresponding to
> the menu structure, as pairs of ("menu entry",child) with child being
> either a 4-tuple of entries or another pair.
> 
> The only tricky part is in those commands that require internal work
> by tcl (mostly the first menu item); the rest are mainly
> correspondences between menu items and grass commands.
> 
> I'd do that using a simple protocol (coding the python- ot
> tcl-specific parts as special codes) to access a configuration file in
> JSON, XML or tab-indented specifications. Not much time to do that
> right now, though.
> 
> Daniel.


        return [(
            ("Files", (
                ("Import", "Import files", "self.runMenuCmd", "r.in.gdal"),
                ("Export", "Export files", "self.runMenuCmd", "r.out.gdal"),
                ("","","", ""),
                ("E&xit", "Exit from wxgui.py", "self.onCloseWindow", "")
                )),
            ("Config", (
                ("Region", "Set region", "self.runMenuCmd", "g.region"),
                ("","","", ""),
                ("Set display font", "Set default font for GRASS displays",
"self.DefaultFont", ""),
                )),
            ("Raster", (
                ("Develop map", (
                    ("Digitize raster", "Digitize raster",
"self.runMenuCmd", "r.digit"),
                    ("","","", ""),
                    ("Compress/decompress raster file", "Compress/decompress
raster file", "self.runMenuCmd", "r.compress"),
                    ("Manage boundary definition (WHICH COMMAND?)", "Manage
boundary definition", "self.runMenuCmd", "r.region"),
                    ("Manage null values", "Manage null values",
"self.runMenuCmd", "r.null"),
                    ("Manage timestamp for files", "Manage timestamp for
files", "self.runMenuCmd", "r.timestamp"),
                    ("Quantization for floating-point maps", "Quantization
for floating-point maps", "self.runMenuCmd", "r.quant"),
                    ("Resample (change resolution) using nearest neighbor
method", "Resample (change resolution) using nearest neighbor method",
"self.runMenuCmd", "r.resample"),
                    ("Resample (change resolution) using regularized spline
tension", "Resample (change resolution) using regularized spline tension",
"self.runMenuCmd", "r.resamp.rst"),
                    ("Support file creation and maintenance", "Support file
creation and maintenance", "self.runMenuCmd", "r.support.sh"),
                    ("","","", ""),
                    ("Reproject raster from other location", "Reproject
raster from other location", "self.runMenuCmd", "r.proj"),
                    ("Generate tiling for other projection", "Generate
tiling for other projection", "self.runMenuCmd", "r.tileset"),
                    )),


__________________________________________
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