very nice

This commit is contained in:
2026-04-03 07:18:42 -03:00
parent 84dc1405dc
commit 51c0bdd2da
8 changed files with 178 additions and 17 deletions

View File

@@ -176,6 +176,24 @@ class FramesPanel(Gtk.Box):
self._selected = None
self.emit("selection-changed")
def highlight_nearest(self, timestamp: float) -> None:
"""Scroll to and briefly highlight the frame closest to *timestamp*."""
if not self._order:
return
best_id = None
best_dist = float("inf")
for fid, ts in self._timestamps.items():
d = abs(ts - timestamp)
if d < best_dist:
best_dist = d
best_id = fid
if not best_id or best_id not in self._widgets:
return
widget = self._widgets[best_id]
widget.add_css_class("frame-highlight")
self._scroll_to(widget)
GLib.timeout_add(400, lambda: widget.remove_css_class("frame-highlight") or False)
def clear(self):
"""Remove all items and reset state."""
self._selected = None