[GRASS-dev] wxgrass prototype

I just committed the last pieces to having a pretty much fully functional (most of the time) GUI prototype in wxPython. This has been a real team effort; a special recognition is owed to Jáchym Cepicky for getting this off the ground and keeping it going—along with a lot of coding. But there have also been contributions from Martin Landa, Daniel Calvelo, Markus Neteler, and Glynn Clements.

What we have now is a GIS Manager with the option of adding raster, vector, and command layers (and setting transparency for map layers); an integrated command input and output window; menus for all (or most) GRASS commands; and a parser that will create a simple GUI dialog for any command selected. The GIS Manager can launch multiple map display windows, which have a simple set of controls on a tear-off toolbar. There is a nice startup screen and the beginnings of a location creation wizard.

To add a map to the layer tree, click on the appropriate button (or type d.rast or d.vect from the command line). Then double click on the layer to open up an options dialog. When you have the settings, press “run” or hit enter in the options dialog (you’ll see the name of the layer change to match the map you’ve selected. Set the desired transparency. Press display on the associated map display window.

The prototype is in the new GRASS subversion repository https://grasssvn.itc.it/grasssvn/grassaddons/trunk/grassaddons/gui/#_trunk_grassaddons_gui_

Most of the files go into $GISBASE/etc/wx. The script “wxgrass” goes into $GISBASE/scripts. If you want to automatically start up in wxgrass, you can use the init.sh script provided (you may need to edit it to match your exiting version if you have trouble with the LD_LIBRARY setting).

To use this, you’ll need to have Python 2.4 or greater and wxPython 2.8.1 or greater.

We still have a lot to do on this, but the initial work is done to a point that you can try it out.

Enjoy
Michael


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

Hi, congrats, great work, Michael!

2007/3/21, Michael Barton <michael.barton@asu.edu>:

To use this, you'll need to have Python 2.4 or greater and wxPython 2.8.1
or greater.

Python 2.3 here :slight_smile:

Jachym

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

On 21/03/07 00:30, Michael Barton wrote:

I just committed the last pieces to having a pretty much fully functional (most of the time) GUI prototype in wxPython.

Congratulations !

Some very first remarks (all messages appear in the terminal window):

- I have to do a 'ln -s Gism gism', otherwise I get:

ValueError: unknown url type: /usr/lib/grass/etc/wx/gism//grass-interface.dtd

- I still get the following at startup:

GRASS_INFO_ERROR(21763,1): region for current mapset is not set
GRASS_INFO_ERROR(21763,1): run "g.region"
GRASS_INFO_END(21763,1)

- Everytime I change the value of transparency, I get:

GRASS_INFO_WARNING(21970,1): 'vector/communes' was found in more mapsets (also found in mlennert).
GRASS_INFO_END(21970,1)

- Config->Region gives me:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 281, in runMenuCmd
     menuform.GUI().parseCommand(cmd,gmpath, parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 113, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type: '/home/mlennert/GRASS/DATA/BELGIQUE/mlennert/3d.view'

- If there is no PERMANENT/cell directory, I cannot display a raster map in another mapset (i.e. I am in mapset mlennert, wishing to display a raster map which is in mapset mlennert):

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 139, in AddLayer
     menuform.GUI().parseCommand('d.rast', gmpath, completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 120, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type: '/home/mlennert/GRASS/DATA/BELGIQUE/PERMANENT/cell'

- The same for the PERMANENT/vector directory:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 144, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath, completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 120, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type: '/home/mlennert/GRASS/DATA/ESPON/PERMANENT/vector'

  - When I chose a vector map name, I get:

Could not execute 'd.vect map=ssbel01 type=point,line,boundary,centroid,area,face display=shape icon=basic/x size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200 rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8 xref=left yref=center render=g'
Could not render layer <d.vect map=ssbel01 type=point,line,boundary,centroid,area,face display=shape icon=basic/x size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200 rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8 xref=left yref=center render=g@mlennert>

- I still cannot add a second vector or raster map:

vector:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py", line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type 'wxTreeItemId const *'

raster:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py", line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type 'wxTreeItemId const *'

- I add a vector layer, the d.vect window opens, I select a map, press run and display it, then within the same d.vect window (which is still open) I select another map and press run, but nothing happens. This is not true for other options (color, type, etc).
To change the map, I have to close the d.vect window and double click on the layer to reopen the d.vect window. Then I can change the map name, click run and the new map displays.

That's it for now...

Good job guys !

Moritz

P.S.
Debian with
python2.4 2.4.4-2 2.4 and python-wxgtk2.8 2.8.1.1-0

And a few more remarks:

- When double-clicking on an already existing layer to make the d.vect/d.rast window appear, this window does not contain the map name of the map that was selected before. I think this should be the case, as when you just want to modify one option, you don't want to always have to reselect the map name

- Flags (such as d.vect -c) do not seem to be taken into account (at least they don't show in the command line displayed in the output window).

- When using the provided Init.sh to run grass -wx, wxgrass is modal, i.e. you don't have access to the command line in the terminal window anymore.

Moritz

Thanks for the comments Moritz. Some responses below.

On 3/21/07 7:04 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:

On 21/03/07 00:30, Michael Barton wrote:

I just committed the last pieces to having a pretty much fully
functional (most of the time) GUI prototype in wxPython.

Congratulations !

Some very first remarks (all messages appear in the terminal window):

- I have to do a 'ln -s Gism gism', otherwise I get:

ValueError: unknown url type:
/usr/lib/grass/etc/wx/gism//grass-interface.dtd

I don't get this because I'm on a Mac, which isn't very strict on
capitalization/non-capitalization of file and directory names. Need to see
where this typo is. Also need to change from gism to gismgr or something
like that.

- I still get the following at startup:

GRASS_INFO_ERROR(21763,1): region for current mapset is not set
GRASS_INFO_ERROR(21763,1): run "g.region"
GRASS_INFO_END(21763,1)

- Everytime I change the value of transparency, I get:

GRASS_INFO_WARNING(21970,1): 'vector/communes' was found in more mapsets
(also found in mlennert).
GRASS_INFO_END(21970,1)

Right now, all actions are very 'noisy', producing lots of messages in the
terminal

- Config->Region gives me:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 281, in runMenuCmd
     menuform.GUI().parseCommand(cmd,gmpath, parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 113, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type:
'/home/mlennert/GRASS/DATA/BELGIQUE/mlennert/3d.view'

I'll have to try and see what's up with this.

- If there is no PERMANENT/cell directory, I cannot display a raster map
in another mapset (i.e. I am in mapset mlennert, wishing to display a
raster map which is in mapset mlennert):

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 139, in AddLayer
     menuform.GUI().parseCommand('d.rast', gmpath,
completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 120, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type:
'/home/mlennert/GRASS/DATA/BELGIQUE/PERMANENT/cell'

- The same for the PERMANENT/vector directory:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 144, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath,
completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 120, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type:
'/home/mlennert/GRASS/DATA/ESPON/PERMANENT/vector'

These should be fixable with better error-trapping in select.Select.

  - When I chose a vector map name, I get:

Could not execute 'd.vect map=ssbel01
type=point,line,boundary,centroid,area,face display=shape icon=basic/x
size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200
rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8
xref=left yref=center render=g'
Could not render layer <d.vect map=ssbel01
type=point,line,boundary,centroid,area,face display=shape icon=basic/x
size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200
rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8
xref=left yref=center render=g@mlennert>

This happens when any map is first added. Part of the 'noisy' output. The
map can't be rendered until all information is complete. You can ignore it,
but we should track it down anyway.

- I still cannot add a second vector or raster map:

vector:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File
"/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
'wxTreeItemId const *'

raster:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File
"/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
'wxTreeItemId const *'

I don't understand the problem here. It is not happening on my system. Can
someone else check this out? This is not a version problem, and I don't know
what is wrong.

- I add a vector layer, the d.vect window opens, I select a map, press
run and display it, then within the same d.vect window (which is still
open) I select another map and press run, but nothing happens. This is
not true for other options (color, type, etc).
To change the map, I have to close the d.vect window and double click on
the layer to reopen the d.vect window. Then I can change the map name,
click run and the new map displays.

Yes. This is a consequence of just using the autogenerated command dialogs
for setting options at the moment. If you want to set options for a layer,
you need to open the options dialog for that layer, set the options, and
close the dialog. Repeat to set options for another layer. Also, if you want
to change options, you have to start over with an empty options dialog. This
is pretty clunky, but it was a fast way to make some kind of layer options
setting available. Clearly this needs to be considerably more sophisticated.

Thanks for the comments.

Michael

__________________________________________
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

Moritz,

See below...

On 3/21/07 7:04 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:

On 21/03/07 00:30, Michael Barton wrote:

I just committed the last pieces to having a pretty much fully
functional (most of the time) GUI prototype in wxPython.

Congratulations !

Some very first remarks (all messages appear in the terminal window):

- I have to do a 'ln -s Gism gism', otherwise I get:

ValueError: unknown url type:
/usr/lib/grass/etc/wx/gism//grass-interface.dtd

- I still get the following at startup:

GRASS_INFO_ERROR(21763,1): region for current mapset is not set
GRASS_INFO_ERROR(21763,1): run "g.region"
GRASS_INFO_END(21763,1)

Fixed by Glynn

- Everytime I change the value of transparency, I get:

GRASS_INFO_WARNING(21970,1): 'vector/communes' was found in more mapsets
(also found in mlennert).
GRASS_INFO_END(21970,1)

This is a function of the "error" messages that I've been griping about that
don't really do much except clutter up the screen. At least they are less
frequent now.

- Config->Region gives me:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 281, in runMenuCmd
     menuform.GUI().parseCommand(cmd,gmpath, parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 113, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type:
'/home/mlennert/GRASS/DATA/BELGIQUE/mlennert/3d.view'

This works for me. Want to update all and check again?

- If there is no PERMANENT/cell directory, I cannot display a raster map
in another mapset (i.e. I am in mapset mlennert, wishing to display a
raster map which is in mapset mlennert):

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 139, in AddLayer
     menuform.GUI().parseCommand('d.rast', gmpath,
completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 514, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 315, in __init__
     type=grass_task['params'][p_count]['element'])
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 15, in __init__
     tcp.getElementList(type)
   File "/usr/lib/grass/etc/wx/Gism/select.py", line 120, in getElementList
     elem_list = os.listdir(os.path.join (location_path, dir, element))
OSError: [Errno 2] Aucun fichier ou répertoire de ce type:
'/home/mlennert/GRASS/DATA/BELGIQUE/PERMANENT/cell'

This is fixed

  - When I chose a vector map name, I get:

Could not execute 'd.vect map=ssbel01
type=point,line,boundary,centroid,area,face display=shape icon=basic/x
size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200
rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8
xref=left yref=center render=g'
Could not render layer <d.vect map=ssbel01
type=point,line,boundary,centroid,area,face display=shape icon=basic/x
size=8 layer=1 width=0 wscale=1 color=black fcolor=200:200:200
rgb_column=GRASSRGB lcolor=red bgcolor=none bcolor=none lsize=8
xref=left yref=center render=g@mlennert>

- I still cannot add a second vector or raster map:

vector:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File
"/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
'wxTreeItemId const *'

I can't duplicate and so don't know what the problem is here.

raster:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 359, in addRaster
     self.SetTree('raster')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 117, in AddLayer
     if self.layer_selected and self.layer_selected != self.GetRootItem():
   File
"/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py",
line 4996, in __ne__
     return _controls_.TreeItemId___ne__(*args, **kwargs)
TypeError: in method 'TreeItemId___ne__', expected argument 2 of type
'wxTreeItemId const *'

- I add a vector layer, the d.vect window opens, I select a map, press
run and display it, then within the same d.vect window (which is still
open) I select another map and press run, but nothing happens. This is
not true for other options (color, type, etc).
To change the map, I have to close the d.vect window and double click on
the layer to reopen the d.vect window. Then I can change the map name,
click run and the new map displays.

I've made this a bit easier. The buttons change to cancel/apply/OK for
display command options windows. Simply pressing return (OK) will save the
options and close the window; pressing "apply" will save the options and
leave the window open.

Michael
__________________________________________
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

On 3/21/07 7:39 AM, "Moritz Lennert" <mlennert@club.worldonline.be> wrote:

And a few more remarks:

- When double-clicking on an already existing layer to make the
d.vect/d.rast window appear, this window does not contain the map name
of the map that was selected before. I think this should be the case, as
when you just want to modify one option, you don't want to always have
to reselect the map name

This will take some work.

- Flags (such as d.vect -c) do not seem to be taken into account (at
least they don't show in the command line displayed in the output window).

I haven't checked this out yet.

- When using the provided Init.sh to run grass -wx, wxgrass is modal,
i.e. you don't have access to the command line in the terminal window
anymore.

I made the wxgrass script start the GUI non-modally.

Moritz

__________________________________________
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

On 22/03/07 06:03, Michael Barton wrote:

- When using the provided Init.sh to run grass -wx, wxgrass is modal,
i.e. you don't have access to the command line in the terminal window
anymore.

I made the wxgrass script start the GUI non-modally.

This doesn't work for me:

GRASS 6.3.cvs (BELGIQUE):~ > wxgrass
python: can't open file '/usr/lib/grass/etc/wx/gism.py &': [Errno 2] No such file or directory

Without the ampersand, I now get the following error when trying to launch wxgrass:

GRASS 6.3.cvs (BELGIQUE):~ > wxgrass
Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 445, in ?
     app = GMApp(0)
   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7757, in __init__
     self._BootstrapApp()
   File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7354, in _BootstrapApp
     return _core_.PyApp__BootstrapApp(*args, **kwargs)
   File "/usr/lib/grass/etc/wx/gism.py", line 427, in OnInit
     mainframe = GMFrame(None, -1, "")
   File "/usr/lib/grass/etc/wx/gism.py", line 110, in __init__
     self.menubar = self.__createMenuBar()
   File "/usr/lib/grass/etc/wx/gism.py", line 166, in __createMenuBar
     self.menubar.Append(self.__createMenu(menuItems), menuLabel)
   File "/usr/lib/grass/etc/wx/gism.py", line 181, in __createMenu
     self.__createMenuItem(menu, *eachItem)
   File "/usr/lib/grass/etc/wx/gism.py", line 193, in __createMenuItem
     rhandler = eval(handler)
   File "<string>", line 0, in ?
AttributeError: 'GMFrame' object has no attribute 'Nomethod'

Moritz

Hi Moritz,

As a temporary workaround, revert to revision 239 in svn:

svn update -r 239 gism.py

(in Gism/.., that is gui for me, but could be $GISBASE/etc/wx/)

On 3/22/07, Moritz Lennert <mlennert@club.worldonline.be> wrote:

Without the ampersand, I now get the following error when trying to
launch wxgrass:

[...]

AttributeError: 'GMFrame' object has no attribute 'Nomethod'

Daniel.

--
-- Daniel Calvelo Aros

On 22/03/07 10:21, Daniel Calvelo wrote:

Hi Moritz,

As a temporary workaround, revert to revision 239 in svn:

svn update -r 239 gism.py

Yes, thanks, now I can start wxgrass again.

Good news: I can now add several layers !

Bad news: whenever I add a layer I get (for raster this is +/- the same):

GRASS 6.3.cvs (BELGIQUE):~ > Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 150, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath, completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 535, in parseCommand
     xml.sax.parseString(cmdout2, handler)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/__init__.py", line 47, in parseString
     parser.parse(inpsrc)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
     xmlreader.IncrementalParser.parse(self, source)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
     self.feed(buffer)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
     self._parser.Parse(data, isFinal)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 395, in external_entity_ref
     self._source.getSystemId() or
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.py", line 523, in prepare_input_source
     f = urllib2.urlopen(source.getSystemId())
   File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
     return _opener.open(url, data)
   File "/usr/lib/python2.4/urllib2.py", line 350, in open
     protocol = req.get_type()
   File "/usr/lib/python2.4/urllib2.py", line 233, in get_type
     raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: /usr/lib/grass/etc/wx/gism//grass-interface.dtd

Moritz

Moritz, that's SAX not finding its DTD file. Try this patch:

--- menuform.py 2007-03-22 04:51:49.000000000 -0500
+++ mff.py 2007-03-22 04:55:08.000000000 -0500
@@ -578,7 +578,7 @@
             cmd = cmd + r' --interface-description'
             cmdout = os.popen(cmd, "r").read()
             p = re.compile( '(grass-interface.dtd)')
- cmdout2 = p.sub( gmpath+r'/grass-interface.dtd', cmdout)
+ cmdout2 = p.sub( gmpath+r'grass-interface.dtd', cmdout)
             handler = processTask()
             xml.sax.parseString(cmdout2, handler)

Daniel.

On 3/22/07, Moritz Lennert <mlennert@club.worldonline.be> wrote:

On 22/03/07 10:21, Daniel Calvelo wrote:
> Hi Moritz,
>
> As a temporary workaround, revert to revision 239 in svn:
>
> svn update -r 239 gism.py

Yes, thanks, now I can start wxgrass again.

Good news: I can now add several layers !

Bad news: whenever I add a layer I get (for raster this is +/- the same):

GRASS 6.3.cvs (BELGIQUE):~ > Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 150, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath,
completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 535, in parseCommand
     xml.sax.parseString(cmdout2, handler)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/__init__.py",
line 47, in parseString
     parser.parse(inpsrc)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 109, in parse
     xmlreader.IncrementalParser.parse(self, source)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py",
line 123, in parse
     self.feed(buffer)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 216, in feed
     self._parser.Parse(data, isFinal)
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py",
line 395, in external_entity_ref
     self._source.getSystemId() or
   File "/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.py",
line 523, in prepare_input_source
     f = urllib2.urlopen(source.getSystemId())
   File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
     return _opener.open(url, data)
   File "/usr/lib/python2.4/urllib2.py", line 350, in open
     protocol = req.get_type()
   File "/usr/lib/python2.4/urllib2.py", line 233, in get_type
     raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type:
/usr/lib/grass/etc/wx/gism//grass-interface.dtd

Moritz

--
-- Daniel Calvelo Aros

On 22/03/07 10:56, Daniel Calvelo wrote:

Moritz, that's SAX not finding its DTD file. Try this patch:

--- menuform.py 2007-03-22 04:51:49.000000000 -0500
+++ mff.py 2007-03-22 04:55:08.000000000 -0500
@@ -578,7 +578,7 @@
            cmd = cmd + r' --interface-description'
            cmdout = os.popen(cmd, "r").read()
            p = re.compile( '(grass-interface.dtd)')
- cmdout2 = p.sub( gmpath+r'/grass-interface.dtd', cmdout)
+ cmdout2 = p.sub( gmpath+r'grass-interface.dtd', cmdout)
            handler = processTask()
            xml.sax.parseString(cmdout2, handler)

No the problem was the fact that gmpath was hardcoded to /etc/wx/gism not /etc/wx/Gism on line 20 in gismutils.py.

But now I get the following when trying to add a layer:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 150, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath, completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 537, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 342, in __init__
     self.btn_apply.Bind(wx.EVT_BUTTON, self.onApply)
AttributeError: 'mainFrame' object has no attribute 'onApply'

Moritz

Oooops. My fault:

--- Gism/menuform.py 2007-03-22 05:12:22.000000000 -0500
+++ Gism/mff.py 2007-03-22 05:14:55.000000000 -0500
@@ -380,7 +380,7 @@
             self.btn_ok = wx.Button(self.panel, ID_RUN, "OK")
             btnsizer.Add(self.btn_ok, 0, wx.ALL| wx.ALIGN_CENTER, 10)
             self.btn_ok.SetDefault()
- self.btn_apply.Bind(wx.EVT_BUTTON, self.onApply)
+ self.btn_apply.Bind(wx.EVT_BUTTON, self.OnApply)
             self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOK)
         else: # We're standalone
             self.btn_run = wx.Button(self.panel, ID_RUN, "Run")

D.

On 3/22/07, Moritz Lennert <mlennert@club.worldonline.be> wrote:

On 22/03/07 10:56, Daniel Calvelo wrote:
> Moritz, that's SAX not finding its DTD file. Try this patch:
>
> --- menuform.py 2007-03-22 04:51:49.000000000 -0500
> +++ mff.py 2007-03-22 04:55:08.000000000 -0500
> @@ -578,7 +578,7 @@
> cmd = cmd + r' --interface-description'
> cmdout = os.popen(cmd, "r").read()
> p = re.compile( '(grass-interface.dtd)')
> - cmdout2 = p.sub( gmpath+r'/grass-interface.dtd', cmdout)
> + cmdout2 = p.sub( gmpath+r'grass-interface.dtd', cmdout)
> handler = processTask()
> xml.sax.parseString(cmdout2, handler)

No the problem was the fact that gmpath was hardcoded to /etc/wx/gism
not /etc/wx/Gism on line 20 in gismutils.py.

But now I get the following when trying to add a layer:

Traceback (most recent call last):
   File "/usr/lib/grass/etc/wx/gism.py", line 363, in addVector
     self.SetTree('vector')
   File "/usr/lib/grass/etc/wx/gism.py", line 378, in SetTree
     self.maptree.AddLayer(disp_idx, layertype)
   File "/usr/lib/grass/etc/wx/Gism/gismutils.py", line 150, in AddLayer
     menuform.GUI().parseCommand('d.vect', gmpath,
completed=(self.getOptData,layer), parentframe=self)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 537, in parseCommand
     mf = mainFrame(self.parent ,-1, self.w, self.h, self.get_dcmd, layer)
   File "/usr/lib/grass/etc/wx/Gism/menuform.py", line 342, in __init__
     self.btn_apply.Bind(wx.EVT_BUTTON, self.onApply)
AttributeError: 'mainFrame' object has no attribute 'onApply'

Moritz

--
-- Daniel Calvelo Aros