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 layer loading spinner and remove layer button #1983

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Apr 21, 2024

This PR adds a layer loading spinner and remove layer button to the layer manager. The layer widget padding is slightly reduced from 8px to 4x to make room for the two newly added buttons.

layer_loading_spinner.mp4

Copy link

github-actions bot commented Apr 21, 2024

@github-actions github-actions bot temporarily deployed to pull request April 21, 2024 02:03 Inactive
@giswqs giswqs linked an issue Apr 21, 2024 that may be closed by this pull request
@giswqs
Copy link
Member Author

giswqs commented Apr 21, 2024

Just realized that I forgot to add a confirmation dialog when removing a layer. Will add that later

@giswqs
Copy link
Member Author

giswqs commented May 10, 2024

I have added the confirmation dialog when removing a layer. The PR is ready for review now.

spinner.mp4

@github-actions github-actions bot temporarily deployed to pull request May 10, 2024 04:35 Inactive
Copy link
Collaborator

@naschmitz naschmitz left a 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
Copy link
Collaborator

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.

  1. 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.

  2. 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:

    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(
Copy link
Collaborator

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

Copy link
Member Author

@giswqs giswqs May 15, 2024

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.

Copy link
Member Author

@giswqs giswqs May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the new demo

Screen.Recording.2024-05-14.at.11.06.21.PM.mov

@github-actions github-actions bot temporarily deployed to pull request May 15, 2024 03:12 Inactive
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

Successfully merging this pull request may close these issues.

Layer loading spinner proof-of-concept
2 participants