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 layer loading spinner and remove layer button #1983
base: master
Are you sure you want to change the base?
Conversation
🚀 Deployed on https://6644342b9f7a1e45759b25c8--opengeos.netlify.app |
Just realized that I forgot to add a confirmation dialog when removing a layer. Will add that later |
I have added the confirmation dialog when removing a layer. The PR is ready for review now. spinner.mp4 |
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.
Looks great! Thanks for taking this on!
@@ -6,6 +6,7 @@ | |||
from IPython.core.display import HTML, display | |||
|
|||
import ee | |||
import ipyleaflet |
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.
We shouldn't import ipyleaflet
in map_widgets
. This file is supposed to be agnostic to map implementation. Two possible solutions are listed below.
-
The preferred option is to avoid this problem entirely by showing the confirmation dialog above (or inside) the existing widget. It could look like another row that's added below the row scheduled for deletion or a dialog that appears over everything.
-
Build this new "confirmation" widget as any of the other core widgets and have the widget control code live in core. The new widget needs some sort of "on_confirm_deletion" event that the code code must set. Example:
Line 683 in b115dfb
def _add_basemap_selector(self, position: str, **kwargs) -> None:
@@ -822,11 +823,95 @@ def _render_layer_row(self, layer): | |||
) | |||
settings_button.on_click(self._on_layer_settings_click) | |||
|
|||
spinner = ipywidgets.Button( |
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.
Instead of a standalone spinner, could we combine the spinner and delete button? It saves valuable screen real estate. We can use ipyevents.Event
for mouse events.
Screen.Recording.2024-05-14.at.5.15.49.PM.mov
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.
Good suggestion. I can combine the spinner and delete button as a single button with ipyevents. I am not sure if it is feasible to display the confirmation widget on top of the layer manager just like what you show in the demo.
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.
See the new demo
This PR adds a layer loading spinner and remove layer button to the layer manager. The layer widget padding is slightly reduced from
8px
to4x
to make room for the two newly added buttons.layer_loading_spinner.mp4