Resume saved automatic previews when reopening projects

This commit is contained in:
Dandaedre 2026-11-18 15:46:57 +01:00
parent 4b411aa020
commit f954551711
9 changed files with 34 additions and 15 deletions

2
Cargo.lock generated
View File

@ -602,7 +602,7 @@ dependencies = [
[[package]]
name = "canvas-pilot"
version = "0.9.65"
version = "0.9.66"
dependencies = [
"base64 0.22.1",
"craft-dwg",

View File

@ -4,7 +4,7 @@ default-members = ["crates/canvas-pilot"]
resolver = "3"
[workspace.package]
version = "0.9.65"
version = "0.9.66"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot"

View File

@ -164,7 +164,7 @@ impl CaptureUi {
source: p.source_id - 1,
texture,
bytes,
paused: true,
paused: false,
automatic: p.automatic,
capture_on_selection: false,
name: p.name.clone(),
@ -922,7 +922,7 @@ mod tests {
assert_eq!(app.capture.layers[&id].input, 5);
}
#[test]
fn project_restores_capture_stills_and_settings_without_network_work() {
fn project_restores_stills_and_resumes_auto_refresh_only_on_matching_connection() {
use canvas_pilot::project::Project;
let ctx = egui::Context::default();
let reference = tiny_reference(&ctx, "Input 4 still");
@ -956,7 +956,7 @@ mod tests {
assert_eq!(restored.project(), saved);
assert_eq!(restored.capture.layers[&id].bytes, reference.bytes);
assert!(restored.layer_preview(0).is_some());
assert!(restored.capture.layers[&id].paused);
assert!(!restored.capture.layers[&id].paused);
assert!(restored.capture.pending.is_none());
assert!(restored.capture.last_request.is_none());
restored.device.host = app.device.host;
@ -969,8 +969,17 @@ mod tests {
}}}}),
});
assert!(restored.next_selection_capture().is_none());
assert_eq!(restored.next_preview_refresh(), Some(4));
let host = restored.device.host.clone();
restored.device.host = "other-device:3000".into();
assert!(restored.next_preview_refresh().is_none());
restored.capture.layers.get_mut(&id).unwrap().paused = false;
restored.device.host = host;
restored.capture.layers.get_mut(&id).unwrap().enabled = false;
assert!(restored.next_preview_refresh().is_none());
restored.capture.layers.get_mut(&id).unwrap().enabled = true;
restored.capture.layers.get_mut(&id).unwrap().automatic = false;
assert!(restored.next_preview_refresh().is_none());
restored.capture.layers.get_mut(&id).unwrap().automatic = true;
assert_eq!(restored.next_preview_refresh(), Some(4));
let mut invalid = saved.clone();
invalid.workspace.previews[0].image_base64 = "bm90IGFuIGltYWdl".into();

View File

@ -4,6 +4,14 @@
## Unreleased
### v0.9.66
- Reopening a project now resumes saved preview auto-refresh when its matching
device is connected and snapshots are available. Offline stills remain visible;
loading does not connect to a saved address. Disabled and still-only previews
remain idle. Project format is unchanged.
### v0.9.65
- Added per-destination **Send options** to the mapping window mockup: Position,

View File

@ -133,8 +133,9 @@ input's image. Disabling the preview hides it and pauses its refreshes.
**Crop guide opacity** defaults to 35% with an image; without an enabled image,
guides remain fully opaque and the slider is disabled. Selection handles stay
fully visible. Layer previews, captured stills and timer settings are saved in the project.
Saved auto-refresh reopens paused: use **Resume auto-refresh** or **Capture still**
to resume. Opening a project does not fetch images. The timer
Saved auto-refresh resumes when the matching device is connected and input snapshots
are available. Opening a project does not start a connection; saved images remain
visible offline. The timer
pauses offline and while the separate capture/import dialog is open. Reduced
snapshot resolution and freshness are controlled by the device. If snapshots
are disabled for an input, enable them in WebRCS and refresh the connection.

View File

