not sure about this commit

This commit is contained in:
2026-04-03 08:21:07 -03:00
parent 51c0bdd2da
commit 908231f98a
5 changed files with 122 additions and 109 deletions

View File

@@ -122,10 +122,18 @@ class ChtWindow(Adw.ApplicationWindow):
def _on_frame_selection_changed(self, panel):
if panel.selected is not None:
self._transcript_panel.clear_selection()
ts = panel._timestamps.get(panel.selected)
if ts is not None:
self._timeline_controls.scrub_bar.set_cursor(ts)
def _on_transcript_selection_changed(self, panel):
if panel.has_selection:
self._frames_panel.clear_selection()
last = panel.selected[-1] if panel.selected else None
if last:
ts = panel._timestamps.get(last)
if ts is not None:
self._timeline_controls.scrub_bar.set_cursor(ts)
# -- Connect / Disconnect --
@@ -259,11 +267,16 @@ class ChtWindow(Adw.ApplicationWindow):
# Refresh manifest so scrub bar shows completed segments
self._update_scrub_bar_manifest()
else:
# Scrub → Live: restore recording path and resume
# Scrub → Live: restore recording path, refresh GUI, resume
mgr = self._lifecycle.stream_mgr
if mgr:
self._monitor.set_recording(mgr.recording_path)
self._timeline.toggle_live()
# Catch up on anything that arrived while scrubbing
self._update_scrub_bar_manifest()
# Scroll panels to latest items
self._frames_panel.scroll_to_end()
self._transcript_panel.scroll_to_end()
# -- Scrub --
@@ -282,7 +295,7 @@ class ChtWindow(Adw.ApplicationWindow):
scrub_bar.set_frames([{"timestamp": f["timestamp"], "path": str(f["path"])} for f in frames])
def _on_segment_activated(self, scrub_bar, segment_index):
"""User clicked a segment block — request its proxy."""
"""User clicked/dragged into a segment — request its proxy."""
if not self._manifest or segment_index >= len(self._manifest):
return
seg = self._manifest[segment_index]
@@ -294,20 +307,14 @@ class ChtWindow(Adw.ApplicationWindow):
self._proxy_mgr = ProxyManager(sid)
scrub_bar.set_proxy_state(segment_index, "generating")
# Store pending seek position (the click position)
self._pending_scrub_global = seg["global_offset"]
def _on_ready(proxy_path):
scrub_bar.set_proxy_state(segment_index, "ready")
scrub_bar.set_active_segment(segment_index)
self._monitor.set_scrub_source(proxy_path, global_offset=seg["global_offset"])
# Apply pending seek now that proxy is loaded
gt = self._pending_scrub_global
# Seek to current cursor position (set by scrub-position signal)
gt = self._timeline.state.cursor
local = gt - seg["global_offset"]
self._timeline.state.cursor = gt
self._timeline.state.live = False
self._timeline.state.paused = True
self._timeline.emit("changed")
self._monitor.scrub_to(max(0.0, local))
self._proxy_mgr.request(seg_path, on_ready=_on_ready)