Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LR-EDIT-DETAIL-DENOISE: list settings tabs from TABS; fix the SAM 3 worker's wasm check

Brandon Thomas7dcfbed05c27
diff --git a/crates/segment/src/bin/lightcraft-sam3-worker.rs b/crates/segment/src/bin/lightcraft-sam3-worker.rs
index 62c183346..f8e525410 100644
--- a/crates/segment/src/bin/lightcraft-sam3-worker.rs
+++ b/crates/segment/src/bin/lightcraft-sam3-worker.rs
@@ -3,6 +3,7 @@
#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
+#[cfg(not(target_arch = "wasm32"))]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = std::env::args().skip(1);
let dir = args.next().ok_or("usage: lightcraft-sam3-worker MODEL_DIR [127.0.0.1:8793]")?;
@@ -11,3 +12,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
lightcraft_segment::remote::serve(address, std::path::Path::new(&dir), device)?;
Ok(())
}
+
+/// The worker serves a local GPU over a socket; there is nothing to serve in a browser.
+#[cfg(target_arch = "wasm32")]
+fn main() {}
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index ce40ebc5a..5b79548b9 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -465,7 +465,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
"app.settings" => {
let tab = p.get("tab").and_then(Value::as_str).unwrap_or("general");
if !crate::panels::settings::TABS.iter().any(|(id, _)| *id == tab) {
- return Some(Err(format!("unknown settings tab `{tab}` (general|import|performance|interface|faces)")));
+ let tabs: Vec<&str> = crate::panels::settings::TABS.iter().map(|(id, _)| *id).collect();
+ return Some(Err(format!("unknown settings tab `{tab}` ({})", tabs.join("|"))));
}
app.ui.dialog = Some(Dialog::Settings { tab: tab.into() });
Ok(Value::Null)