@ -459,7 +459,7 @@ folders, visibility/locking, pivots, Midra links, reference images, selection,
viewport and positioning settings. It also saves snapping/grid settings, group
resize mode, collapsed folders, capture input assignments, the last captured
stills, guide opacity and refresh settings. Saved stills work offline; automatic
refresh reopens paused until you capture or resume it explicitly.
refresh resumes when the matching device is connected and snapshots are available.
Connection history, startup connection, theme and Program permission remain in
application preferences. Unsaved drafts, undo history, open menus, active editing

View File

@ -21,7 +21,7 @@ not every control should become document data.
| Collapsed folder rows | **Added to project**. Keeps larger memory collections manageable; stale folder names are filtered out. |
| Preview input, device-address binding, editor-source binding, enable flag | **Added to project** per stable layer ID. Preselected-but-not-yet-captured inputs are saved too. |
| Last captured still, guide opacity | **Added to project**. Original image bytes are embedded for offline reuse, subject to the shared 64 MiB image budget. |
| Auto-refresh choice, refresh interval, show no-signal inputs | **Added to project**. Auto-refresh restores paused; no fetch or connection is initiated by loading. Resume/capture is explicit. |
| Auto-refresh choice, refresh interval, show no-signal inputs | **Added to project**. Auto-refresh resumes through the scheduler on the matching online connection; loading never initiates a connection. Offline stills remain available. |
| Theme/recent themes, connection address/history, startup connection, allow Program | Application settings only. These belong to the workstation/operator; opening a document must not switch connections or global permissions. Capture host strings are bindings, not connection instructions. |
| All/selected/folder transfer scope, target bank, export sizing strategy | Session choices. Links and folders are persistent; the current transfer action and destination bank are not document content. Existing behavior is retained. |
| Advanced shared-device input edit checkbox and staged edits | Session-only by design. These are pending changes to external shared input settings; only explicit edits are sent. Layer geometry and processed source dimensions are saved separately. |

View File

@ -328,9 +328,10 @@ loader as references, on the project-loading worker. Malformed images abort the
entire open, preserving current work. A capture shared by several layers is
embedded in each preview entry; the same combined size limit applies.
Restoring a project never starts a connection or a capture. Saved stills appear
offline; saved automatic capture choices are **paused** until Capture still,
Resume auto-refresh, changing the input, or explicitly toggling auto-refresh.
Restoring a project never starts a connection. Saved stills appear offline; saved
automatic capture choices resume through the normal capture scheduler when the
matching device is online and input snapshots are available. Disabled previews
and still-only previews do not request refreshes.
Pending jobs, throttles and queued selection captures are not restored. Device
host matching still applies to automatic requests. These settings/stills are not
part of geometry export formats; fixed references retain their existing optional

View File

@ -103,7 +103,7 @@ Layer-preview assignments, original image bytes, visibility toggles and guide op
are saved in project version 11, but omitted from geometry exports. Add as reference remains the fixed-reference path;
generic artwork exports include those references only through the existing
background option. Reloading a project makes no capture requests.
**Auto-refresh this preview** is opt-in per layer and restored paused, with a shared request interval
**Auto-refresh this preview** is opt-in per layer and restored ready to resume on the matching connection, with a shared request interval
of 5–300 seconds (default 10). Assignments also retain the device address and
physical input number in the project. Visible layers with enabled automatic previews, unchanged
local inputs and the current device address are eligible; unavailable or
@ -132,7 +132,7 @@ dialog is open. Errors retain the last good image and wait for the next interval
there are no immediate retries. Turning off refresh prevents applying an in-flight
automatic result. Project replacement restores saved assignments and discards stale results.
Automatic refresh never changes fixed references or device settings. Timer settings
are persisted in project version 11. Saved automatic previews stay paused until an explicit capture or resume; opening a project makes no device requests.
are persisted in project version 11. Saved automatic previews resume through the normal scheduler on the matching online connection; opening a project does not initiate a connection.
Live feeds and separate image-file saving are not implemented.
After successful connection/linked load or device-layer import, untouched layer