pyqtlet2 icon indicating copy to clipboard operation
pyqtlet2 copied to clipboard

empty map with PySide6 6.3.0

Open danielhrisca opened this issue 2 years ago • 21 comments

I'm using pyqtlet2 to display information from automotive measurement files (MDF).

This error (https://github.com/danielhrisca/asammdf/issues/751) was raised and I don't know what could be the cause. Can you spare some time and have a look?

danielhrisca avatar Sep 08 '22 06:09 danielhrisca

We would be very interested in any inputs on this as well

MatinF avatar Sep 08 '22 08:09 MatinF

This also happens with PySide6 6.3.2 - it would be great to hear any thoughts on how to resolve this.

The map seems to be grayed out - see also below the console output:

image

MatinF avatar Sep 14 '22 08:09 MatinF

This looks like leaflet is unable to load the map... Do you use a custom map layer/url? @MatinF

JaWeilBaum avatar Sep 14 '22 15:09 JaWeilBaum

I believe @danielhrisca can probably best answer as to the layer, but to my knowledge it is not non-standard.

It is also worth noting that with below dependencies, the GPS map works without issues:

PySide6==6.2.3


shiboken6==6.2.3

However, when we (for other reasons) need to update the dependencies, the GPS no longer shows as expected, but just plots the route with a grayed out map.

PySide6==6.3.2
PySide6-Addons==6.3.2
PySide6-Essentials==6.3.2
shiboken6==6.3.2

Do you have any thoughts as to why those changes to the dependencies might cause the map to gray out? No other changes to dependencies are made between the tests.

MatinF avatar Sep 14 '22 18:09 MatinF

Sounds odd - maybe one of the new packages blocks/restricts network traffic and therefore the map can't be loaded.

Could you try this with the default map layer? L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map)

If you want to use local map files you could also do this in the following way:

custom_local_layer = os.path.join(os.getcwd(), "clip", "merged", "512", "latest", "{z}", "{x}", "{y}.png")
L.tileLayer(custom_local_layer.replace("\\", "/")).addTo(self._map)

You may need to look into the way paths are made on your system.

JaWeilBaum avatar Sep 15 '22 11:09 JaWeilBaum

Using L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map) does not work

danielhrisca avatar Sep 16 '22 08:09 danielhrisca

This seems strange - The only reason I can think of, might be that with the version bump of PySide 6, they introducded a network restriction for components. During a quick search I didn't find a thing...

JaWeilBaum avatar Sep 23 '22 08:09 JaWeilBaum

The default map (osm) shows when using folium 0.12.1.post1 with PySide6 6.3.2

However, the issue persists with pyqtlet.

psa95 avatar Oct 07 '22 10:10 psa95

@psa95 What do you mean by using folium instead of pyqtlet ?

JaWeilBaum avatar Oct 07 '22 14:10 JaWeilBaum

@psa95 What do you mean by using folium instead of pyqtlet ?

If you install folium with pip install folium and use that to generate the osm map, it successfully renders it in PySide6. Folium is also based off of leaflet.

However, if we uninstall folium and use pyqtlet instead, the map shows a grayed out screen.

psa95 avatar Oct 08 '22 19:10 psa95

@danielhrisca Perhaps this could be a solution in asammdf?

MatinF avatar Oct 09 '22 07:10 MatinF

Last time I checked there was no way to have a movable cursor

danielhrisca avatar Oct 09 '22 09:10 danielhrisca

Has anyone had success running this in Qt6?

Omega-Networks avatar Dec 05 '22 02:12 Omega-Networks

It appears we are unable to reference the map. JS console suggests we are trying to read 'mapObject' which is returning null.

If anyone is available to assist with troubleshooting we can arrange a teams session. Currently working on reverse engineering this but so far unsuccessful.

We have been able to get Leaflet running inside PySide6 6.4.1 using a custom wrapper; however, best to build one as a community.

Error message: javaScriptConsoleMessage: message: Uncaught TypeError: Cannot read properties of null (reading 'mapObject'), level: JavaScriptConsoleMessageLevel.ErrorMessageLevel, lineNumber: 1


Occurs:

After or during initiation of the map.

self.map = L.map(self.mapWidget)
self.map.setView([12.97, 77.59], 10)

  1. Map is initiated
  2. On setting view the error occurs

Affected Versions (Tested PySide6 Only):

PySide6 >6.2.3

While testing PySide6.2.4 we ran into an additional error.

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable js: Uncaught TypeError: Cannot read property 'mapObject' of null

Omega-Networks avatar Jan 07 '23 02:01 Omega-Networks

Hi @Omega-Networks thanks for looking into this. I tried to setup a local test environment for pyside6 but ran into issues while setting it up. I'll have a look into this probably tomorrow and will check what I can see.

What did you do in your custom wrapper, what was the workaround there?

JaWeilBaum avatar Jan 08 '23 13:01 JaWeilBaum

Any progress on this? Same problem with PySide6.4.2

MarkusDanielsson91 avatar Jan 24 '23 07:01 MarkusDanielsson91

No sadly not. I guess during the installation something with the bindings to PySide goes wrong. I never used PySide 6 on my end therefore I don't have much experience with this.

JaWeilBaum avatar Feb 02 '23 15:02 JaWeilBaum

For our use case the maps stopped working starting with PySide6 6.2.4

danielhrisca avatar Mar 30 '23 09:03 danielhrisca

How can I enable debug logs/prints for the JS library? At the moment there is nothing printed when the maps widget fails to display correctly, and I have the feeling that I'm missing some important debug information

danielhrisca avatar Mar 30 '23 11:03 danielhrisca

PySide6 6.2.2 work fine

lqucool avatar Sep 03 '23 04:09 lqucool

Thanks to @zariiii9003, I think that the fix is to set this attribute on the map widget (tested on PySide6)

from PySide6.QtWebEngineCore import QWebEngineSettings
mapWidget = MapWidget()
mapWidget.settings().setAttribute(QWebEngineSettings.WebAttribute.LocalContentCanAccessRemoteUrls, True)

danielhrisca avatar Oct 19 '23 13:10 danielhrisca