[GRASS-dev] [GRASS GIS] #1601: output map GUI pulldown broken

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
-------------------------+--------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: GUI parser | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by cmbarton):

Can we backport this now?

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1601: output map GUI pulldown broken
--------------------------+-------------------------------------------------
  Reporter: cmbarton | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: GUI parser
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by cmbarton):

  * status: new => closed
  * resolution: => fixed

Comment:

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

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1601#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>