Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Essential Graphics: an Install refused shows why on the status bar (#611).

Vikram Bhaskaraneea3afa8beac
diff --git a/crates/ui-egui/src/panels/graphics_templates.rs b/crates/ui-egui/src/panels/graphics_templates.rs
index d66c346a8..27965808d 100644
--- a/crates/ui-egui/src/panels/graphics_templates.rs
+++ b/crates/ui-egui/src/panels/graphics_templates.rs
@@ -591,6 +591,11 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Val
"graphics.template.install" if params.get("path").is_none() => {
let path = app.hooks.pick_open_file.as_mut().and_then(|f| f(tl!("FilmCraft Graphics Template"), &["fcgt"]))?;
let r = app.session.execute(id, json!({"path": path})).map_err(|e| e.to_string());
+ // The Browse panel's Install… button calls this directly and drops the result
+ // (#611); report a refused file here, so every caller shows why nothing happened.
+ if let Err(e) = &r {
+ app.ui.status = e.clone();
+ }
invalidate(ctx);
Some(r)
}
diff --git a/crates/ui-egui/tests/graphics_templates_ui.rs b/crates/ui-egui/tests/graphics_templates_ui.rs
index 57ffea712..7affec89b 100644
--- a/crates/ui-egui/tests/graphics_templates_ui.rs
+++ b/crates/ui-egui/tests/graphics_templates_ui.rs
@@ -203,3 +203,21 @@ fn type_tool_selection_styles_characters() {
let hist = d.exec("history.list", json!({}));
assert_eq!(hist["undo"].as_array().unwrap().last().unwrap(), "Character Style");
}
+
+/// #611: installing a file FilmCraft refuses (a ZIP — EffectCraft's template package renamed
+/// to .fcgt) from the Browse panel must say why on the status bar, not do nothing.
+#[test]
+fn install_refused_shows_the_reason_on_the_status_bar() {
+ let mut d = Driver::demo("install-refused");
+ let file = std::env::temp_dir().join(format!("filmcraft-gfx-ui-zip-{}.fcgt", std::process::id()));
+ std::fs::write(&file, [0x50u8, 0x4b, 0x03, 0x04]).unwrap();
+ let picked = file.to_string_lossy().to_string();
+ d.harness.state_mut().hooks.pick_open_file = Some(Box::new(move |_, _| Some(picked.clone())));
+ d.ok("ui.set", json!({"workspace": "Captions and Graphics"}));
+ d.ok("ui.set", json!({"gfxTemplates": {"tab": "browse"}}));
+ d.ok("ui.click", json!({"id": "gfxTemplates.install"}));
+ let st = d.ok("ui.inspect", json!({}));
+ let _ = std::fs::remove_file(&file);
+ let msg = st["ui"]["status"].as_str().unwrap_or_default().to_lowercase();
+ assert!(msg.contains("zip archive"), "the refused install left no visible reason: {:?}", st["ui"]["status"]);
+}