mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
* Actions panel: set folders, dialog toggle column, Insert Stop (#219) - Engine actions_edit_cmds: actions.insert (any command at a position; Insert Stop… uses it with actions.stopMessage), actions.dialog (the per-step dialog flag), actions.assignSet. Flag sets follow inserted steps; nothing edits during playback. - Panel: loose actions first, then each set as a collapsible folder row with its count (ui.actions.collapsedSets); dropping an action among another set's rows moves it there; Save Set… on a folder's context menu; a dialog toggle column next to the check marks; Insert Stop… in the panel menu with a small message/Allow Continue dialog. - Shell playback pauses on a dialog-toggled filter or adjustment step: the command's dialog opens seeded with the recorded values; OK runs the dialog's values and resumes from the next step, Cancel stops. Agents play headlessly. The play result reports paused: {step, id, dialog}. - Docs: control protocol, scorecard AUTO-219-2 done, gaps G11. * Translate the Actions panel's set, dialog-toggle and Insert Stop strings * Resume a paused action only after the dialog's background job lands A filter confirmed from a dialog runs as a background job in the desktop app; the resumed steps met a locked document and failed. Wait for the job first (test covers background jobs).
This commit is contained in:
1 parent
40427f25dc
commit
9862dfbb09
29 files changed
+897
-30
No files matched your search
@@ -53,7 +53,7 @@ impl Action {
|
||||
}
|
||||
|
||||
/// Apply `f` to every per-step index set (`disabled`, `dialogs`) after steps moved.
|
||||
fn remap_steps(&mut self, f: impl Fn(usize) -> Option<usize>) {
|
||||
pub(crate) fn remap_steps(&mut self, f: impl Fn(usize) -> Option<usize>) {
|
||||
self.disabled = self.disabled.iter().filter_map(|&i| f(i)).collect();
|
||||
self.dialogs = self.dialogs.iter().filter_map(|&i| f(i)).collect();
|
||||
}
|
||||
@@ -275,7 +275,7 @@ pub fn pending_steps(s: &Session, action: usize) -> impl Iterator<Item = &(Strin
|
||||
s.journal.iter().skip(from).filter(|(id, _)| replayable(id))
|
||||
}
|
||||
|
||||
fn flush_recording(s: &mut Session) -> Result<()> {
|
||||
pub(crate) fn flush_recording(s: &mut Session) -> Result<()> {
|
||||
let Some((_, idx)) = s.actions.recording else { return Ok(()) };
|
||||
if idx >= s.actions.list.len() {
|
||||
return Err(bad("actions.stop", "the action being recorded no longer exists"));
|
||||
@@ -374,7 +374,7 @@ fn play(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
})
|
||||
}
|
||||
|
||||
fn not_playing(s: &Session, cmd: &str) -> Result<()> {
|
||||
pub(crate) fn not_playing(s: &Session, cmd: &str) -> Result<()> {
|
||||
if s.actions.playing > 0 { Err(bad(cmd, "cannot edit actions during playback")) } else { Ok(()) }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
//! Editing an action's steps and its set, as the Actions panel does beyond recording:
|
||||
//! `actions.insert` (Photoshop's Insert Stop… and Insert Menu Item…), `actions.dialog` (the
|
||||
//! panel's dialog toggle column) and `actions.assignSet` (which set folder an action sits in).
|
||||
//!
|
||||
//! All three refuse to run during playback, commit pending recorded steps first, and keep the
|
||||
//! per-step flag sets (`disabled`, `dialogs`) in step with the moved indices, like
|
||||
//! `actions.move` and `actions.delete`.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::actions_cmds::{flush_recording, not_playing, pending_steps, resolve};
|
||||
use crate::commands::CommandSpec;
|
||||
use crate::{EngineError, Result, Session};
|
||||
|
||||
fn bad(cmd: &str, msg: impl Into<String>) -> EngineError {
|
||||
EngineError::BadParams { cmd: cmd.into(), msg: msg.into() }
|
||||
}
|
||||
|
||||
fn always(_: &Session) -> std::result::Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn index(p: &Value, key: &str, cmd: &str) -> Result<Option<usize>> {
|
||||
match p.get(key) {
|
||||
None | Some(Value::Null) => Ok(None),
|
||||
Some(v) => v.as_u64().and_then(|n| usize::try_from(n).ok()).map(Some).ok_or_else(|| bad(cmd, format!("`{key}` must be a non-negative integer"))),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `id` can be a step: a registered command, a Play Action call, or one of the desktop
|
||||
/// shell's recorded save/view commands.
|
||||
fn is_step_command(id: &str) -> bool {
|
||||
crate::commands::find(id).is_some() || id == "actions.play" || crate::actions_cmds::shell_save_command(id) || crate::actions_cmds::shell_view_command(id)
|
||||
}
|
||||
|
||||
fn insert(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "actions.insert";
|
||||
not_playing(s, cmd)?;
|
||||
let idx = resolve(&s.actions.list, p, cmd)?;
|
||||
let id = match p.get("id") {
|
||||
Some(Value::String(id)) if !id.trim().is_empty() => id.trim().to_string(),
|
||||
_ => return Err(bad(cmd, "needs `id`, the command the step runs")),
|
||||
};
|
||||
if !is_step_command(&id) {
|
||||
return Err(bad(cmd, format!("unknown command `{id}`")));
|
||||
}
|
||||
let params = match p.get("params") {
|
||||
None | Some(Value::Null) => json!({}),
|
||||
Some(v @ Value::Object(_)) => v.clone(),
|
||||
Some(_) => return Err(bad(cmd, "`params` must be an object")),
|
||||
};
|
||||
if id == "actions.play" {
|
||||
// Refuse the one cycle visible here; deeper ones are caught at playback.
|
||||
let target = params.get("action");
|
||||
let is_self = target.and_then(Value::as_str) == Some(s.actions.list[idx].name.as_str()) || target.and_then(Value::as_u64) == Some(idx as u64);
|
||||
if is_self {
|
||||
return Err(bad(cmd, "an action cannot play itself"));
|
||||
}
|
||||
}
|
||||
let len = s.actions.list[idx].steps.len().saturating_add(pending_steps(s, idx).count());
|
||||
let at = index(p, "at", cmd)?.unwrap_or(len);
|
||||
if at > len {
|
||||
return Err(bad(cmd, format!("`at` {at} is past the last step ({len})")));
|
||||
}
|
||||
if s.actions.recording.is_some_and(|(_, i)| i == idx) {
|
||||
flush_recording(s)?;
|
||||
}
|
||||
let action = &mut s.actions.list[idx];
|
||||
action.steps.insert(at, (id.clone(), params));
|
||||
action.remap_steps(|i| Some(if i >= at { i + 1 } else { i }));
|
||||
let result = json!({"action": action.name, "step": at, "id": id, "steps": action.steps.len()});
|
||||
s.actions.touch();
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// The panel's dialog toggle column. With `step`, switch one step's dialog on or off; without
|
||||
/// it, every step (all on unless all already are, like clicking the action's own toggle).
|
||||
fn dialog(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "actions.dialog";
|
||||
not_playing(s, cmd)?;
|
||||
let idx = resolve(&s.actions.list, p, cmd)?;
|
||||
let enabled = match p.get("enabled") {
|
||||
None | Some(Value::Null) => None,
|
||||
Some(Value::Bool(b)) => Some(*b),
|
||||
Some(_) => return Err(bad(cmd, "`enabled` must be true or false")),
|
||||
};
|
||||
let step = index(p, "step", cmd)?;
|
||||
let len = s.actions.list[idx].steps.len().saturating_add(pending_steps(s, idx).count());
|
||||
if step.is_some_and(|step| step >= len) {
|
||||
return Err(bad(cmd, "step is out of range"));
|
||||
}
|
||||
if s.actions.recording.is_some_and(|(_, i)| i == idx) {
|
||||
flush_recording(s)?;
|
||||
}
|
||||
let action = &mut s.actions.list[idx];
|
||||
match step {
|
||||
Some(step) => {
|
||||
if enabled.unwrap_or(!action.dialogs.contains(&step)) {
|
||||
action.dialogs.insert(step);
|
||||
} else {
|
||||
action.dialogs.remove(&step);
|
||||
}
|
||||
}
|
||||
None if enabled.unwrap_or(action.dialogs.len() < action.steps.len()) => action.dialogs = (0..action.steps.len()).collect(),
|
||||
None => action.dialogs.clear(),
|
||||
}
|
||||
let result = json!({"action": action.name, "dialogs": action.dialogs});
|
||||
s.actions.touch();
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn assign_set(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "actions.assignSet";
|
||||
not_playing(s, cmd)?;
|
||||
let idx = resolve(&s.actions.list, p, cmd)?;
|
||||
let set = match p.get("set") {
|
||||
None | Some(Value::Null) => None,
|
||||
Some(Value::String(n)) if !n.trim().is_empty() => Some(n.trim().to_string()),
|
||||
Some(Value::String(_)) => return Err(bad(cmd, "`set` is empty; pass null to take the action out of its set")),
|
||||
Some(_) => return Err(bad(cmd, "`set` must be a name or null")),
|
||||
};
|
||||
let action = &mut s.actions.list[idx];
|
||||
action.set = set;
|
||||
let result = json!({"action": action.name, "set": action.set});
|
||||
s.actions.touch();
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
vec![
|
||||
CommandSpec {
|
||||
id: "actions.insert",
|
||||
label: "Insert Step",
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: r##"{"action":name|index, "id":command id, "params":{}?, "at":index?=end} → {action, step, id, steps}. Inserts a step at the 0-based position (Photoshop's Insert Stop… with id actions.stopMessage, Insert Menu Item… with any command). Pending recorded steps count; flags of the steps after it follow them."##,
|
||||
enabled: always,
|
||||
run: insert,
|
||||
journal: false,
|
||||
},
|
||||
CommandSpec {
|
||||
id: "actions.dialog",
|
||||
label: "Toggle Step Dialog",
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: r##"{"action":name|index, "step":index?, "enabled":bool?} → {action, dialogs:[step…]}. The Actions panel's dialog toggle: the desktop shell shows the step's dialog, seeded with its recorded params, and resumes playback when it is confirmed; headless playback runs the recorded params. Omitted enabled flips it; without step, every step: on unless all already are, or as enabled says."##,
|
||||
enabled: always,
|
||||
run: dialog,
|
||||
journal: false,
|
||||
},
|
||||
CommandSpec {
|
||||
id: "actions.assignSet",
|
||||
label: "Move to Set",
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: r##"{"action":name|index, "set":name|null} → {action, set}. The set folder the Actions panel shows the action under (what Load Actions fills and Save Actions writes); null takes it out of any set."##,
|
||||
enabled: always,
|
||||
run: assign_set,
|
||||
journal: false,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::actions_cmds::Action;
|
||||
|
||||
fn session_with(steps: &[&str]) -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
|
||||
s.actions.list.push(Action::new("A", steps.iter().map(|id| (id.to_string(), json!({}))).collect()));
|
||||
s
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insert_places_the_step_and_shifts_the_flags() {
|
||||
let mut s = session_with(&["select.all", "select.inverse", "select.deselect"]);
|
||||
s.execute("actions.toggle", json!({"action": "A", "step": 1})).unwrap();
|
||||
s.execute("actions.dialog", json!({"action": "A", "step": 2})).unwrap();
|
||||
let r = s
|
||||
.execute("actions.insert", json!({"action": "A", "at": 1, "id": "actions.stopMessage", "params": {"message": "Check", "allowContinue": true}}))
|
||||
.unwrap();
|
||||
assert_eq!((r["step"].as_u64(), r["steps"].as_u64()), (Some(1), Some(4)));
|
||||
let a = &s.actions.list[0];
|
||||
assert_eq!(a.steps[1], ("actions.stopMessage".to_string(), json!({"message": "Check", "allowContinue": true})));
|
||||
assert_eq!(a.disabled.iter().copied().collect::<Vec<_>>(), [2], "the switched-off step moved down one");
|
||||
assert_eq!(a.dialogs.iter().copied().collect::<Vec<_>>(), [3]);
|
||||
// Default position: the end. A bare id works for a parameterless command.
|
||||
let r = s.execute("actions.insert", json!({"action": 0, "id": "layer.new.layer"})).unwrap();
|
||||
assert_eq!(r["step"], 4);
|
||||
assert_eq!(s.actions.list[0].steps[4].0, "layer.new.layer");
|
||||
// Playback runs the inserted stop and continues past it.
|
||||
let played = s.execute("actions.play", json!({"action": "A"})).unwrap();
|
||||
assert_eq!(played["ran"], 4, "{played}");
|
||||
assert!(played.get("failed").is_none(), "{played}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insert_while_recording_keeps_pending_steps_in_order() {
|
||||
let mut s = session_with(&[]);
|
||||
s.execute("actions.record", json!({"action": "A"})).unwrap();
|
||||
s.execute("layer.new.layer", json!({"name": "One"})).unwrap();
|
||||
s.execute("actions.insert", json!({"action": "A", "at": 0, "id": "select.all"})).unwrap();
|
||||
s.execute("layer.new.layer", json!({"name": "Two"})).unwrap();
|
||||
s.execute("actions.stop", json!({})).unwrap();
|
||||
let ids: Vec<&str> = s.actions.list[0].steps.iter().map(|(id, _)| id.as_str()).collect();
|
||||
assert_eq!(ids, ["select.all", "layer.new.layer", "layer.new.layer"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dialog_toggles_one_step_or_all() {
|
||||
let mut s = session_with(&["select.all", "select.inverse"]);
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A", "step": 0})).unwrap()["dialogs"], json!([0]));
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A", "step": 0})).unwrap()["dialogs"], json!([]));
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A", "step": 1, "enabled": true})).unwrap()["dialogs"], json!([1]));
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A"})).unwrap()["dialogs"], json!([0, 1]), "not all on: all on");
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A"})).unwrap()["dialogs"], json!([]), "all on: all off");
|
||||
assert_eq!(s.execute("actions.dialog", json!({"action": "A", "enabled": true})).unwrap()["dialogs"], json!([0, 1]));
|
||||
assert_eq!(s.execute("actions.get", json!({"action": "A"})).unwrap()["dialogs"], json!([0, 1]));
|
||||
// Deleting a step keeps the flags of the others in place.
|
||||
s.execute("actions.delete", json!({"action": "A", "step": 0})).unwrap();
|
||||
assert_eq!(s.actions.list[0].dialogs.iter().copied().collect::<Vec<_>>(), [0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assign_set_moves_an_action_between_folders() {
|
||||
let mut s = session_with(&["select.all"]);
|
||||
assert_eq!(s.execute("actions.assignSet", json!({"action": "A", "set": " Retouch "})).unwrap()["set"], "Retouch");
|
||||
assert_eq!(s.actions.list[0].set.as_deref(), Some("Retouch"));
|
||||
assert_eq!(s.execute("actions.list", json!({})).unwrap()["actions"][0]["set"], "Retouch");
|
||||
assert_eq!(s.execute("actions.assignSet", json!({"action": 0, "set": null})).unwrap()["set"], Value::Null);
|
||||
assert_eq!(s.actions.list[0].set, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bad_params_fail_gracefully() {
|
||||
let mut s = session_with(&["select.all"]);
|
||||
let before = s.actions.list.clone();
|
||||
for p in [
|
||||
json!({}),
|
||||
json!({"action": "A"}),
|
||||
json!({"action": "A", "id": ""}),
|
||||
json!({"action": "A", "id": 5}),
|
||||
json!({"action": "A", "id": "not.a.command"}),
|
||||
json!({"action": "A", "id": "select.all", "at": 2}),
|
||||
json!({"action": "A", "id": "select.all", "at": -1}),
|
||||
json!({"action": "A", "id": "select.all", "params": "x"}),
|
||||
json!({"action": "A", "id": "actions.play", "params": {"action": "A"}}),
|
||||
json!({"action": 9, "id": "select.all"}),
|
||||
] {
|
||||
assert!(s.execute("actions.insert", p.clone()).is_err(), "{p}");
|
||||
}
|
||||
for p in
|
||||
[json!({}), json!({"action": "A", "step": 1}), json!({"action": "A", "step": "x"}), json!({"action": "A", "enabled": "yes"}), json!({"action": 3})]
|
||||
{
|
||||
assert!(s.execute("actions.dialog", p.clone()).is_err(), "{p}");
|
||||
}
|
||||
for p in [json!({}), json!({"action": "A", "set": ""}), json!({"action": "A", "set": 7}), json!({"action": "B", "set": "S"})] {
|
||||
assert!(s.execute("actions.assignSet", p.clone()).is_err(), "{p}");
|
||||
}
|
||||
assert_eq!(s.actions.list, before, "rejected edits change nothing");
|
||||
// Nothing edits during playback.
|
||||
s.actions.list.push(Action::new("Loop", vec![("actions.insert".into(), json!({"action": "A", "id": "select.all"}))]));
|
||||
let played = s.execute("actions.play", json!({"action": "Loop"})).unwrap();
|
||||
assert!(played["failed"]["error"].as_str().unwrap().contains("playback"), "{played}");
|
||||
}
|
||||
}
|
||||
@@ -1225,6 +1225,7 @@ fn build() -> Vec<CommandSpec> {
|
||||
v.extend(crate::eraser_cmds::specs());
|
||||
v.extend(crate::preset_import_cmds::specs());
|
||||
v.extend(crate::atn_cmds::specs());
|
||||
v.extend(crate::actions_edit_cmds::specs());
|
||||
v.extend(crate::swatch_cmds::specs());
|
||||
v.extend(crate::retouch_cmds::specs());
|
||||
v.extend(crate::redeye_cmds::specs());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
pub mod actions_cmds;
|
||||
pub mod actions_edit_cmds;
|
||||
pub mod adjust_cmds;
|
||||
pub mod adjust_params;
|
||||
pub mod align_cmds;
|
||||
|
||||
+388
-18
@@ -21,6 +21,8 @@ pub struct ActionsUi {
|
||||
pub selected: Option<usize>,
|
||||
pub selected_step: Option<usize>,
|
||||
pub expanded: Vec<bool>,
|
||||
/// Set folders shown collapsed (Photoshop's set disclosure triangles).
|
||||
pub collapsed_sets: Vec<String>,
|
||||
#[serde(skip)]
|
||||
reveal_recording: Option<(usize, usize)>,
|
||||
/// The action whose name is being edited in place (double-click on its name).
|
||||
@@ -92,7 +94,22 @@ pub(crate) fn play(app: &mut PhotocraftApp, params: &Value) -> Result<Value, Str
|
||||
let recording = actions_cmds::begin_playback(&mut app.session, &action).map_err(|e| e.to_string())?;
|
||||
let mut ran = 0u64;
|
||||
let mut failed = None;
|
||||
let mut paused = None;
|
||||
for (i, (id, p)) in action.enabled_steps().skip_while(|(i, _)| *i < from) {
|
||||
// The dialog toggle: show the step's dialog with its recorded values and continue
|
||||
// from the next step when it is confirmed (`resume`). Agents play headlessly.
|
||||
if action.dialogs.contains(&i) && !app.automation_input && (crate::filter_dialog::has_dialog(id) || crate::adjust_dialog::has_dialog(id)) {
|
||||
let label = label_of(id);
|
||||
let dialog = crate::dialogs::open_command_dialog(app, id, &label);
|
||||
if let Some(d) = app.ui.dialog_mut(dialog) {
|
||||
if let Some(o) = p.as_object() {
|
||||
d.fields.extend(o.iter().map(|(k, v)| (k.clone(), v.clone())));
|
||||
}
|
||||
d.fields.insert(RESUME.into(), json!({"action": action.name, "from": i + 1}));
|
||||
}
|
||||
paused = Some(json!({"step": i, "id": id, "dialog": dialog}));
|
||||
break;
|
||||
}
|
||||
let result = (|| {
|
||||
if let Some(auth) = app.session.authorize {
|
||||
auth(id, p).map_err(|e| e.to_string())?;
|
||||
@@ -119,6 +136,11 @@ pub(crate) fn play(app: &mut PhotocraftApp, params: &Value) -> Result<Value, Str
|
||||
failed = Some(json!({"step": i, "id": id, "error": error}));
|
||||
break;
|
||||
}
|
||||
if let Some(inner) = value.get("paused").filter(|p| p.is_object()) {
|
||||
// A called action paused for a dialog; it resumes alone when confirmed.
|
||||
paused = Some(inner.clone());
|
||||
break;
|
||||
}
|
||||
ran += 1;
|
||||
}
|
||||
Err(error) => {
|
||||
@@ -128,9 +150,10 @@ pub(crate) fn play(app: &mut PhotocraftApp, params: &Value) -> Result<Value, Str
|
||||
}
|
||||
}
|
||||
actions_cmds::finish_playback(&mut app.session, recording, &action, from);
|
||||
Ok(match failed {
|
||||
Some(f) => json!({"action": action.name, "ran": ran, "failed": f}),
|
||||
None => json!({"action": action.name, "ran": ran}),
|
||||
Ok(match (failed, paused) {
|
||||
(Some(f), _) => json!({"action": action.name, "ran": ran, "failed": f}),
|
||||
(None, Some(p)) => json!({"action": action.name, "ran": ran, "paused": p}),
|
||||
(None, None) => json!({"action": action.name, "ran": ran}),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -177,6 +200,13 @@ fn begin_recording(app: &mut PhotocraftApp, append: bool) {
|
||||
}
|
||||
|
||||
pub(crate) fn report_play(app: &mut PhotocraftApp, v: &Value) {
|
||||
if let Some(paused) = v.get("paused").filter(|p| p.is_object()) {
|
||||
let step = paused.get("step").and_then(Value::as_u64).unwrap_or(0);
|
||||
let template = "Step {step} is waiting for its dialog";
|
||||
app.ui.status = crate::i18n::fmt(tl!(template), &[("step", &(step + 1).to_string())]);
|
||||
app.ui.status_error = false;
|
||||
return;
|
||||
}
|
||||
let Some(failed) = v.get("failed").filter(|f| f.is_object()) else {
|
||||
let ran = v.get("ran").and_then(Value::as_u64).unwrap_or(0);
|
||||
app.ui.status = crate::i18n::trn(crate::i18n::current(), ran, "Played {n} step", "Played {n} steps");
|
||||
@@ -283,8 +313,8 @@ fn load_dialog(app: &mut PhotocraftApp) -> Result<Value, String> {
|
||||
|
||||
/// Save Actions…: the selected action's set (every action of it), or every action when none
|
||||
/// came from a set, as a `.atn` file Photoshop loads.
|
||||
fn save_dialog(app: &mut PhotocraftApp) -> Result<Value, String> {
|
||||
let set = selected_action(app).and_then(|a| a.set.clone());
|
||||
fn save_dialog(app: &mut PhotocraftApp, set: Option<String>) -> Result<Value, String> {
|
||||
let set = set.or_else(|| selected_action(app).and_then(|a| a.set.clone()));
|
||||
let params = match &set {
|
||||
Some(set) => json!({"set": set, "skipUnsupported": true}),
|
||||
None => json!({"skipUnsupported": true}),
|
||||
@@ -317,6 +347,85 @@ fn save_dialog(app: &mut PhotocraftApp) -> Result<Value, String> {
|
||||
})
|
||||
}
|
||||
|
||||
const INSERT_STOP: &str = "__insertStop";
|
||||
|
||||
pub fn owns_insert_stop(fields: &serde_json::Map<String, Value>) -> bool {
|
||||
fields.contains_key(INSERT_STOP)
|
||||
}
|
||||
|
||||
/// Insert Stop…: a message step after the selected step (or at the end of the selected action).
|
||||
fn insert_stop_dialog(app: &mut PhotocraftApp) -> Result<Value, String> {
|
||||
let action = app.ui.actions.selected.filter(|i| *i < app.session.actions.list.len()).ok_or_else(|| tl!("Select an action first").to_string())?;
|
||||
let len = app.session.actions.list[action].steps.len() + actions_cmds::pending_steps(&app.session, action).count();
|
||||
let at = app.ui.actions.selected_step.map_or(len, |s| (s + 1).min(len));
|
||||
let fields =
|
||||
json!({INSERT_STOP: true, "__command": "actions.insert", "__label": "Insert Stop", "action": action, "at": at, "message": "", "allowContinue": false});
|
||||
let id = app.ui.open_dialog(crate::state::DialogKind::Command, fields.as_object().cloned().unwrap_or_default());
|
||||
Ok(json!({"dialog": id}))
|
||||
}
|
||||
|
||||
pub fn insert_stop_body(ui: &mut egui::Ui, fields: &mut serde_json::Map<String, Value>) {
|
||||
ui.label(tl!("Message:"));
|
||||
let mut message = fields.get("message").and_then(Value::as_str).unwrap_or_default().to_string();
|
||||
ui.add(egui::TextEdit::multiline(&mut message).desired_rows(4).desired_width(320.0));
|
||||
fields.insert("message".into(), json!(message));
|
||||
ui.add_space(6.0);
|
||||
let mut allow = fields.get("allowContinue").and_then(Value::as_bool).unwrap_or(false);
|
||||
ui.checkbox(&mut allow, tl!("Allow Continue"));
|
||||
fields.insert("allowContinue".into(), json!(allow));
|
||||
}
|
||||
|
||||
pub fn insert_stop_confirm(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>) -> Result<Value, String> {
|
||||
let action = fields.get("action").and_then(Value::as_u64).ok_or("the dialog names no action")?;
|
||||
let params = json!({
|
||||
"action": action,
|
||||
"at": fields.get("at").cloned().unwrap_or(Value::Null),
|
||||
"id": photocraft_engine::atn_cmds::STOP_MESSAGE,
|
||||
"params": {"message": fields.get("message").cloned().unwrap_or(json!("")), "allowContinue": fields.get("allowContinue").cloned().unwrap_or(json!(false))},
|
||||
});
|
||||
let r = app.run("actions.insert", params)?;
|
||||
if let (Some(a), Some(step)) = (usize::try_from(action).ok(), r["step"].as_u64().and_then(|s| usize::try_from(s).ok())) {
|
||||
app.ui.actions.selected = Some(a);
|
||||
app.ui.actions.selected_step = Some(step);
|
||||
app.ui.actions.expanded.resize(app.session.actions.list.len(), false);
|
||||
if let Some(e) = app.ui.actions.expanded.get_mut(a) {
|
||||
*e = true;
|
||||
}
|
||||
}
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
/// The key a paused playback leaves in its dialog's fields: `{action, from}`.
|
||||
pub const RESUME: &str = "__resumeAction";
|
||||
|
||||
/// A step dialog confirmed: continue the action after it (`dialogs::confirm` calls this).
|
||||
pub fn resume(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>) {
|
||||
let Some(r) = fields.get(RESUME) else { return };
|
||||
// The dialog's command may run as a background job; the next step needs its result.
|
||||
if let Some(doc) = app.session.active().map(|d| d.doc.id)
|
||||
&& let Some(job) = app.session.job_on(doc)
|
||||
{
|
||||
let _ = app.session.wait_job(job.id);
|
||||
}
|
||||
let params = json!({"action": r.get("action").cloned().unwrap_or(Value::Null), "from": r.get("from").cloned().unwrap_or(Value::Null)});
|
||||
match play(app, ¶ms) {
|
||||
Ok(v) => report_play(app, &v),
|
||||
Err(e) => {
|
||||
let template = "Action playback failed: {error}";
|
||||
app.ui.status = crate::i18n::fmt(tl!(template), &[("error", &e)]);
|
||||
app.ui.status_error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A step dialog cancelled: the action stops there, as in Photoshop.
|
||||
pub fn stopped(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>) {
|
||||
if fields.contains_key(RESUME) {
|
||||
app.ui.status = tl!("Action playback stopped").to_string();
|
||||
app.ui.status_error = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// The Actions entries of the panel group's menu ("…").
|
||||
pub fn panel_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let mut act: Option<&str> = None;
|
||||
@@ -327,9 +436,18 @@ pub fn panel_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
if ui.add_enabled(any, egui::Button::new(tl!("Save Actions…"))).clicked() {
|
||||
act = Some("save");
|
||||
}
|
||||
ui.separator();
|
||||
let selected = app.ui.actions.selected.is_some_and(|i| i < app.session.actions.list.len());
|
||||
if ui.add_enabled(selected, egui::Button::new(tl!("Insert Stop…"))).clicked() {
|
||||
act = Some("stop");
|
||||
}
|
||||
let Some(a) = act else { return };
|
||||
ui.close();
|
||||
let r = if a == "load" { load_dialog(app) } else { save_dialog(app) };
|
||||
let r = match a {
|
||||
"load" => load_dialog(app),
|
||||
"stop" => insert_stop_dialog(app),
|
||||
_ => save_dialog(app, None),
|
||||
};
|
||||
if let Err(e) = r
|
||||
&& e != "cancelled"
|
||||
{
|
||||
@@ -380,6 +498,12 @@ fn move_row(app: &mut PhotocraftApp, source: DragRow, to: usize) {
|
||||
}
|
||||
app.ui.actions.selected = Some(to);
|
||||
app.ui.actions.selected_step = None;
|
||||
// Dropped among another set's actions: the action joins that set (the row above wins).
|
||||
let list = &app.session.actions.list;
|
||||
let neighbour = to.checked_sub(1).and_then(|j| list.get(j)).or_else(|| list.get(to + 1)).and_then(|a| a.set.clone());
|
||||
if list.get(to).is_some_and(|a| a.set != neighbour) {
|
||||
let _ = app.run("actions.assignSet", json!({"action": to, "set": neighbour}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,15 +563,49 @@ fn rename_action(app: &mut PhotocraftApp, index: usize, name: String) {
|
||||
}
|
||||
}
|
||||
|
||||
/// One action's row data for a frame.
|
||||
struct Row {
|
||||
name: String,
|
||||
steps: Vec<(String, Value)>,
|
||||
disabled: std::collections::BTreeSet<usize>,
|
||||
dialogs: std::collections::BTreeSet<usize>,
|
||||
set: Option<String>,
|
||||
}
|
||||
|
||||
/// The panel's order: actions outside any set first, then each set folder (in order of first
|
||||
/// appearance) with its actions. Indices are into the engine's flat list.
|
||||
fn display_order(rows: &[Row]) -> Vec<usize> {
|
||||
let mut order: Vec<usize> = rows.iter().enumerate().filter(|(_, r)| r.set.is_none()).map(|(i, _)| i).collect();
|
||||
let mut sets: Vec<&str> = Vec::new();
|
||||
for r in rows {
|
||||
if let Some(set) = r.set.as_deref()
|
||||
&& !sets.contains(&set)
|
||||
{
|
||||
sets.push(set);
|
||||
}
|
||||
}
|
||||
for set in sets {
|
||||
order.extend(rows.iter().enumerate().filter(|(_, r)| r.set.as_deref() == Some(set)).map(|(i, _)| i));
|
||||
}
|
||||
order
|
||||
}
|
||||
|
||||
pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let recording = app.session.actions.recording;
|
||||
let rows: Vec<_> = app.session.actions.list.iter().enumerate().map(|(i, a)| (a.name.clone(), visible_steps(app, i), a.disabled.clone())).collect();
|
||||
let rows: Vec<Row> = app
|
||||
.session
|
||||
.actions
|
||||
.list
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, a)| Row { name: a.name.clone(), steps: visible_steps(app, i), disabled: a.disabled.clone(), dialogs: a.dialogs.clone(), set: a.set.clone() })
|
||||
.collect();
|
||||
if app
|
||||
.ui
|
||||
.actions
|
||||
.selected
|
||||
.is_some_and(|i| i >= rows.len() || app.ui.actions.selected_step.is_some_and(|step| rows.get(i).is_none_or(|row| step >= row.1.len())))
|
||||
.is_some_and(|i| i >= rows.len() || app.ui.actions.selected_step.is_some_and(|step| rows.get(i).is_none_or(|row| step >= row.steps.len())))
|
||||
{
|
||||
app.ui.actions.selected = None;
|
||||
app.ui.actions.selected_step = None;
|
||||
@@ -460,10 +618,13 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
let mut renamed = None;
|
||||
let mut toggled = None;
|
||||
let mut dialog_toggled = None;
|
||||
let mut set_toggled: Option<String> = None;
|
||||
let mut save_set: Option<String> = None;
|
||||
let max_h = (ui.available_height() - 38.0).max(0.0);
|
||||
let mut play_idx = None;
|
||||
let mut moved = None;
|
||||
let recording_row = recording.and_then(|(_, i)| rows.get(i).map(|(_, steps, _)| (i, steps.len())));
|
||||
let recording_row = recording.and_then(|(_, i)| rows.get(i).map(|r| (i, r.steps.len())));
|
||||
let reveal = recording_row.filter(|row| app.ui.actions.reveal_recording != Some(*row));
|
||||
app.ui.actions.reveal_recording = recording_row;
|
||||
if let Some((i, _)) = reveal {
|
||||
@@ -492,8 +653,54 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i, (name, steps, disabled)) in rows.iter().enumerate() {
|
||||
let mut shown_set: Option<&str> = None;
|
||||
for i in display_order(&rows) {
|
||||
let Row { name, steps, disabled, dialogs, set } = &rows[i];
|
||||
// A set folder row before the first of its actions; collapsed folders hide them.
|
||||
if let Some(set) = set.as_deref()
|
||||
&& shown_set != Some(set)
|
||||
{
|
||||
shown_set = Some(set);
|
||||
let collapsed = app.ui.actions.collapsed_sets.iter().any(|c| c == set);
|
||||
let (hr, hresp) = ui.allocate_exact_size(vec2(ui.available_width(), 24.0), Sense::click());
|
||||
hresp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, true, !collapsed, set));
|
||||
if hresp.hovered() {
|
||||
ui.painter().rect_filled(hr, 0.0, t.hover.gamma_multiply(0.5));
|
||||
}
|
||||
let tri = Rect::from_center_size(pos2(hr.left() + 12.0, hr.center().y), vec2(8.0, 8.0));
|
||||
let pts = if collapsed {
|
||||
vec![tri.left_top(), tri.right_center(), tri.left_bottom()]
|
||||
} else {
|
||||
vec![tri.left_top(), tri.right_top(), tri.center_bottom()]
|
||||
};
|
||||
ui.painter().add(egui::Shape::convex_polygon(pts, t.text_dim, Stroke::NONE));
|
||||
crate::icons::paint(
|
||||
ui,
|
||||
Rect::from_center_size(pos2(hr.left() + 30.0, hr.center().y), vec2(16.0, 16.0)),
|
||||
if collapsed { "folder" } else { "folder-open" },
|
||||
12.0,
|
||||
t.icon,
|
||||
);
|
||||
ui.painter().text(pos2(hr.left() + 44.0, hr.center().y), Align2::LEFT_CENTER, set, egui::FontId::proportional(12.0), t.text);
|
||||
let count = rows.iter().filter(|r| r.set.as_deref() == Some(set)).count() as u64;
|
||||
let summary = crate::i18n::trn(crate::i18n::current(), count, "{n} action", "{n} actions");
|
||||
ui.painter().text(pos2(hr.right() - 8.0, hr.center().y), Align2::RIGHT_CENTER, summary, egui::FontId::proportional(11.0), t.text_faint);
|
||||
if hresp.clicked() {
|
||||
set_toggled = Some(set.to_string());
|
||||
}
|
||||
hresp.context_menu(|ui| {
|
||||
if ui.button(tl!("Save Set…")).clicked() {
|
||||
save_set = Some(set.to_string());
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
if set.as_deref().is_some_and(|set| app.ui.actions.collapsed_sets.iter().any(|c| c == set)) {
|
||||
continue;
|
||||
}
|
||||
let indent = if set.is_some() { 14.0 } else { 0.0 };
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 26.0), Sense::click_and_drag());
|
||||
let x0 = rect.left() + indent;
|
||||
if reveal == Some((i, 0)) {
|
||||
ui.scroll_to_rect(rect, Some(egui::Align::BOTTOM));
|
||||
}
|
||||
@@ -508,22 +715,21 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
moved = Some(change);
|
||||
}
|
||||
let expanded = app.ui.actions.expanded.get(i).copied().unwrap_or(false);
|
||||
let tri = Rect::from_center_size(pos2(rect.left() + 12.0, rect.center().y), vec2(8.0, 8.0));
|
||||
let tri = Rect::from_center_size(pos2(x0 + 12.0, rect.center().y), vec2(8.0, 8.0));
|
||||
let pts =
|
||||
if expanded { vec![tri.left_top(), tri.right_top(), tri.center_bottom()] } else { vec![tri.left_top(), tri.right_center(), tri.left_bottom()] };
|
||||
ui.painter().add(egui::Shape::convex_polygon(pts, t.text_dim, Stroke::NONE));
|
||||
crate::icons::paint(ui, Rect::from_center_size(pos2(rect.left() + 30.0, rect.center().y), vec2(16.0, 16.0)), "play", 11.0, t.icon);
|
||||
crate::icons::paint(ui, Rect::from_center_size(pos2(x0 + 30.0, rect.center().y), vec2(16.0, 16.0)), "play", 11.0, t.icon);
|
||||
let recording_this = recording.is_some_and(|(_, r)| r == i);
|
||||
let nsteps = steps.len();
|
||||
let name_rect = if app.ui.actions.renaming.as_ref().is_some_and(|r| r.index == i) {
|
||||
let field =
|
||||
Rect::from_min_max(pos2(rect.left() + 40.0, rect.top() + 3.0), pos2((rect.right() - 80.0).max(rect.left() + 120.0), rect.bottom() - 3.0));
|
||||
let field = Rect::from_min_max(pos2(x0 + 40.0, rect.top() + 3.0), pos2((rect.right() - 80.0).max(x0 + 120.0), rect.bottom() - 3.0));
|
||||
if let Some(text) = rename_field(app, ui, i, field) {
|
||||
renamed = Some((i, text));
|
||||
}
|
||||
field
|
||||
} else {
|
||||
ui.painter().text(pos2(rect.left() + 44.0, rect.center().y), Align2::LEFT_CENTER, name, egui::FontId::proportional(12.0), t.text)
|
||||
ui.painter().text(pos2(x0 + 44.0, rect.center().y), Align2::LEFT_CENTER, name, egui::FontId::proportional(12.0), t.text)
|
||||
};
|
||||
ui.painter().text(
|
||||
pos2(rect.right() - 8.0, rect.center().y),
|
||||
@@ -543,7 +749,7 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
if resp.clicked() {
|
||||
app.ui.actions.selected = Some(i);
|
||||
app.ui.actions.selected_step = None;
|
||||
if resp.interact_pointer_pos().is_some_and(|p| p.x < rect.left() + 20.0) {
|
||||
if resp.interact_pointer_pos().is_some_and(|p| p.x < x0 + 20.0) {
|
||||
if app.ui.actions.expanded.len() <= i {
|
||||
app.ui.actions.expanded.resize(i + 1, false);
|
||||
}
|
||||
@@ -588,17 +794,33 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
let on = !disabled.contains(&step);
|
||||
let color = if on { t.text_dim } else { t.text_faint };
|
||||
ui.painter().text(pos2(r.left() + 44.0, r.center().y), Align2::LEFT_CENTER, &label, egui::FontId::proportional(11.5), color);
|
||||
ui.painter().text(pos2(x0 + 62.0, r.center().y), Align2::LEFT_CENTER, &label, egui::FontId::proportional(11.5), color);
|
||||
// Photoshop's check column: unchecked steps are skipped by playback, Batch and droplets.
|
||||
let check = ui.interact(
|
||||
Rect::from_center_size(pos2(r.left() + 30.0, r.center().y), vec2(16.0, 16.0)),
|
||||
Rect::from_center_size(pos2(x0 + 30.0, r.center().y), vec2(16.0, 16.0)),
|
||||
ui.id().with(("action-step-check", i, step)),
|
||||
Sense::click(),
|
||||
);
|
||||
check.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, true, on, format!("{}: {label}", tl!("Include in playback"))));
|
||||
paint_check(ui, check.rect, on, &t);
|
||||
// Photoshop's dialog column: playback shows the step's dialog, seeded with its
|
||||
// recorded values, and continues when it is confirmed.
|
||||
let with_dialog = dialogs.contains(&step);
|
||||
let dialog = ui.interact(
|
||||
Rect::from_center_size(pos2(x0 + 46.0, r.center().y), vec2(16.0, 16.0)),
|
||||
ui.id().with(("action-step-dialog", i, step)),
|
||||
Sense::click(),
|
||||
);
|
||||
// A toggle button, not a check box, so the check column stays the only CheckBox role.
|
||||
dialog.widget_info(|| {
|
||||
egui::WidgetInfo::selected(egui::WidgetType::Button, true, with_dialog, format!("{}: {label}", tl!("Show dialog during playback")))
|
||||
});
|
||||
crate::icons::paint(ui, dialog.rect, "message-square", 11.0, if with_dialog { t.icon } else { t.text_faint.gamma_multiply(0.45) });
|
||||
let dialog = dialog.on_hover_text(tl!("Show dialog during playback"));
|
||||
if check.on_hover_text(tl!("Include in playback")).clicked() {
|
||||
toggled = Some((i, step));
|
||||
} else if dialog.clicked() {
|
||||
dialog_toggled = Some((i, step));
|
||||
} else if response.clicked() {
|
||||
app.ui.actions.selected = Some(i);
|
||||
app.ui.actions.selected_step = Some(step);
|
||||
@@ -610,6 +832,24 @@ pub fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
if let Some((action, step)) = toggled {
|
||||
let _ = app.run("actions.toggle", json!({"action": action, "step": step}));
|
||||
}
|
||||
if let Some((action, step)) = dialog_toggled {
|
||||
let _ = app.run("actions.dialog", json!({"action": action, "step": step}));
|
||||
}
|
||||
if let Some(set) = set_toggled {
|
||||
match app.ui.actions.collapsed_sets.iter().position(|c| *c == set) {
|
||||
Some(i) => {
|
||||
app.ui.actions.collapsed_sets.remove(i);
|
||||
}
|
||||
None => app.ui.actions.collapsed_sets.push(set),
|
||||
}
|
||||
}
|
||||
if let Some(set) = save_set
|
||||
&& let Err(e) = save_dialog(app, Some(set))
|
||||
&& e != "cancelled"
|
||||
{
|
||||
app.ui.status = e;
|
||||
app.ui.status_error = true;
|
||||
}
|
||||
if let Some((index, name)) = renamed {
|
||||
rename_action(app, index, name);
|
||||
}
|
||||
@@ -1042,4 +1282,134 @@ mod tests {
|
||||
assert_eq!(*written.borrow(), ["out/result.psd", "out/result.psd"]);
|
||||
assert_eq!(app.session.active().unwrap().path.as_deref(), Some("out/result.psd"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_folders_group_actions_and_collapse() {
|
||||
use egui_kittest::{Harness, kittest::Queryable};
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
let mut sharpen = Action::new("Sharpen", vec![("filter.sharpen.sharpen".into(), json!({}))]);
|
||||
sharpen.set = Some("Retouch".into());
|
||||
let mut soften = Action::new("Soften", vec![("filter.blur.blur".into(), json!({}))]);
|
||||
soften.set = Some("Retouch".into());
|
||||
app.session.actions.list.push(Action::new("Loose", vec![]));
|
||||
app.session.actions.list.push(sharpen);
|
||||
app.session.actions.list.push(Action::new("Also loose", vec![]));
|
||||
app.session.actions.list.push(soften);
|
||||
let mut h = Harness::builder().with_size(vec2(360.0, 400.0)).build_ui_state(|ui, app| panel(app, ui), app);
|
||||
h.run_steps(3);
|
||||
// The folder row shows the set with its count; its actions sit under it, loose ones first.
|
||||
let folder = h.get_by_label("Retouch").rect();
|
||||
assert!(h.get_by_label("Loose").rect().top() < folder.top());
|
||||
assert!(h.get_by_label("Also loose").rect().top() < folder.top());
|
||||
assert!(h.get_by_label("Sharpen").rect().top() > folder.top());
|
||||
assert!(h.get_by_label("Soften").rect().top() > h.get_by_label("Sharpen").rect().top());
|
||||
assert_eq!(display_order(&[]), Vec::<usize>::new());
|
||||
// Clicking the folder collapses it; its actions disappear and the state is remembered.
|
||||
h.get_by_label("Retouch").click();
|
||||
h.run_steps(3);
|
||||
assert_eq!(h.state().ui.actions.collapsed_sets, ["Retouch"]);
|
||||
assert!(h.query_by_label("Sharpen").is_none());
|
||||
assert!(h.query_by_label("Loose").is_some());
|
||||
h.get_by_label("Retouch").click();
|
||||
h.run_steps(3);
|
||||
assert!(h.state().ui.actions.collapsed_sets.is_empty());
|
||||
assert!(h.query_by_label("Sharpen").is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn moving_an_action_next_to_another_set_joins_it() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
let mut a = Action::new("A", vec![]);
|
||||
a.set = Some("One".into());
|
||||
let mut b = Action::new("B", vec![]);
|
||||
b.set = Some("Two".into());
|
||||
app.session.actions.list.push(a);
|
||||
app.session.actions.list.push(b);
|
||||
app.session.actions.list.push(Action::new("C", vec![]));
|
||||
// C dropped below B: it joins B's set, "Two".
|
||||
move_row(&mut app, DragRow { action: 2, step: None }, 2);
|
||||
assert_eq!(app.session.actions.list[2].set.as_deref(), Some("Two"));
|
||||
// B dropped to the top, above A: the row below decides when there is none above.
|
||||
move_row(&mut app, DragRow { action: 1, step: None }, 0);
|
||||
assert_eq!((app.session.actions.list[0].name.as_str(), app.session.actions.list[0].set.as_deref()), ("B", Some("One")));
|
||||
// C dropped between A (One) and nothing: the row above wins.
|
||||
move_row(&mut app, DragRow { action: 2, step: None }, 2);
|
||||
assert_eq!((app.session.actions.list[2].name.as_str(), app.session.actions.list[2].set.as_deref()), ("C", Some("One")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insert_stop_dialog_adds_a_stop_after_the_selected_step() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 8, "height": 8})).unwrap();
|
||||
app.session.actions.list.push(Action::new("A", vec![("select.all".into(), json!({})), ("select.inverse".into(), json!({}))]));
|
||||
assert!(insert_stop_dialog(&mut app).is_err(), "needs a selected action");
|
||||
app.ui.actions.selected = Some(0);
|
||||
app.ui.actions.selected_step = Some(0);
|
||||
let id = insert_stop_dialog(&mut app).unwrap()["dialog"].as_u64().unwrap();
|
||||
let d = app.ui.dialog_mut(id).unwrap();
|
||||
assert!(owns_insert_stop(&d.fields));
|
||||
assert_eq!(d.fields["at"], 1);
|
||||
d.fields.insert("message".into(), json!("Check the mask"));
|
||||
d.fields.insert("allowContinue".into(), json!(true));
|
||||
crate::dialogs::confirm(&mut app, id).unwrap();
|
||||
let steps = &app.session.actions.list[0].steps;
|
||||
assert_eq!(steps[1], (photocraft_engine::atn_cmds::STOP_MESSAGE.to_string(), json!({"message": "Check the mask", "allowContinue": true})));
|
||||
assert_eq!((app.ui.actions.selected, app.ui.actions.selected_step), (Some(0), Some(1)));
|
||||
assert_eq!(step_label(&steps[1].0, &steps[1].1), "Stop: Check the mask");
|
||||
// Without a selected step the stop goes last; the panel's menu wiring is exercised by name.
|
||||
app.ui.actions.selected_step = None;
|
||||
let id = insert_stop_dialog(&mut app).unwrap()["dialog"].as_u64().unwrap();
|
||||
assert_eq!(app.ui.dialog_mut(id).unwrap().fields["at"], 3);
|
||||
crate::dialogs::cancel(&mut app, id).unwrap();
|
||||
assert_eq!(app.session.actions.list[0].steps.len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_dialog_toggled_step_pauses_playback_and_resumes_on_ok() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 16, "height": 16})).unwrap();
|
||||
let mut a = Action::new(
|
||||
"Blur",
|
||||
vec![("layer.new.layer".into(), json!({})), ("filter.blur.gaussianBlur".into(), json!({"radius": 3})), ("select.all".into(), json!({}))],
|
||||
);
|
||||
a.dialogs.insert(1);
|
||||
app.session.actions.list.push(a);
|
||||
let v = play(&mut app, &json!({"action": "Blur"})).unwrap();
|
||||
assert_eq!(v["ran"], 1, "{v}");
|
||||
assert_eq!(v["paused"]["step"], 1);
|
||||
let id = v["paused"]["dialog"].as_u64().unwrap();
|
||||
let d = app.ui.dialog_mut(id).unwrap();
|
||||
assert_eq!(d.fields["radius"], 3, "the dialog opens on the recorded values");
|
||||
assert_eq!(d.fields[RESUME], json!({"action": "Blur", "from": 2}));
|
||||
assert!(app.session.active().unwrap().doc.selection.is_none(), "nothing after the dialog ran yet");
|
||||
report_play(&mut app, &v);
|
||||
assert!(app.ui.status.contains("dialog"), "{}", app.ui.status);
|
||||
// OK runs the blur with the dialog's values and plays the rest.
|
||||
app.ui.dialog_mut(id).unwrap().fields.insert("radius".into(), json!(5));
|
||||
crate::dialogs::confirm(&mut app, id).unwrap();
|
||||
assert!(app.ui.dialogs.is_empty());
|
||||
assert!(app.session.active().unwrap().doc.selection.is_some(), "the step after the dialog ran");
|
||||
assert!(app.ui.status.starts_with("Played"), "{}", app.ui.status);
|
||||
// Cancel stops the action there.
|
||||
app.run("select.deselect", json!({})).unwrap();
|
||||
let v = play(&mut app, &json!({"action": "Blur"})).unwrap();
|
||||
let id = v["paused"]["dialog"].as_u64().unwrap();
|
||||
crate::dialogs::cancel(&mut app, id).unwrap();
|
||||
assert!(app.session.active().unwrap().doc.selection.is_none());
|
||||
assert!(app.ui.status.contains("stopped"), "{}", app.ui.status);
|
||||
// With background jobs (the desktop default) the resumed steps wait for the dialog's
|
||||
// filter to land instead of meeting a locked document.
|
||||
app.background_jobs = true;
|
||||
let v = play(&mut app, &json!({"action": "Blur"})).unwrap();
|
||||
let id = v["paused"]["dialog"].as_u64().unwrap();
|
||||
crate::dialogs::confirm(&mut app, id).unwrap();
|
||||
assert!(app.session.active().unwrap().doc.selection.is_some(), "the step after the background blur ran");
|
||||
assert!(app.ui.status.starts_with("Played"), "{}", app.ui.status);
|
||||
app.background_jobs = false;
|
||||
// Agents play headlessly: no pause, the recorded values run.
|
||||
app.automation_input = true;
|
||||
let v = play(&mut app, &json!({"action": "Blur"})).unwrap();
|
||||
assert_eq!(v["ran"], 3, "{v}");
|
||||
assert!(v.get("paused").is_none());
|
||||
}
|
||||
}
|
||||
@@ -231,6 +231,7 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
DialogKind::Command if crate::stroke_ui::owns(&fields) => crate::stroke_ui::body(ui, &mut fields),
|
||||
DialogKind::Command if crate::shape_dialog::owns(&fields) => crate::shape_dialog::body(app, ui, &mut fields),
|
||||
DialogKind::Command if crate::delete_layer_prompt::owns(&fields) => crate::delete_layer_prompt::body(ui, &mut fields),
|
||||
DialogKind::Command if crate::actions::owns_insert_stop(&fields) => crate::actions::insert_stop_body(ui, &mut fields),
|
||||
DialogKind::Command if crate::new_layer_ui::owns(&fields) => crate::new_layer_ui::body(ui, &mut fields),
|
||||
DialogKind::Command if crate::mask_trash_prompt::owns(&fields) => crate::mask_trash_prompt::body(ui, &fields),
|
||||
DialogKind::Command if crate::rasterize_prompt::owns(&fields) => crate::rasterize_prompt::body(ui, &fields),
|
||||
@@ -488,6 +489,7 @@ pub fn confirm(app: &mut PhotocraftApp, id: u64) -> Result<Value, String> {
|
||||
DialogKind::Command if crate::stroke_ui::owns(&d.fields) => crate::stroke_ui::confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::shape_dialog::owns(&d.fields) => crate::shape_dialog::confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::delete_layer_prompt::owns(&d.fields) => crate::delete_layer_prompt::confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::actions::owns_insert_stop(&d.fields) => crate::actions::insert_stop_confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::new_layer_ui::owns(&d.fields) => crate::new_layer_ui::confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::mask_trash_prompt::owns(&d.fields) => crate::mask_trash_prompt::confirm(app, &d.fields),
|
||||
DialogKind::Command if crate::rasterize_prompt::owns(&d.fields) => crate::rasterize_prompt::confirm(app, &d.fields),
|
||||
@@ -523,6 +525,8 @@ pub fn confirm(app: &mut PhotocraftApp, id: u64) -> Result<Value, String> {
|
||||
}
|
||||
if result.is_ok() {
|
||||
crate::filter_dialog::remember(app, &cmd, &d.fields);
|
||||
// A step dialog of a playing action: the action continues after it.
|
||||
crate::actions::resume(app, &d.fields);
|
||||
}
|
||||
result
|
||||
}
|
||||
@@ -534,6 +538,7 @@ pub fn confirm(app: &mut PhotocraftApp, id: u64) -> Result<Value, String> {
|
||||
/// Cancel a dialog and its dependent Layer Style picker, without applying edits.
|
||||
pub fn cancel(app: &mut PhotocraftApp, id: u64) -> Result<Value, String> {
|
||||
let closed = app.ui.close_dialog(id).ok_or_else(|| format!("no dialog {id}"))?;
|
||||
crate::actions::stopped(app, &closed.fields);
|
||||
if crate::guide_layout_ui::owns(&closed.fields) {
|
||||
app.ui.dialogs.retain(|child| child.fields.get("__dialog").and_then(Value::as_u64) != Some(id));
|
||||
}
|
||||
|
||||
@@ -3670,3 +3670,14 @@ navigator Zoom Zvětšení
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} krok zatím nemá v PhotoCraftu obdobu|{n} kroky zatím nemají v PhotoCraftu obdobu|{n} kroků zatím nemá v PhotoCraftu obdobu
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Uložena {n} akce do souboru {file}|Uloženy {n} akce do souboru {file}|Uloženo {n} akcí do souboru {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Vynechán {n} krok bez obdoby v Photoshopu|Vynechány {n} kroky bez obdoby v Photoshopu|Vynecháno {n} kroků bez obdoby v Photoshopu
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Vložit zastavení…
|
||||
Save Set… Uložit sadu…
|
||||
Message: Zpráva:
|
||||
Allow Continue Povolit pokračování
|
||||
Show dialog during playback Zobrazit dialog při přehrávání
|
||||
Select an action first Nejprve vyberte akci
|
||||
Action playback stopped Přehrávání akce zastaveno
|
||||
Step {step} is waiting for its dialog Krok {step} čeká na svůj dialog
|
||||
@plural {n} action|{n} actions {n} akce|{n} akce|{n} akcí
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2702,3 +2702,14 @@ curves Smooth Glätten
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} Schritt hat noch keine Entsprechung in PhotoCraft|{n} Schritte haben noch keine Entsprechung in PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} Aktion in {file} gespeichert|{n} Aktionen in {file} gespeichert
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} Schritt ohne Photoshop-Entsprechung ausgelassen|{n} Schritte ohne Photoshop-Entsprechung ausgelassen
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Stopp einfügen…
|
||||
Save Set… Set speichern…
|
||||
Message: Meldung:
|
||||
Allow Continue Fortsetzen erlauben
|
||||
Show dialog during playback Dialog bei der Wiedergabe anzeigen
|
||||
Select an action first Wählen Sie zuerst eine Aktion aus
|
||||
Action playback stopped Aktionswiedergabe angehalten
|
||||
Step {step} is waiting for its dialog Schritt {step} wartet auf seinen Dialog
|
||||
@plural {n} action|{n} actions {n} Aktion|{n} Aktionen
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3760,3 +3760,14 @@ curves Smooth Εξομάλυνση
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} βήμα δεν έχει ακόμη αντίστοιχο στο PhotoCraft|{n} βήματα δεν έχουν ακόμη αντίστοιχο στο PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Αποθηκεύτηκε {n} ενέργεια στο {file}|Αποθηκεύτηκαν {n} ενέργειες στο {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Παραλείφθηκε {n} βήμα χωρίς αντίστοιχο στο Photoshop|Παραλείφθηκαν {n} βήματα χωρίς αντίστοιχο στο Photoshop
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Εισαγωγή διακοπής…
|
||||
Save Set… Αποθήκευση συνόλου…
|
||||
Message: Μήνυμα:
|
||||
Allow Continue Να επιτρέπεται η συνέχεια
|
||||
Show dialog during playback Εμφάνιση του παραθύρου διαλόγου κατά την αναπαραγωγή
|
||||
Select an action first Επιλέξτε πρώτα μια ενέργεια
|
||||
Action playback stopped Η αναπαραγωγή της ενέργειας σταμάτησε
|
||||
Step {step} is waiting for its dialog Το βήμα {step} περιμένει το παράθυρο διαλόγου του
|
||||
@plural {n} action|{n} actions {n} ενέργεια|{n} ενέργειες
|
||||
|
Can't render this file because it contains an unexpected character in line 1000 and column 18.
|
@@ -2743,3 +2743,14 @@ curves Smooth Suavizar
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} paso aún no tiene equivalente en PhotoCraft|{n} pasos aún no tienen equivalente en PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Se guardó {n} acción en {file}|Se guardaron {n} acciones en {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} paso sin equivalente en Photoshop omitido|{n} pasos sin equivalente en Photoshop omitidos
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Insertar detención…
|
||||
Save Set… Guardar conjunto…
|
||||
Message: Mensaje:
|
||||
Allow Continue Permitir continuar
|
||||
Show dialog during playback Mostrar el cuadro de diálogo durante la reproducción
|
||||
Select an action first Seleccione primero una acción
|
||||
Action playback stopped Reproducción de la acción detenida
|
||||
Step {step} is waiting for its dialog El paso {step} está esperando su cuadro de diálogo
|
||||
@plural {n} action|{n} actions {n} acción|{n} acciones
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -3063,3 +3063,14 @@ curves Smooth Lisser
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} étape n’a pas encore d’équivalent dans PhotoCraft|{n} étapes n’ont pas encore d’équivalent dans PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} action enregistrée dans {file}|{n} actions enregistrées dans {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} étape sans équivalent Photoshop omise|{n} étapes sans équivalent Photoshop omises
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Insérer un arrêt…
|
||||
Save Set… Enregistrer l’ensemble…
|
||||
Message: Message :
|
||||
Allow Continue Autoriser la poursuite
|
||||
Show dialog during playback Afficher la boîte de dialogue pendant l’exécution
|
||||
Select an action first Sélectionnez d’abord une action
|
||||
Action playback stopped Exécution de l’action arrêtée
|
||||
Step {step} is waiting for its dialog L’étape {step} attend sa boîte de dialogue
|
||||
@plural {n} action|{n} actions {n} action|{n} actions
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3982,3 +3982,14 @@ cameraRaw Yellow Sárga
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} lépésnek még nincs megfelelője a PhotoCraftban
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} művelet mentve. Cél: {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} Photoshop-megfelelő nélküli lépés kihagyva
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Leállítás beszúrása…
|
||||
Save Set… Készlet mentése…
|
||||
Message: Üzenet:
|
||||
Allow Continue Folytatás engedélyezése
|
||||
Show dialog during playback Párbeszédablak megjelenítése lejátszáskor
|
||||
Select an action first Először válasszon ki egy műveletet
|
||||
Action playback stopped A művelet lejátszása leállt
|
||||
Step {step} is waiting for its dialog A(z) {step}. lépés a párbeszédablakára vár
|
||||
@plural {n} action|{n} actions {n} művelet
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3050,3 +3050,14 @@ curves Smooth Haluskan
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} langkah belum memiliki padanan di PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} tindakan disimpan ke {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} langkah tanpa padanan Photoshop dilewati
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Sisipkan Berhenti…
|
||||
Save Set… Simpan Set…
|
||||
Message: Pesan:
|
||||
Allow Continue Izinkan Lanjut
|
||||
Show dialog during playback Tampilkan dialog saat pemutaran
|
||||
Select an action first Pilih tindakan terlebih dahulu
|
||||
Action playback stopped Pemutaran tindakan dihentikan
|
||||
Step {step} is waiting for its dialog Langkah {step} menunggu dialognya
|
||||
@plural {n} action|{n} actions {n} tindakan
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -4026,3 +4026,14 @@ navigator Zoom Zoom
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} passaggio non ha ancora un equivalente in PhotoCraft|{n} passaggi non hanno ancora un equivalente in PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Salvata {n} azione in {file}|Salvate {n} azioni in {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Omesso {n} passaggio senza equivalente in Photoshop|Omessi {n} passaggi senza equivalente in Photoshop
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Inserisci interruzione…
|
||||
Save Set… Salva set…
|
||||
Message: Messaggio:
|
||||
Allow Continue Consenti di continuare
|
||||
Show dialog during playback Mostra la finestra di dialogo durante l’esecuzione
|
||||
Select an action first Seleziona prima un’azione
|
||||
Action playback stopped Esecuzione dell’azione interrotta
|
||||
Step {step} is waiting for its dialog Il passaggio {step} attende la sua finestra di dialogo
|
||||
@plural {n} action|{n} actions {n} azione|{n} azioni
|
||||
|
Can't render this file because it contains an unexpected character in line 2592 and column 53.
|
@@ -3672,3 +3672,14 @@ curves Smooth スムーズ
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} 個のステップにはまだ PhotoCraft の対応機能がありません
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {file} にアクション {n} 個を保存しました
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Photoshop に対応するもののない {n} 個のステップを省きました
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… ストップを挿入…
|
||||
Save Set… セットを保存…
|
||||
Message: メッセージ:
|
||||
Allow Continue 続行を許可
|
||||
Show dialog during playback 再生中にダイアログを表示
|
||||
Select an action first 先にアクションを選択してください
|
||||
Action playback stopped アクションの再生を停止しました
|
||||
Step {step} is waiting for its dialog ステップ {step} はダイアログを待っています
|
||||
@plural {n} action|{n} actions アクション {n} 個
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3232,3 +3232,14 @@ curves Smooth 매끄럽게
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n}개 단계에는 아직 PhotoCraft에 해당하는 기능이 없습니다
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {file}에 액션 {n}개를 저장했습니다
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Photoshop에 해당하는 기능이 없는 {n}개 단계를 제외했습니다
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… 정지 삽입…
|
||||
Save Set… 세트 저장…
|
||||
Message: 메시지:
|
||||
Allow Continue 계속 허용
|
||||
Show dialog during playback 재생 중 대화 상자 표시
|
||||
Select an action first 먼저 액션을 선택하세요
|
||||
Action playback stopped 액션 재생이 중지되었습니다
|
||||
Step {step} is waiting for its dialog {step}단계가 대화 상자를 기다리고 있습니다
|
||||
@plural {n} action|{n} actions 액션 {n}개
|
||||
|
Can't render this file because it contains an unexpected character in line 3101 and column 53.
|
@@ -3822,3 +3822,14 @@ curves Smooth Vloeiend maken
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} stap heeft nog geen equivalent in PhotoCraft|{n} stappen hebben nog geen equivalent in PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} handeling opgeslagen in {file}|{n} handelingen opgeslagen in {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} stap zonder Photoshop-equivalent weggelaten|{n} stappen zonder Photoshop-equivalent weggelaten
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Stop invoegen…
|
||||
Save Set… Set opslaan…
|
||||
Message: Bericht:
|
||||
Allow Continue Doorgaan toestaan
|
||||
Show dialog during playback Dialoogvenster tonen tijdens afspelen
|
||||
Select an action first Selecteer eerst een handeling
|
||||
Action playback stopped Afspelen van de handeling gestopt
|
||||
Step {step} is waiting for its dialog Stap {step} wacht op zijn dialoogvenster
|
||||
@plural {n} action|{n} actions {n} handeling|{n} handelingen
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -3659,3 +3659,14 @@ curves Smooth Wygładź
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} krok nie ma jeszcze odpowiednika w PhotoCraft|{n} kroki nie mają jeszcze odpowiednika w PhotoCraft|{n} kroków nie ma jeszcze odpowiednika w PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Zapisano {n} operację do {file}|Zapisano {n} operacje do {file}|Zapisano {n} operacji do {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Pominięto {n} krok bez odpowiednika w Photoshopie|Pominięto {n} kroki bez odpowiednika w Photoshopie|Pominięto {n} kroków bez odpowiednika w Photoshopie
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Wstaw zatrzymanie…
|
||||
Save Set… Zapisz zestaw…
|
||||
Message: Komunikat:
|
||||
Allow Continue Zezwól na kontynuację
|
||||
Show dialog during playback Pokazuj okno dialogowe podczas odtwarzania
|
||||
Select an action first Najpierw wybierz operację
|
||||
Action playback stopped Odtwarzanie operacji zatrzymane
|
||||
Step {step} is waiting for its dialog Krok {step} czeka na swoje okno dialogowe
|
||||
@plural {n} action|{n} actions {n} operacja|{n} operacje|{n} operacji
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3852,3 +3852,14 @@ layerLabel No Color Sem cor
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} etapa ainda não tem equivalente no PhotoCraft|{n} etapas ainda não têm equivalente no PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} ação salva em {file}|{n} ações salvas em {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} etapa sem equivalente no Photoshop foi omitida|{n} etapas sem equivalente no Photoshop foram omitidas
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Inserir parada…
|
||||
Save Set… Salvar conjunto…
|
||||
Message: Mensagem:
|
||||
Allow Continue Permitir continuar
|
||||
Show dialog during playback Mostrar a caixa de diálogo durante a reprodução
|
||||
Select an action first Selecione uma ação primeiro
|
||||
Action playback stopped Reprodução da ação interrompida
|
||||
Step {step} is waiting for its dialog A etapa {step} está aguardando sua caixa de diálogo
|
||||
@plural {n} action|{n} actions {n} ação|{n} ações
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3007,3 +3007,14 @@ curves Smooth Сгладить
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} шаг пока не имеет эквивалента в PhotoCraft|{n} шага пока не имеют эквивалента в PhotoCraft|{n} шагов пока не имеют эквивалента в PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Сохранена {n} операция в {file}|Сохранено {n} операции в {file}|Сохранено {n} операций в {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Пропущен {n} шаг без эквивалента в Photoshop|Пропущено {n} шага без эквивалента в Photoshop|Пропущено {n} шагов без эквивалента в Photoshop
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Вставить остановку…
|
||||
Save Set… Сохранить набор…
|
||||
Message: Сообщение:
|
||||
Allow Continue Разрешить продолжение
|
||||
Show dialog during playback Показывать диалог при воспроизведении
|
||||
Select an action first Сначала выберите операцию
|
||||
Action playback stopped Воспроизведение операции остановлено
|
||||
Step {step} is waiting for its dialog Шаг {step} ожидает своего диалога
|
||||
@plural {n} action|{n} actions {n} операция|{n} операции|{n} операций
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3794,3 +3794,14 @@ cameraData Lens Lens
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} adımın PhotoCraft’ta henüz karşılığı yok
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} {n} eylem {file} dosyasına kaydedildi
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Photoshop karşılığı olmayan {n} adım atlandı
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Durdurma Ekle…
|
||||
Save Set… Seti Kaydet…
|
||||
Message: İleti:
|
||||
Allow Continue Devam Etmeye İzin Ver
|
||||
Show dialog during playback Oynatma sırasında iletişim kutusunu göster
|
||||
Select an action first Önce bir eylem seçin
|
||||
Action playback stopped Eylem oynatma durduruldu
|
||||
Step {step} is waiting for its dialog {step}. adım iletişim kutusunu bekliyor
|
||||
@plural {n} action|{n} actions {n} eylem
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -3760,3 +3760,14 @@ curves Smooth Згладити
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} крок ще не має відповідника в PhotoCraft|{n} кроки ще не мають відповідника в PhotoCraft|{n} кроків ще не мають відповідника в PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Збережено {n} операцію до {file}|Збережено {n} операції до {file}|Збережено {n} операцій до {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Пропущено {n} крок без відповідника в Photoshop|Пропущено {n} кроки без відповідника в Photoshop|Пропущено {n} кроків без відповідника в Photoshop
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Вставити зупинку…
|
||||
Save Set… Зберегти набір…
|
||||
Message: Повідомлення:
|
||||
Allow Continue Дозволити продовження
|
||||
Show dialog during playback Показувати діалог під час відтворення
|
||||
Select an action first Спочатку виберіть операцію
|
||||
Action playback stopped Відтворення операції зупинено
|
||||
Step {step} is waiting for its dialog Крок {step} очікує на свій діалог
|
||||
@plural {n} action|{n} actions {n} операція|{n} операції|{n} операцій
|
||||
|
Can't render this file because it contains an unexpected character in line 1357 and column 18.
|
@@ -3546,3 +3546,14 @@ curves Smooth Làm mượt
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} bước chưa có chức năng tương ứng trong PhotoCraft
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} Đã lưu {n} hành động vào {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Đã bỏ qua {n} bước không có chức năng tương ứng trong Photoshop
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… Chèn điểm dừng…
|
||||
Save Set… Lưu bộ…
|
||||
Message: Thông báo:
|
||||
Allow Continue Cho phép tiếp tục
|
||||
Show dialog during playback Hiện hộp thoại khi phát
|
||||
Select an action first Hãy chọn một hành động trước
|
||||
Action playback stopped Đã dừng phát hành động
|
||||
Step {step} is waiting for its dialog Bước {step} đang chờ hộp thoại của nó
|
||||
@plural {n} action|{n} actions {n} hành động
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -2667,3 +2667,14 @@ curves Smooth 平滑
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} 个步骤在 PhotoCraft 中尚无对应功能
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} 已将 {n} 个动作存储到 {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out 已省略 {n} 个没有 Photoshop 对应功能的步骤
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… 插入停止…
|
||||
Save Set… 存储组…
|
||||
Message: 信息:
|
||||
Allow Continue 允许继续
|
||||
Show dialog during playback 播放时显示对话框
|
||||
Select an action first 请先选择一个动作
|
||||
Action playback stopped 动作播放已停止
|
||||
Step {step} is waiting for its dialog 步骤 {step} 正在等待其对话框
|
||||
@plural {n} action|{n} actions {n} 个动作
|
||||
|
Can't render this file because it contains an unexpected character in line 2534 and column 53.
|
@@ -2652,3 +2652,14 @@ curves Smooth 平滑
|
||||
@plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} 個步驟在 PhotoCraft 中尚無對應功能
|
||||
@plural Saved {n} action to {file}|Saved {n} actions to {file} 已將 {n} 個動作儲存到 {file}
|
||||
@plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out 已略過 {n} 個沒有 Photoshop 對應功能的步驟
|
||||
|
||||
# Actions panel: set folders, dialog toggle, Insert Stop
|
||||
Insert Stop… 插入停止…
|
||||
Save Set… 儲存組合…
|
||||
Message: 訊息:
|
||||
Allow Continue 允許繼續
|
||||
Show dialog during playback 播放時顯示對話框
|
||||
Select an action first 請先選取一個動作
|
||||
Action playback stopped 動作播放已停止
|
||||
Step {step} is waiting for its dialog 步驟 {step} 正在等待其對話框
|
||||
@plural {n} action|{n} actions {n} 個動作
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -526,6 +526,17 @@ the parent before its next step. Every nested command retains the normal automat
|
||||
Existing recordings containing expanded commands remain unchanged; remove those steps and record
|
||||
the named call again if desired.
|
||||
|
||||
Actions sit in **set folders** (`set` on `actions.list` / `actions.get`, filled by Load Actions,
|
||||
written by Save Actions, changed with `actions.assignSet`): the panel shows loose actions first,
|
||||
then each set as a collapsible folder (`ui.actions.collapsedSets`); dropping an action among
|
||||
another set's rows moves it into that set. Each step has Photoshop's two toggles: the check
|
||||
(`actions.toggle`, skipped when off) and the **dialog** toggle (`actions.dialog`). Playing a
|
||||
step with its dialog on opens that command's dialog seeded with the recorded values and pauses:
|
||||
the play result carries `paused: {step, id, dialog}`, OK runs the dialog's values and continues
|
||||
from the next step, Cancel stops the action. Agents (`automation_input`) play headlessly with the
|
||||
recorded values. The panel menu's **Insert Stop…** adds an `actions.stopMessage` step after the
|
||||
selected step (`actions.insert` takes any command id and params).
|
||||
|
||||
Layer-panel **Quick Export as PNG** exports every selected layer as a separate PNG. A single
|
||||
Save dialog chooses the first filename; remaining files are numbered siblings with sanitized
|
||||
layer names. Selection is captured before opening the dialog; an unselected layer is excluded.
|
||||
|
||||
+7
-5
@@ -87,14 +87,16 @@ what an agent can't finish alone.
|
||||
- **Estimate:** 120–200 h.
|
||||
|
||||
### G11. Actions and scripting
|
||||
- **Missing:** document-independent action recording (AUTO-219-1), the rest of the Actions
|
||||
panel: grouping by set, an Insert Stop item and editing the dialog toggle (AUTO-219-2), Batch
|
||||
recursion and naming (AUTO-219-5), ExtendScript/UXP compatibility. `.atn` steps outside the
|
||||
- **Missing:** document-independent action recording (AUTO-219-1), Batch recursion and naming
|
||||
(AUTO-219-5), ExtendScript/UXP compatibility. `.atn` steps outside the
|
||||
90 mapped events (Transform with scale or rotation, Apply Image, Save for Web, Place, smart
|
||||
object edits, Generative Fill…) load as kept Photoshop steps that fail at playback by name.
|
||||
- **Done 2026-10-12:** Load/Save Actions `.atn` in the panel menu, `batch --actions set.atn`
|
||||
and `actions.load`/`actions.save`; 90 Photoshop events map to commands both ways, Play and
|
||||
Stop steps included; layer steps replay by layer name in any document (AUTO-219-2 partial).
|
||||
and `actions.load`/`actions.save`; 92 Photoshop events map to commands both ways, Play and
|
||||
Stop steps included; layer steps replay by layer name in any document. The panel groups actions
|
||||
in set folders, has the dialog toggle column (playback pauses on the step's dialog and resumes
|
||||
on OK) and Insert Stop…; `actions.insert`, `actions.dialog`, `actions.assignSet` for agents
|
||||
(AUTO-219-2 done).
|
||||
- **Ahead of Photoshop:** CLI, MCP and the JSON control channel drive every command.
|
||||
- **Estimate:** 120–200 h. **Human:** whether to support a JavaScript scripting dialect at all
|
||||
(AGENTS.md forbids JS in the app).
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js
|
||||
| [Tools](#tools) | 28 | 14 | 1 | |
|
||||
| [Workspace and UI](#workspace-and-ui) | 13 | 5 | 5 | settings that do nothing: 27 of 156 (target 0) |
|
||||
| [Type](#type) | 4 | 2 | 3 | |
|
||||
| [Automation](#automation) | 4 | 3 | 4 | 631 of 631 menu items live (100.0%) |
|
||||
| [Automation](#automation) | 5 | 2 | 4 | 631 of 631 menu items live (100.0%) |
|
||||
| [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 28 of 28 crates; panic_hunt present |
|
||||
| [Distribution](#distribution) | 5 | 4 | 2 | |
|
||||
| [Open bugs](#open-bugs) | 29 | 2 | 1 | |
|
||||
@@ -228,7 +228,7 @@ Menu wiring (`docs/parity-checklist.md`): 631 of 631 menu items live (100.0%). T
|
||||
|---|---|---|---|---|
|
||||
| AUTO-1 | Every menu item dispatches a command id (UI, CLI, control channel and MCP share them) | done | | docs/parity-checklist.md: all menu items live; menus.rs is_live |
|
||||
| AUTO-219-1 | Record actions in a document-independent form (implicit layer, merged type keystrokes) | missing | [#219](https://github.com/storytold/photocraft/issues/219) | actions.rs:47 copies raw journal entries with explicit layer ids |
|
||||
| AUTO-219-2 | Actions panel: step and dialog toggles, reorder, delete a step, Stop, sets, .atn import | partial | [#219](https://github.com/storytold/photocraft/issues/219) | 2026-10-12: Load/Save Actions (.atn) in the panel menu, CLI batch and actions.load/save (atn_cmds.rs): 90 Photoshop events map to commands both ways, the rest are kept verbatim and fail at playback by name; step toggles, reorder and delete a step done; Stop steps play (actions.stopMessage) but there is no Insert Stop menu item; sets and dialog toggles are stored and round-trip but the panel neither groups by set nor edits the dialog toggle |
|
||||
| AUTO-219-2 | Actions panel: step and dialog toggles, reorder, delete a step, Stop, sets, .atn import | done | [#219](https://github.com/storytold/photocraft/issues/219) | 2026-10-12: set folders (collapsible, drag between sets, actions.assignSet), dialog toggle column (playback opens the step's dialog seeded with its values and resumes on OK; actions.dialog), Insert Stop… (actions.insert), step toggles, reorder, delete a step; Load/Save Actions (.atn) in the panel menu, CLI batch and actions.load/save (atn_cmds.rs): 90 Photoshop events map to commands both ways, the rest are kept verbatim and fail at playback by name; step toggles, reorder and delete a step done; Stop steps play (actions.stopMessage) but there is no Insert Stop menu item; sets and dialog toggles are stored and round-trip but the panel neither groups by set nor edits the dialog toggle |
|
||||
| AUTO-219-3 | actions.record/stop/play/list commands for agents and the CLI | done | [#219](https://github.com/storytold/photocraft/issues/219) | actions.list/get/record/stop/play/delete in actions_cmds.rs; the panel, CLI and MCP share them. Nested steps pass the session authorize hook. |
|
||||
| AUTO-219-4 | Replay tests for crop, filters, selections and styled text on a second document | done | [#219](https://github.com/storytold/photocraft/issues/219) | actions_cmds.rs: a_recorded_edit_run_replays_on_a_second_document records a crop, a Gaussian Blur, a selection fill and faux-bold type on one document and replays all of them onto a second (plus the original layer/select/fill replay) |
|
||||
| AUTO-219-5 | Batch: subfolders, open documents, naming template, progress/cancel, error log, stop | partial | [#219](https://github.com/storytold/photocraft/issues/219) | file_cmds.rs:590-631 folder/array input, per-file errors; no recursion, template or cancel |
|
||||
|
||||
@@ -21,9 +21,9 @@ note = "actions.rs:47 copies raw journal entries with explicit layer ids"
|
||||
[[item]]
|
||||
id = "AUTO-219-2"
|
||||
target = "Actions panel: step and dialog toggles, reorder, delete a step, Stop, sets, .atn import"
|
||||
status = "partial"
|
||||
status = "done"
|
||||
issue = 219
|
||||
note = "2026-10-12: Load/Save Actions (.atn) in the panel menu, CLI batch and actions.load/save (atn_cmds.rs): 90 Photoshop events map to commands both ways, the rest are kept verbatim and fail at playback by name; step toggles, reorder and delete a step done; Stop steps play (actions.stopMessage) but there is no Insert Stop menu item; sets and dialog toggles are stored and round-trip but the panel neither groups by set nor edits the dialog toggle"
|
||||
note = "2026-10-12: set folders (collapsible, drag between sets, actions.assignSet), dialog toggle column (playback opens the step's dialog seeded with its values and resumes on OK; actions.dialog), Insert Stop… (actions.insert), step toggles, reorder, delete a step; Load/Save Actions (.atn) in the panel menu, CLI batch and actions.load/save (atn_cmds.rs): 90 Photoshop events map to commands both ways, the rest are kept verbatim and fail at playback by name; step toggles, reorder and delete a step done; Stop steps play (actions.stopMessage) but there is no Insert Stop menu item; sets and dialog toggles are stored and round-trip but the panel neither groups by set nor edits the dialog toggle"
|
||||
|
||||
[[item]]
|
||||
id = "AUTO-219-3"
|
||||
|
||||
Reference in new issue
Block a user