Skip to content

Commit bbe70ad

Browse files
committed
feat: Add support for additional save callbacks in GeoAnimatorManager
1 parent a7dc9c5 commit bbe70ad

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

dvue/animator/ui.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ def __init__(
492492
self._x2_callback = x2_callback
493493
self._extra_frame_callbacks: list = []
494494
self._transform_callbacks: list = []
495+
self._extra_save_callbacks: list = []
495496

496497
# ----------------------------------------------------------------
497498
# 2. Project GDF to EPSG:3857 once.
@@ -1061,6 +1062,18 @@ def _load_frame(self, step_idx: int) -> None:
10611062
f"{self._title + ' \u2014 ' if self._title else ''}{ts_str}"
10621063
)
10631064

1065+
def add_save_callback(self, fn) -> None:
1066+
"""Register a callback invoked after each successful config save.
1067+
1068+
The callback receives the saved file path as its sole argument.
1069+
Multiple callbacks are supported and are called in registration order.
1070+
1071+
Parameters
1072+
----------
1073+
fn : callable(path: str) -> None
1074+
"""
1075+
self._extra_save_callbacks.append(fn)
1076+
10641077
def add_frame_callback(self, fn) -> None:
10651078
"""Register a callback invoked on every animation frame.
10661079
@@ -1301,6 +1314,8 @@ def _on_save_config(self, event) -> None:
13011314
yaml.dump(state, f, default_flow_style=False,
13021315
sort_keys=False, allow_unicode=True)
13031316
self._save_config_status.object = f"\u2713 Saved to `{path}`"
1317+
for _cb in self._extra_save_callbacks:
1318+
_cb(path)
13041319
except Exception as exc:
13051320
self._save_config_status.object = f"\u2717 {exc}"
13061321

0 commit comments

Comments
 (0)