Opened 8 years ago

Closed 7 years ago

#1601 closed defect (fixed)

output map GUI pulldown broken

Reported by: cmbarton Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: wxGUI Version: svn-trunk
Keywords: GUI parser Cc:
CPU: Unspecified Platform: Unspecified

Description

Somehow the output GUI pulldown has recently broken in GRASS 7. When you try to use the pulldown to specify an existing output map name, here is the error that generated.

Traceback (most recent call last):

File "/Users/Shared?/grass_dev/grass70_dev/dist.x86_64

-apple-darwin10.8.0/etc/gui/wxpython/gui_core/gselect.py", line 198, in GetStringValue?

return ','.join(self.value) TypeError? : sequence item 1: expected string or Unicode, TreeItemId? found

Change History (6)

comment:1 Changed 8 years ago by cmbarton

Here is some more information:

This error affects any module that has 'input' and 'output' argument and where the 'output' argument is a map. Example modules include r.patch, r.to.vect, and v.to.rast.

Trying to select a map for output raises an error

GRASS 7.0.svn (Global_latlon):~ > Traceback (most recent call last):

File "/Applications/GRASS/GRASS-7.0.app/Contents/MacOS/etc/gui/wxpython/gui_core/gselect.py", line 198, in GetStringValue?

return ','.join(self.value)

TypeError?: sequence item 1: expected string or Unicode, TreeItemId? found

Here is what I've traced so far.

For input and output, GetStringValue? is called twice during a map selection to return self.value, which it can join to other strings with a comma in the case of multiple inputs. self.value is supposed to be the map name. Both times GetStringValue? is called for the input selection, it returns the map name.

But for the output selection, it returns only the map name the first time, and then returns <map name>,<tree item> the second time. since the tree item is not a string, it raises this error.

I'm still trying to find my way through the new code reorganization. My guess is that the problem probably lies in forms.py and maybe an incorrect call to OnUpdateSelection? (at least input does NOT call OnUpdateSelection? and output DOES call OnUpdateSelection?). It could still be in select.py, but both input and output call select.py and there is only an error with output.

The same thing happens whether output is a vector or a raster. Other kinds of output, like files, don't seem to be affected. I hope the detective work I've done so far helps.

comment:2 Changed 8 years ago by cmbarton

I found where to fix this, but need others to test this on other systems.

../wxpython/gui_core/gselect.py

remove or comment out line 257 (trunk svn r51129)

if found:

# self.value.append(found)

self.seltree.SelectItem?(found)

This line puts in a duplicate entry with the tree item instead of the map name in output fields that can accept the names of existing rasters and vectors. If commented out, it seems to have no ill effects on the Mac.

Can others test it on Linux and Windows?

Michael

comment:3 Changed 8 years ago by annakrat

Seems to work fine on Ubuntu. The reason why I can't reproduce the error is that found is always false. There should be if found.IsOk() (found is TreeItemId?). So it looks like this if block is not really necessary (at least on Linux).

Anna

comment:4 Changed 8 years ago by cmbarton

I took out all references to found in this method and everything works fine. I will remove this and commit. Hopefully, it has no problems on Windows either. Maybe test it a bit and if fine, backport to 6.x

Michael

comment:5 Changed 8 years ago by cmbarton

Can we backport this now?

Michael

comment:6 Changed 7 years ago by cmbarton

Resolution: fixed
Status: newclosed

This appears to have been back ported (it works in 6.4.3). So I am closing.

Michael

Note: See TracTickets for help on using tickets.