JaWeilBaum / pyqtlet2

pyqtlet2 extends pyqtlet which initially brought Leaflet maps to PyQt5 and PySide6.
Other
37 stars 19 forks source link

empty map with PySide6 6.3.0 #38

Open danielhrisca opened 1 year ago

danielhrisca commented 1 year ago

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?

MatinF commented 1 year ago

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

MatinF commented 1 year ago

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

JaWeilBaum commented 1 year ago

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

MatinF commented 1 year ago

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.

JaWeilBaum commented 1 year ago

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.

danielhrisca commented 1 year ago

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

JaWeilBaum commented 1 year ago

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

psa95 commented 1 year ago

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

However, the issue persists with pyqtlet.

JaWeilBaum commented 1 year ago

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

psa95 commented 1 year ago

@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.

MatinF commented 1 year ago

@danielhrisca Perhaps this could be a solution in asammdf?

danielhrisca commented 1 year ago

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

Omega-Networks commented 1 year ago

Has anyone had success running this in Qt6?

Omega-Networks commented 1 year ago

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

JaWeilBaum commented 1 year ago

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?

MarkusDanielsson91 commented 1 year ago

Any progress on this? Same problem with PySide6.4.2

JaWeilBaum commented 1 year ago

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.

danielhrisca commented 1 year ago

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

danielhrisca commented 1 year ago

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

lqucool commented 11 months ago

PySide6 6.2.2 work fine

danielhrisca commented 10 months ago

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)