The javascript stuff in pyqtlet2 itself is easy enough. The command line 
option --collect-data=pyqtlet2 to PyInstaller is enough which corresponds 
to a hook which looks like:
# hook-pyqtlet2.py from PyInstaller.utils.hooks import collect_data_files 
datas = collect_data_files("pyqtlet2") 

If you wanted to make this available to everyone, you could upload it to the 
hooks repo 
<https://github.com/pyinstaller/pyinstaller-hooks-contrib/#pyinstaller-hooks-contrib-the-pyinstaller-community-hooks-repository>
 
or you can store it in pyqtlet2 
<https://pyinstaller.org/en/v5.10.0/hooks.html#providing-pyinstaller-hooks-with-your-package>
.

What’s rather more fiddly is the dependency on qtpy. Because qtpy is an 
abstraction layer across the Qt variants, it contains conditional imports 
which PyInstaller’s dependency scanner has no idea how to handle. I don’t 
think there’s any way of making that issue invisible. If you put in 
explicit imports to a specific Qt variant before any qtpy or pyqtlet2 
imports, it behaves itself. i.e. The hello world pyqtlet2 example 
<https://github.com/JaWeilBaum/pyqtlet2/tree/0e9fdd819abd24dfecfd3449dbf5002e7b626410#usage>
 
becomes:
import sys import PyQt6.QtWebEngineWidgets # <--- This line is different 
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget from pyqtlet2 
import L, MapWidget class MapWindow(QWidget): def __init__(self): # Setting 
up the widgets and layout super().__init__() self.mapWidget = MapWidget() 
self.layout = QVBoxLayout() self.layout.addWidget(self.mapWidget) 
self.setLayout(self.layout) # Working with the maps with pyqtlet self.map = 
L.map(self.mapWidget) self.map.setView([12.97, 77.59], 10) L.tileLayer(
'http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(self.map) self.marker = 
L.marker([12.934056, 77.610029]) self.marker.bindPopup('Maps are a 
treasure.') self.map.addLayer(self.marker) self.show() if __name__ == 
'__main__': app = QApplication(sys.argv) widget = MapWindow() 
sys.exit(app.exec_()) 
​

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/7fe34eec-851e-4ec1-95f6-7ff84ef81a04n%40googlegroups.com.

Reply via email to