Opened 5 months ago

Last modified 6 weeks ago

#3896 new defect

d.legend: error when displaying raster legend

Reported by: veroandreo Owned by: grass-dev@…
Priority: normal Milestone: 7.8.3
Component: Display Version: git-releasebranch78
Keywords: d.legend Cc:
CPU: Unspecified Platform: Unspecified

Description

When calling G7:d.legend from terminal for a wx monitor, the legend is not displayed and I get the following error in the terminal:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/wx/core.py", line 2228, in Notify
    self.notify()
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/mapdisp/main.py", line 592, in watcher
    self.mapFrm.GetMap().GetLayersFromCmdFile()
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/mapdisp/main.py", line 203, in GetLayersFromCmdFile
    self._giface.GetMapDisplay().AddLegendRast(cmd=cmd)
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/mapdisp/frame.py", line 1244, in AddLegendRast
    cmd, completed=(self.GetOptData, None, None))
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 2925, in ParseCommand
    get_dcmd=get_dcmd, layer=layer)
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 550, in __init__
    frame=self)
  File "/home/veroandreo/software/grass78_git/dist.x86_64-pc-linux-gnu/gui/wxpython/gui_core/forms.py", line 1454, in __init__
    for layer in layers:
TypeError: iter() returned non-iterator of type 'LayerList'

If I use the main GUI though, all seems to work fine, no errors in the console tab.

Change History (13)

comment:1 Changed 5 months ago by annakrat

Should be fixed in master. Please test, needs backport.

comment:2 Changed 5 months ago by neteler

Fix GH cdb2ad31bf56173e6c7782600664c9ece63bd14b solved it.

I have backported it to relbr78.

comment:3 Changed 5 months ago by veroandreo

The reported error with d.legend seems to be gone, but if I run the commands in the following order:

d.mon wx0
d.rast elevation
d.barscale
d.northarrow 
d.legend raster=elevation

d.legend makes the raster map disappear... I have to re-render to have it back... that shouldn't be the expected behavior, IMO

Same happens if I do:

d.mon wx0
d.rast elevation
d.barscale
d.northarrow 
d.legend raster=elevation

Seems that there's still something messed up with the layers being displayed

comment:4 Changed 5 months ago by veroandreo

Ops, last one is a copy-paste problem... The order of commands was different, but now I'm no longer with the laptop.

comment:5 Changed 5 months ago by annakrat

I can't reproduce this, it works ok.

comment:6 Changed 5 months ago by neteler

Milestone: 7.8.07.8.1

Ticket retargeted after milestone closed

comment:7 in reply to:  3 Changed 4 months ago by veroandreo

Replying to veroandreo:

The reported error with d.legend seems to be gone, but if I run the commands in the following order:

d.mon wx0
d.rast elevation
d.barscale
d.northarrow 
d.legend raster=elevation

d.legend makes the raster map disappear... I have to re-render to have it back... that shouldn't be the expected behavior, IMO

I updated and recompiled 78 and also my system, but I still observe the same behaviour. No idea.

comment:8 Changed 3 months ago by neteler

Just checked on my system with a freshly compiled 7.8.dev: d.northarrow makes the raster map disappear (using the example above). The other map elements remain!

GRASS 7.8.1dev (nc_spm_08):~ > g.version -rge
version=7.8.1dev
date=2019
revision=e2f0c65c9
build_date=2019-10-29
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=00000
libgis_date="?"
proj=5.2.0
gdal=2.3.2
geos=3.7.1
sqlite=3.26.0

Does it work on Windows?

comment:9 Changed 3 months ago by neteler

I tested again, the updated PR works fine for me in master (Fedora 30).

comment:10 Changed 3 months ago by annakrat

Merged and backported. Since the problem remains for Vero, I will keep this open.

comment:11 Changed 3 months ago by neteler

Milestone: 7.8.17.8.2

Ticket retargeted after milestone closed

comment:12 Changed 6 weeks ago by neteler

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:13 Changed 6 weeks ago by neteler

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.