Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add leaflet event to pyqtlet #19

Open
hari0603 opened this issue Nov 26, 2018 · 1 comment
Open

Add leaflet event to pyqtlet #19

hari0603 opened this issue Nov 26, 2018 · 1 comment

Comments

@hari0603
Copy link

Request to add drawDeleted event similar to drawCreated event

@samhattangady
Copy link
Collaborator

samhattangady commented Nov 26, 2018

Adding a Leaflet event as a pyqtSignal

To add a leaflet event as a signal, a few things need to be done.

  1. Identify the correct leaflet event. For drawDeleted, it will probably be in leaflet-draw.
  2. Identify parent object. In case of drawDeleted, the best bet would be to find where drawCreated is called, and create it along with that.

Once we have this, to actually implement a signal, is fairly straightforward. Base class pyqtlet/leaflet/core/evented.py has a _connectEventToSignal method that can be used to connect any leaflet event to a pyqtsignal.

So in order to create a new event/signal:

  1. Create a pyqtSignal in the correct object.
  2. Call a self._connectEventToSignal() in the objects __init__ method to connect the leaflet event to the pyqtSignal you just created.
  3. Profit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants