Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

javascript - Import Leaflet Dragend Event to pyqtlet

In Pyqtlet, I can link map events to the Pyqt signal-slot structure via the following codes.

map.py:

clicked = pyqtSignal(dict)

@pyqtSlot(QJsonValue)
    def _onClick(self, event):
        self._logger.debug('map clicked. event: {event}'.format(event=event))
        self.clicked.emit(self._qJsonValueToDict(event))

self._connectEventToSignal('click', '_onClick')

evented.py

def _connectEventToSignal(self, event, signalEmitter):
    print(self.jsName + "
")
    print(event + "
")
    print(signalEmitter + "
")

    # We need to delete some keys as they are causing circular structures
    js = '{name}.on("{event}", function(e) {{
              delete e.target;
              delete e.sourceTarget;
              e = copyWithoutCircularReferences([e], e);
              channelObjects.{name}Object.{signalEmitter}(e)}})'.format(
        name=self.jsName, event=event, signalEmitter=signalEmitter)
    self.runJavaScript(js)

But the same code doesn't work for add marker drag event in maker.py. The error I get is: "js: Uncaught TypeError: Cannot read property '_onDrag' of undefined". I think there is an error in my javascript code. How can I solve it?

question from:https://stackoverflow.com/questions/65926326/import-leaflet-dragend-event-to-pyqtlet

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...