Skip to content

Commit

Permalink
Rename 'tooltip_template' to tooltip in py
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Jun 1, 2024
1 parent fc97c21 commit ebaf9c8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/examples/deckgl_layer/airports_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

m.add_deck_layers(
[deck_geojson_layer, deck_arc_layer],
tooltip_template={
tooltip={
"airports": "{{ &properties.name }}",
"arcs": "gps_code: {{ properties.gps_code }}",
},
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/deckgl_layer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from maplibre import Map, MapOptions, render_maplibregl
from maplibre.basemaps import Carto
from maplibre.ui import use_deckgl

# from shiny import reactive
from shiny.express import input, render, ui

Expand Down Expand Up @@ -33,7 +32,7 @@
"pickable": True,
}

m.add_deck_layers([deck_grid_layer], tooltip_template="Number of points: {{ count }}")
m.add_deck_layers([deck_grid_layer], tooltip="Number of points: {{ count }}")

# Shiny Express
use_deckgl()
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/deckgl_layer/app_update_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def deck_grid_layer(cell_size: int = DEFAULT_CELL_SIZE):
}


m.add_deck_layers([deck_grid_layer()], tooltip_template="Number of points: {{ count }}")
m.add_deck_layers([deck_grid_layer()], tooltip="Number of points: {{ count }}")

# Shiny Express
use_deckgl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
m.add_tooltip("circles", "name")
m.add_deck_layers(
[deck_arc_layer],
tooltip_template={
tooltip={
"arcs": "gps_code: {{ properties.gps_code }}",
},
)
Expand Down
9 changes: 4 additions & 5 deletions maplibre/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,15 @@ def to_html(self, title: str = "My Awesome Map", **kwargs) -> str:
)
return output

def add_deck_layers(
self, layers: list[dict], tooltip_template: str | dict = None
) -> None:
def add_deck_layers(self, layers: list[dict], tooltip: str | dict = None) -> None:
"""Add Deck.GL layers to the layer stack
Args:
layers (list[dict]): A list of dictionaries containing the Deck.GL layers to be added.
tooltip_template (str | dict): ...
tooltip (str | dict): Either a single mustache template string applied to all layers
or a dictionary where keys are layer ids and values are mustache template strings.
"""
self.add_call("addDeckOverlay", layers, tooltip_template)
self.add_call("addDeckOverlay", layers, tooltip)

def set_deck_layers(self, layers: list[dict]):
"""Update Deck.GL layers
Expand Down

0 comments on commit ebaf9c8

Please sign in to comment.