diff --git a/Cargo.lock b/Cargo.lock index 6d062934b3a9..91c87bd74311 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1254,8 +1254,7 @@ checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[package]] name = "ecolor" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "bytemuck", "serde", @@ -1264,8 +1263,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea929ec5819fef373728bb0e55003ce921975039cfec3ca8305bb024e5b7b32" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "bytemuck", "directories-next", @@ -1275,10 +1273,12 @@ dependencies = [ "egui_glow", "js-sys", "percent-encoding", + "pollster", "puffin", "raw-window-handle 0.5.0", "ron", "serde", + "thiserror", "tracing", "wasm-bindgen", "wasm-bindgen-futures", @@ -1290,8 +1290,7 @@ dependencies = [ [[package]] name = "egui" version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65a5e883a316e53866977450eecfbcac9c48109c2ab3394af29feb83fcde4ea9" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "accesskit", "ahash 0.8.2", @@ -1314,12 +1313,10 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a6edfac4c02455f5024dc7cda997629b94748571935773d1a0cfab8213c80a" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "bytemuck", "egui", - "pollster", "puffin", "tracing", "type-map", @@ -1330,8 +1327,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5696bdbe60898b81157f07ae34fe02dbfd522174bd6e620942c269cd7307901f" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "arboard", "egui", @@ -1357,8 +1353,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1975cd88ff7430f93b29e6b9868b648a8ff6a43b08b9ff8474ee0a648bd8f9a6" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "egui", "serde", @@ -1368,8 +1363,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4b5960cb1bae1c403a6c9027a745210a41913433b10c73b6e7d76a1017f8b4" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "bytemuck", "egui", @@ -1391,8 +1385,7 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "emath" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "bytemuck", "serde", @@ -1435,8 +1428,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de14b65fe5e423e0058f77a8beb2c863b056d0566d6c4ce0d097aa5814cb705a" +source = "git+https://github.com/emilk/egui?rev=e0b5bb17e5851fb5a6904847e353aa74db3441bb#e0b5bb17e5851fb5a6904847e353aa74db3441bb" dependencies = [ "ab_glyph", "ahash 0.8.2", @@ -4079,6 +4071,7 @@ dependencies = [ "clap 4.0.26", "crossbeam", "document-features", + "eframe", "mimalloc", "nohash-hasher", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index b73665b8da0d..399864326295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,14 +25,14 @@ opt-level = 2 debug = true [patch.crates-io] -# # 2022-12-08 - egui style tweaks -# ecolor = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# eframe = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# egui = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# egui_extras = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# egui-wgpu = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# emath = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } -# epaint = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +# # 2022-12-12 - eframe::run_return can return an error +ecolor = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +eframe = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +egui = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +egui_extras = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +egui-wgpu = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +emath = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } +epaint = { git = "https://github.com/emilk/egui", rev = "e0b5bb17e5851fb5a6904847e353aa74db3441bb" } # ecolor = { path = "../../egui/crates/ecolor" } # eframe = { path = "../../egui/crates/eframe" } diff --git a/crates/re_ui/examples/re_ui_example.rs b/crates/re_ui/examples/re_ui_example.rs index e2c7f5ef6670..cdc3de7bdc78 100644 --- a/crates/re_ui/examples/re_ui_example.rs +++ b/crates/re_ui/examples/re_ui_example.rs @@ -1,4 +1,4 @@ -fn main() { +fn main() -> eframe::Result<()> { let native_options = eframe::NativeOptions { initial_window_size: Some([1200.0, 800.0].into()), follow_system_theme: false, @@ -23,7 +23,7 @@ fn main() { bottom_panel: true, }) }), - ); + ) } pub struct ExampleApp { diff --git a/crates/re_viewer/src/native.rs b/crates/re_viewer/src/native.rs index 1b30305468e2..c5a50ea62caf 100644 --- a/crates/re_viewer/src/native.rs +++ b/crates/re_viewer/src/native.rs @@ -3,7 +3,7 @@ use re_log_types::LogMsg; type AppCreator = Box, re_ui::ReUi) -> Box>; -pub fn run_native_app(app_creator: AppCreator) { +pub fn run_native_app(app_creator: AppCreator) -> eframe::Result<()> { let native_options = eframe::NativeOptions { depth_buffer: 0, multisampling: 0, // the 3D views do their own MSAA @@ -29,13 +29,13 @@ pub fn run_native_app(app_creator: AppCreator) { let re_ui = crate::customize_eframe(cc); app_creator(cc, re_ui) }), - ); + ) } pub fn run_native_viewer_with_messages( startup_options: crate::StartupOptions, log_messages: Vec, -) { +) -> eframe::Result<()> { let (tx, rx) = re_smart_channel::smart_channel(re_smart_channel::Source::File); for log_msg in log_messages { tx.send(log_msg).ok(); @@ -47,5 +47,5 @@ pub fn run_native_viewer_with_messages( cc.storage, rx, )) - })); + })) } diff --git a/crates/rerun/src/lib.rs b/crates/rerun/src/lib.rs index 337d20e6e6f2..899d40b08509 100644 --- a/crates/rerun/src/lib.rs +++ b/crates/rerun/src/lib.rs @@ -152,7 +152,7 @@ async fn run_impl(args: Args) -> anyhow::Result<()> { let mut app = re_viewer::App::from_receiver(startup_options, re_ui, cc.storage, rx); app.set_profiler(profiler); Box::new(app) - })); + }))?; } Ok(()) } @@ -180,7 +180,7 @@ async fn connect_to_ws_url( ); app.set_profiler(profiler); Box::new(app) - })); + }))?; } Ok(()) } diff --git a/crates/rerun_sdk/Cargo.toml b/crates/rerun_sdk/Cargo.toml index 5e748dcccc70..3df3229e5b03 100644 --- a/crates/rerun_sdk/Cargo.toml +++ b/crates/rerun_sdk/Cargo.toml @@ -10,7 +10,7 @@ publish = false default = ["re_viewer"] ## Support for the viewer -re_viewer = ["dep:re_viewer"] +re_viewer = ["dep:re_viewer", "dep:eframe"] ## Support serving a web viewer over HTTP. ## @@ -41,6 +41,8 @@ re_viewer = { path = "../re_viewer", features = [ "puffin", ], default-features = false, optional = true } re_web_server = { path = "../re_web_server", optional = true } + +eframe = { verison = "0.20", default-features = false, optional = true } webbrowser = { version = "0.8", optional = true } # Native dependencies: diff --git a/crates/rerun_sdk/examples/log_rects.rs b/crates/rerun_sdk/examples/log_rects.rs index f641ccc62c17..47d85631d060 100644 --- a/crates/rerun_sdk/examples/log_rects.rs +++ b/crates/rerun_sdk/examples/log_rects.rs @@ -127,7 +127,10 @@ fn main() -> std::process::ExitCode { session.flush(); } else { let log_messages = session.drain_log_messages_buffer(); - rerun_sdk::viewer::show(log_messages); + if let Err(err) = rerun_sdk::viewer::show(log_messages) { + eprintln!("Failed to start viewer: {err}"); + return std::process::ExitCode::FAILURE; + } } std::process::ExitCode::SUCCESS diff --git a/crates/rerun_sdk/src/viewer.rs b/crates/rerun_sdk/src/viewer.rs index 9209445a6dcc..d89b77827197 100644 --- a/crates/rerun_sdk/src/viewer.rs +++ b/crates/rerun_sdk/src/viewer.rs @@ -1,7 +1,7 @@ use re_log_types::LogMsg; #[cfg(feature = "re_viewer")] -pub fn show(log_messages: Vec) { +pub fn show(log_messages: Vec) -> eframe::Result<()> { let startup_options = re_viewer::StartupOptions::default(); - re_viewer::run_native_viewer_with_messages(startup_options, log_messages); + re_viewer::run_native_viewer_with_messages(startup_options, log_messages) } diff --git a/rerun_py/src/python_bridge.rs b/rerun_py/src/python_bridge.rs index 466241e89413..6a486f67ba33 100644 --- a/rerun_py/src/python_bridge.rs +++ b/rerun_py/src/python_bridge.rs @@ -356,11 +356,11 @@ fn show() -> PyResult<()> { if log_messages.is_empty() { re_log::info!("Nothing logged, so nothing to show"); + Ok(()) } else { - rerun_sdk::viewer::show(log_messages); + rerun_sdk::viewer::show(log_messages) + .map_err(|err| PyRuntimeError::new_err(format!("Failed to show Rerun Viewer: {err}"))) } - - Ok(()) } #[pyfunction]