Skip to content

Commit bbd232e

Browse files
committed
fix(grid): add control for grid interval
1 parent 27e0a15 commit bbd232e

5 files changed

Lines changed: 70 additions & 1 deletion

File tree

‎.github/dependabot.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
groups:
9+
actions:
10+
patterns:
11+
- "*"

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
fetch-depth: 0
2828
- name: Python Semantic Release
2929
id: release
30-
uses: python-semantic-release/python-semantic-release@v10.4.1
30+
uses: python-semantic-release/python-semantic-release@v10.6.2
3131
with:
3232
github_token: ${{ secrets.GITHUB_TOKEN }}
3333

‎src/e3sm_quickview/app.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,14 @@ def _on_center(self, spherical_center_lat, spherical_center_lon, projection, **_
661661
self.source.Clip()
662662
self.view_manager.camera_projection()
663663

664+
@change("projection", "grid_interval")
665+
def _on_grid_spacing(self, projection, grid_interval, **_):
666+
if projection == ["Spherical"]:
667+
self.source.UpdateGridInterval(grid_interval)
668+
self.view_manager.reset_camera()
669+
else:
670+
self.source.UpdateGridInterval(30)
671+
664672
def _on_slicing_change(self, var, ind_var, **_):
665673
with perf.timed(f"tick.{var}={self.state[ind_var]}.total"):
666674
with perf.timed("tick.pipeline"):

‎src/e3sm_quickview/components/toolbars.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,50 @@ def __init__(self):
382382
inset=True,
383383
)
384384

385+
# Spacer
386+
html.Div(
387+
classes="px-1",
388+
v_if="projection[0] === 'Spherical' && show_grid_spacing && show_spherical_center",
389+
)
390+
391+
# --- Grid spacing ---
392+
with v3.VSheet(
393+
classes="d-flex align-center rounded px-1 ga-1 py-1",
394+
color=("show_grid_spacing ? 'grey-lighten-3' : 'transparent'",),
395+
v_if="projection[0] === 'Spherical'",
396+
):
397+
v3.VIconBtn(
398+
v_tooltip_bottom="'Toggle Grid Spacing'",
399+
icon="mdi-grid",
400+
flat=True,
401+
click="show_grid_spacing = !show_grid_spacing",
402+
color=("show_grid_spacing ? 'primary' : ''",),
403+
size=("show_grid_spacing ? 'small' : 'default'",),
404+
classes=("show_grid_spacing ? 'ml-1' : 'rounded'",),
405+
)
406+
with (
407+
v3.VExpandXTransition(),
408+
html.Div(
409+
v_if=("show_grid_spacing", False),
410+
classes="d-flex align-center ga-1",
411+
),
412+
):
413+
v3.VDivider(vertical=True, classes="mx-1")
414+
v3.VNumberInput(
415+
label="Spacing",
416+
v_model=("grid_interval", 30),
417+
min=("1",),
418+
max=("30",),
419+
step=("1",),
420+
hide_details=True,
421+
density="compact",
422+
variant="plain",
423+
flat=True,
424+
control_variant="stacked",
425+
inset=True,
426+
style="min-width: 6rem;",
427+
)
428+
385429
with v3.VCol():
386430
with v3.VRow(classes="mx-2 my-0"):
387431
v3.VLabel(

‎src/e3sm_quickview/pipeline.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def __init__(self, projection="Mollweide"):
103103
self.actor.property.diffuse_color = (0.67, 0.67, 0.67)
104104
self.actor.property.opacity = 0.4
105105

106+
def set_interval(self, interval):
107+
self.grid_lines.Interval = interval
108+
106109
def crop(self, longitude_min_max, latitude_min_max):
107110
self.grid_lines.LongitudeRange = longitude_min_max
108111
self.grid_lines.LatitudeRange = latitude_min_max
@@ -266,6 +269,9 @@ def variables(self):
266269
def dimensions(self):
267270
return self.data_reader.dimensions
268271

272+
def UpdateGridInterval(self, interval):
273+
self.grid_lines.set_interval(interval)
274+
269275
def ApplyClipping(self, cliplong, cliplat):
270276
if not self.valid:
271277
return

0 commit comments

Comments
 (0)