Files

40 lines
1.3 KiB
Rust

//! Developer tool: render Curator offscreen (no window) against the pool in
//! `$CURATOR_CONFIG` and save a PNG. `--action <name>` opens a dialog first
//! (`edit`, `stats`, `schema`, `libraries`, `series`, `duplicates`, `tags`).
//!
//! ```text
//! CURATOR_CONFIG=/tmp/cfg.json cargo run --example screenshot -- /tmp/shot.png --action edit
//! ```
use std::path::PathBuf;
use curator::core::file_manager::FileManager;
use curator::ui::app::CuratorApp;
use egui_kittest::Harness;
fn main() -> Result<(), String> {
let args: Vec<String> = std::env::args().collect();
let out = PathBuf::from(
args.get(1)
.cloned()
.unwrap_or_else(|| "screenshot.png".into()),
);
let action = args.iter().skip_while(|a| *a != "--action").nth(1).cloned();
let fm = FileManager::new();
let mut harness = Harness::builder()
.with_size(egui::vec2(1300.0, 800.0))
.allow_missing_glyphs()
.with_accessibility_check(false)
.wgpu()
.build_eframe(|cc| CuratorApp::new(fm, cc.egui_ctx.clone()));
harness.run_steps(3);
if let Some(a) = action {
harness.state_mut().debug_action(&a);
harness.run_steps(3);
}
let image = harness.render()?;
image.save(&out).map_err(|e| e.to_string())?;
println!("saved {}", out.display());
Ok(())
}