Opened 5 years ago

Last modified 4 years 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 by annakrat, 5 years ago

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

comment:2 by neteler, 5 years ago

Fix GH cdb2ad31bf56173e6c7782600664c9ece63bd14b solved it.

I have backported it to relbr78.

comment:3 by veroandreo, 5 years ago

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 by veroandreo, 5 years ago

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 by annakrat, 5 years ago

I can't reproduce this, it works ok.

comment:6 by neteler, 5 years ago

Milestone: 7.8.07.8.1

Ticket retargeted after milestone closed

in reply to:  3 comment:7 by veroandreo, 5 years ago

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 by neteler, 5 years ago

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 by neteler, 5 years ago

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

comment:10 by annakrat, 5 years ago

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

comment:11 by neteler, 4 years ago

Milestone: 7.8.17.8.2

Ticket retargeted after milestone closed

comment:12 by neteler, 4 years ago

Milestone: 7.8.2

Ticket retargeted after milestone closed

comment:13 by neteler, 4 years ago

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