Share pixbufs between frames panel and scrub bar — single disk read per frame
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -647,9 +647,9 @@ class ChtWindow(Adw.ApplicationWindow):
|
||||
self._frames_panel.load_items(items)
|
||||
self._known_frames = {item["id"] for item in items}
|
||||
self._agent_output.append(f" Loaded {len(items)} frame thumbnails.\n")
|
||||
# Update scrub bar thumbnails
|
||||
self._timeline_controls.scrub_bar.set_frames(
|
||||
[{"timestamp": e["timestamp"], "path": str(e["path"])} for e in entries]
|
||||
# Update scrub bar thumbnails — reuse already-loaded pixbufs
|
||||
self._timeline_controls.scrub_bar.set_frames_from_pixbufs(
|
||||
[{"timestamp": it["timestamp"], "pixbuf": it["pixbuf"]} for it in items]
|
||||
)
|
||||
|
||||
def _load_existing_transcript(self):
|
||||
@@ -676,7 +676,7 @@ class ChtWindow(Adw.ApplicationWindow):
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(str(entry["path"]), 256, 144, True)
|
||||
auto = self._timeline.state.live and not self._transcript_panel.has_selection
|
||||
self._frames_panel.add_item(fid, pixbuf, entry["timestamp"], auto_select=auto)
|
||||
self._timeline_controls.scrub_bar.add_frame(entry["timestamp"], str(entry["path"]))
|
||||
self._timeline_controls.scrub_bar.add_frame_from_pixbuf(entry["timestamp"], pixbuf)
|
||||
except Exception as e:
|
||||
log.warning("Thumbnail load failed for %s: %s", fid, e)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user