-
Notifications
You must be signed in to change notification settings - Fork 362
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
implemented open_popup and close_popup methods #914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! This looks great :)
I only have a minor question
ipyleaflet/leaflet.py
Outdated
def open_popup(self, location=def_loc): | ||
self.send({'msg': 'open', 'location': location}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a duplication of information between the location
property and the location
argument of this method.
Should this method default to the location property?
def open_popup(self, location=None):
self.send({'msg': 'open', 'location': location is None ? self.location : location})
And should we change the location property if it's provided?
def open_popup(self, location=None):
if location is not None:
self.location = location
self.send({'msg': 'open', 'location': location is None ? self.location : location})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize I've been writing non-valid Python code in my comment ahah. Let's try again:
def open_popup(self, location=None):
self.send({'msg': 'open', 'location': self.location if location is None else location})
And should we change the location property if it's provided?
def open_popup(self, location=None):
if location is not None:
self.location = location
self.send({'msg': 'open', 'location': self.location if location is None else location})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes a lot of sense to me. I didn't notice the location attribute in the Popup
class, and I think they should be synced. See 6e6b070.
flake8 is complaining in the CI test:
I think we can ignore the UI tests failure, it looks unrelated. |
Thanks! There is another failure in the Visual Regression test. Do you have any idea what is causing that test to fail? |
It looks like the basemap has changed a bit. You can ignore that. I don't think it's related to your change. |
Do you think it is a good idea to also have an |
You can probably listen to the But then you will need to be able to map those events to the right popup widgets? |
I guess there is a reference to the popup object in the popup event? |
To the popup object indeed, but there should not be a reference to the popup widget |
I see. I guess we can tackle that issue in a separate PR then. Any more comments? |
Yes that sounds like a good plan :)
Sorry I wasn't clearer about the flake8 issue. It is still not resolved. I will push a commit to your branch fixing that if you don't mind. |
Yeah sure, please feel free :) |
Actually you fixed it! Sorry I was confused by the diff. Let's wait for the CI to be green then I'll merge :) Thanks a lot! |
#912