Open Midra configuration before applying selected changes
This commit is contained in:
parent
ea4f5eec65
commit
e93b9050e8
|
|
@ -173,10 +173,20 @@ impl DeviceUi {
|
|||
}
|
||||
impl Editor {
|
||||
pub(super) fn midra_apply_button(&mut self, ui: &mut egui::Ui) {
|
||||
self.midra_send_button(ui, false);
|
||||
if ui.add_enabled(
|
||||
self.device.online() && self.device.pending.is_none(),
|
||||
egui::Button::new("Apply changes…"),
|
||||
)
|
||||
.on_hover_text("Choose layers, destination links and export settings, then click Send mapped layers.")
|
||||
.on_disabled_hover_text("Connect to Midra and wait for any transfer to finish.")
|
||||
.clicked() {
|
||||
self.device.prepare_send = true;
|
||||
self.device.open = true;
|
||||
ui.close_menu();
|
||||
}
|
||||
}
|
||||
pub(super) fn midra_send_button(&mut self, ui: &mut egui::Ui, all: bool) {
|
||||
let plans = self.device.linked_plans(&self.layout, all);
|
||||
pub(super) fn midra_send_button(&mut self, ui: &mut egui::Ui) {
|
||||
let plans = self.device.linked_plans(&self.layout, true);
|
||||
let enabled = self.device.online() && self.device.pending.is_none();
|
||||
let tooltip = if self.device.sending {
|
||||
"Sending and checking readback…".into()
|
||||
|
|
@ -196,10 +206,8 @@ impl Editor {
|
|||
ui,
|
||||
if self.device.sending {
|
||||
"Applying…"
|
||||
} else if all {
|
||||
"Send all linked layers"
|
||||
} else {
|
||||
"Apply to Midra"
|
||||
"Send all linked layers"
|
||||
},
|
||||
enabled,
|
||||
)
|
||||
|
|
@ -210,10 +218,6 @@ impl Editor {
|
|||
match plans {
|
||||
Ok(plans) => {
|
||||
self.device.send(ui.ctx(), plans);
|
||||
if !all {
|
||||
self.device.prepare_send = true;
|
||||
self.device.open = true;
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
self.device.error = error;
|
||||
|
|
@ -324,7 +328,7 @@ impl Editor {
|
|||
if let Err(e) = self.layout.set_midra_link(i, link) { self.device.error = e; }
|
||||
}
|
||||
}
|
||||
self.midra_send_button(ui, true);
|
||||
self.midra_send_button(ui);
|
||||
return;
|
||||
}
|
||||
egui::ScrollArea::vertical().max_height(300.0).show(ui, |ui| {
|
||||
|
|
@ -691,7 +695,7 @@ mod tests {
|
|||
|ctx| {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
pos = ui.cursor().min + Vec2::new(30.0, 10.0);
|
||||
app.midra_send_button(ui, true);
|
||||
app.midra_send_button(ui);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
@ -706,7 +710,7 @@ mod tests {
|
|||
..Default::default()
|
||||
},
|
||||
|ctx| {
|
||||
egui::CentralPanel::default().show(ctx, |ui| app.midra_send_button(ui, true));
|
||||
egui::CentralPanel::default().show(ctx, |ui| app.midra_send_button(ui));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -716,45 +720,51 @@ mod tests {
|
|||
assert!(!app.device.prepare_send);
|
||||
}
|
||||
#[test]
|
||||
fn status_apply_opens_mapping_without_writing_when_unconfigured() {
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = Editor::default();
|
||||
app.device.snapshot = Some(device::Snapshot {
|
||||
identity: "Test device".into(),
|
||||
raw: serde_json::Value::Null,
|
||||
screens: vec![device::Screen {
|
||||
id: "1".into(),
|
||||
resolution: [1920, 1080],
|
||||
preview_bank: "UP".into(),
|
||||
layers: vec![],
|
||||
}],
|
||||
});
|
||||
let before = app.layout.layers().clone();
|
||||
super::super::tests::frame(&mut app, &ctx, vec![]);
|
||||
let output = super::super::tests::frame(&mut app, &ctx, vec![]);
|
||||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::epaint::Shape::Text(t) if t.galley.job.text == "Apply to Midra" => {
|
||||
Some(t.pos + Vec2::new(8.0, 6.0))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.expect("status apply button");
|
||||
for pressed in [true, false] {
|
||||
super::super::tests::frame(
|
||||
&mut app,
|
||||
&ctx,
|
||||
vec![
|
||||
egui::Event::PointerMoved(pos),
|
||||
super::super::tests::mouse(pos, pressed),
|
||||
],
|
||||
);
|
||||
fn status_apply_opens_mapping_without_writing_even_when_linked() {
|
||||
for linked in [false, true] {
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = Editor::default();
|
||||
app.device.snapshot = Some(linked_test_snapshot());
|
||||
app.layout.select(Some(0));
|
||||
if linked {
|
||||
app.layout
|
||||
.set_midra_link(
|
||||
0,
|
||||
Some(midra_layout::MidraLink {
|
||||
screen: "1".into(),
|
||||
layer: "1".into(),
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(app.device.linked_plans(&app.layout, false).is_ok());
|
||||
}
|
||||
let before = app.layout.layers().clone();
|
||||
super::super::tests::frame(&mut app, &ctx, vec![]);
|
||||
let output = super::super::tests::frame(&mut app, &ctx, vec![]);
|
||||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| match &s.shape {
|
||||
egui::epaint::Shape::Text(t) if t.galley.job.text == "Apply changes…" => {
|
||||
Some(t.pos + Vec2::new(8.0, 6.0))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.expect("status apply button");
|
||||
for pressed in [true, false] {
|
||||
super::super::tests::frame(
|
||||
&mut app,
|
||||
&ctx,
|
||||
vec![
|
||||
egui::Event::PointerMoved(pos),
|
||||
super::super::tests::mouse(pos, pressed),
|
||||
],
|
||||
);
|
||||
}
|
||||
assert!(app.device.open && app.device.prepare_send);
|
||||
assert!(app.device.pending.is_none());
|
||||
assert_eq!(*app.layout.layers(), before);
|
||||
}
|
||||
assert!(app.device.open && app.device.prepare_send);
|
||||
assert!(app.device.pending.is_none());
|
||||
assert_eq!(*app.layout.layers(), before);
|
||||
}
|
||||
#[test]
|
||||
fn send_review_only_maps_selected_layers_and_never_mutates_layout() {
|
||||
|
|
|
|||
|
|
@ -2426,7 +2426,7 @@ impl Editor {
|
|||
Vec2::new(160.0, 25.0),
|
||||
)),
|
||||
|ui| {
|
||||
self.midra_send_button(ui, true);
|
||||
self.midra_send_button(ui);
|
||||
},
|
||||
);
|
||||
ink.text(
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ impl Editor {
|
|||
}
|
||||
pub(super) fn export_menu(&mut self, ui: &mut egui::Ui) {
|
||||
self.midra_apply_button(ui);
|
||||
self.midra_send_button(ui, true);
|
||||
self.midra_send_button(ui);
|
||||
if ui.button("Configure Midra export…").clicked() {
|
||||
self.device.prepare_send = true;
|
||||
self.device.open = true;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ partial/uncertain outcomes without blind retries or automatic rollback.
|
|||
Program selection is explicit. The application defaults to Preview and hides Program unless the persisted `allow_sending_to_program` preference is enabled. Turning it off resets the exporter to Preview, including quick Apply. Layer screen/destination links are saved in project version 5. Plans and raw snapshots are not saved in projects or preferences. The device address is saved in [application settings](midra-layout-settings.md), never in projects. Refresh and screen changes preserve saved links. Physical display
|
||||
validation remains separate from the successful device-field and import round trips.
|
||||
|
||||
The status-bar and Export-menu **Apply to Midra** actions prepare a fresh plan for the current editor selection using saved layer links and the session target and sizing mode. Valid changed plans send immediately with readback verification, without a preflight refusal. Missing or invalid mappings open the configuration window without writing; busy/offline actions are disabled; unchanged stored geometry can still be explicitly applied. No persistent schema changes are involved.
|
||||
The status-bar and Export-menu **Apply changes…** actions only open export configuration, even when current layers have valid saved links. They never start a write. The user chooses layers, mappings, target and sizing, then explicitly clicks **Send mapped layers**. Busy/offline actions are disabled. **Send all linked layers** remains a separate direct-send action using saved links. No persistent schema changes are involved.
|
||||
|
||||
Snapshot layer lists omit unassigned source slots (`NONE` or empty), before geometry validation. Assigned layers remain available even when OFF.
|
||||
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ and disabled in these pickers; choosing layers changes no geometry. Full project
|
|||
save/load and screen reference images are document-wide operations, so they have
|
||||
no layer mapping.
|
||||
|
||||
**Apply to Midra**, beside ONLINE/OFFLINE and in **Export**, sends the selected layers using the current destination mappings, screen, Preview/Program target and sizing strategy. If mapping is incomplete, it opens the send window first. Configure these choices in **Export → Configure Midra export…**. The action is disabled offline or during transfers. Sending writes geometry, pulses the WebRCS preset-update command, and verifies geometry readback; results appear in the send window. Only applied editor values are sent.
|
||||
**Apply changes…**, beside ONLINE/OFFLINE and in **Export**, opens the Midra export configuration without sending, even when layers already have saved links. Choose layers, destination mappings, Preview/Program and sizing, then click **Send mapped layers** to send. The action is disabled offline or during transfers. Sending writes geometry, pulses the WebRCS preset-update command, and verifies geometry readback. Only applied editor values are sent.
|
||||
|
||||
Layer rows use padlock and eye icon buttons for locking and visibility, with tooltips and highlighted locked/hidden states. Double-click a layer name in the right-hand list to rename it. Enter saves, Escape or Cancel discards the edit; names must contain 1–128 characters. Renaming preserves the layer ID and folder and supports Undo.
|
||||
|
||||
|
|
@ -626,7 +626,7 @@ Snapping also applies to side and corner resizing, including with aspect ratio l
|
|||
|
||||
Midra layer lists omit unassigned source slots (`NONE` or empty). Assigned inputs remain listed even if the layer is off. The exporter defaults to Preview and hides Program until **Preferences → Midra integration → Allow sending to Program** is checked. This preference is saved automatically; turning it off returns the exporter and quick Apply action to Preview.
|
||||
|
||||
Destination choices in **Configure Midra export…** now save immediately on the editor layer and support Undo. Save the project JSON to keep links across sessions. Links include screen and layer IDs and survive refreshes and selection changes. Choose the empty destination on the linked screen to unlink. **Send all linked layers** is available beside Apply, in Export and in the send window; it includes unselected, hidden and locked linked layers, grouped by screen. The usual Apply action sends selected linked layers. Preview/Program and sizing still use the current export options.
|
||||
Destination choices in **Configure Midra export…** now save immediately on the editor layer and support Undo. Save the project JSON to keep links across sessions. Links include screen and layer IDs and survive refreshes and selection changes. Choose the empty destination on the linked screen to unlink. **Send all linked layers** is available beside Apply, in Export and in the send window; it includes unselected, hidden and locked linked layers, grouped by screen. Apply changes… opens configuration for the chosen layers. Preview/Program and sizing still use the current export options.
|
||||
|
||||
Every explicit send now includes WebRCS’s preset apply pulse (`xUpdate` false → true). This applies staged geometry when automatic updates are disabled, including a repeat send where WebRCS already shows the desired values.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue