Allow opening Midra mapping and transfer while offline

This commit is contained in:
Dandaedre 2026-11-15 12:40:04 +01:00
parent 0c37ad60fd
commit ab8209301a
3 changed files with 34 additions and 17 deletions

View File

@ -562,12 +562,8 @@ impl Editor {
}
pub(super) fn midra_apply_button(&mut self, ui: &mut egui::Ui) {
if ui
.add_enabled(
self.device.online() && self.device.pending.is_none(),
egui::Button::new("Midra mapping & transfer…"),
)
.on_hover_text("Configure layer links and send/load options.")
.on_disabled_hover_text("Connect to Midra and wait for any transfer to finish.")
.button("Midra mapping & transfer…")
.on_hover_text("Open connection settings, layer links and send/load options.")
.clicked()
{
self.open_midra_export();
@ -706,15 +702,19 @@ impl Editor {
.open(&mut open).default_width(660.0).collapsible(false)
.max_height((ctx.screen_rect().height() - 100.0).max(200.0)).vscroll(true)
.show(ctx, |ui| {
ui.horizontal(|ui| {
ui.label("Apply to");
self.midra_scope_picker(ui);
});
if self.device.scope == TransferScope::Selected {
self.transfer_layer_picker(ui, "Choose selected layers…");
if self.device.online() {
ui.horizontal(|ui| {
ui.label("Apply to");
self.midra_scope_picker(ui);
});
if self.device.scope == TransferScope::Selected {
self.transfer_layer_picker(ui, "Choose selected layers…");
}
}
let scope_indices = self.device.scope.indices(&self.layout);
ui.weak(format!("{} editor layers in scope · {} saved links. Unlinked layers are skipped by linked send/load.", scope_indices.len(), self.device.scoped_links(&self.layout).len()));
if self.device.online() {
ui.weak(format!("{} editor layers in scope · {} saved links. Unlinked layers are skipped by linked send/load.", scope_indices.len(), self.device.scoped_links(&self.layout).len()));
}
ui.horizontal(|ui| {
if ui.button("Connection settings…").clicked() { self.device.connection_open = true; }
if ui.add_enabled(self.device.online() && self.device.pending.is_none(), egui::Button::new("Refresh layers")).clicked() { self.device.fetch(ctx); }
@ -1542,10 +1542,12 @@ mod tests {
}
#[test]
fn status_mapping_opens_settings_without_writing_even_when_linked() {
for linked in [false, true] {
for (online, linked) in [(false, false), (false, true), (true, false), (true, true)] {
let ctx = egui::Context::default();
let mut app = Editor::default();
app.device.snapshot = Some(linked_test_snapshot());
if online {
app.device.snapshot = Some(linked_test_snapshot());
}
app.layout.select(Some(0));
if linked {
app.layout
@ -1557,7 +1559,9 @@ mod tests {
}),
)
.unwrap();
assert!(app.device.linked_plans(&app.layout).is_ok());
if online {
assert!(app.device.linked_plans(&app.layout).is_ok());
}
}
let before = app.layout.layers().clone();
super::super::tests::frame(&mut app, &ctx, vec![]);
@ -1587,6 +1591,13 @@ mod tests {
assert!(app.device.open && app.device.prepare_send);
assert!(app.device.pending.is_none());
assert_eq!(*app.layout.layers(), before);
if !online {
super::super::tests::click_text(&mut app, &ctx, "Connection settings…");
assert!(app.device.connection_open);
assert!(app.device.snapshot.is_none());
assert!(app.device.pending.is_none());
assert!(!app.device.sending);
}
}
}
#[test]

View File

@ -4,6 +4,10 @@
## Unreleased
- Allow Midra mapping & transfer to open while offline, with Connection settings
available and scope/mapping controls hidden until connected. UI regression
coverage verifies offline opening does not start a read or send.
- Validate device identity before downloading state. Aquilon now reports its
unimplemented adapter instead of a misleading 32 MiB limit error. A read-only
AQL Cmax 6.2.79 emulator probe measured a 118 MiB store; Aquilon connectivity

View File

@ -67,7 +67,9 @@ Choose a destination beside each device layer: existing layer, new layer, or ski
Centered crops import visible bounds and framing; unsupported aspect/mask cases
are explained in the review. Imports are one undoable edit.
After connecting, open **Export → Midra mapping & transfer…**. Choose editor layers,
Open **Export → Midra mapping & transfer…** even while offline, then use
**Connection settings…** to connect. Mapping and transfer controls appear once
device data is available. Choose editor layers,
map each to a Midra layer, select **Preview** or **Program**, and select a container
strategy: **Output-sized** or **Source aspect**. Expand **Exact device changes** to
review sizes, centers, crop values and aspect, then click **Send mapped layers**. The final row groups **Load linked layers**