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

Refactor toolbar into an ipywidgets subclass #1664

Merged
merged 6 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions geemap/geemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2584,9 +2584,10 @@ def add_toolbar(self, position="topright", **kwargs):
position (str, optional): The position of the toolbar. Defaults to "topright".
"""

from .toolbar import main_toolbar

main_toolbar(self, position, **kwargs)
from .toolbar import Toolbar, main_tools, extra_tools
self._toolbar = Toolbar(self, main_tools, extra_tools)
toolbar_control = ipyleaflet.WidgetControl(widget=self._toolbar, position=position)
self.add(toolbar_control)

def add_plot_gui(self, position="topright", **kwargs):
"""Adds the plot widget to the map.
Expand Down Expand Up @@ -3941,10 +3942,7 @@ def to_image(self, filename=None, monitor=1):
def toolbar_reset(self):
"""Reset the toolbar so that no tool is selected."""
if hasattr(self, "_toolbar"):
toolbar_grid = self._toolbar
if toolbar_grid is not None:
for tool in toolbar_grid.children:
tool.value = False
self._toolbar.reset()

def add_raster(
self,
Expand Down
Loading