From 8002accac1d89541f94e53db14ecf34d5bfd2fff Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Thu, 12 Sep 2024 16:35:25 +0800 Subject: [PATCH] Minor fixes Signed-off-by: Luca Della Vedova --- rmf_site_editor/examples/extending_menu.rs | 8 ++++---- .../src/widgets/inspector/inspect_asset_source.rs | 1 + rmf_site_editor/src/widgets/inspector/mod.rs | 1 - rmf_site_editor/src/widgets/view_lights.rs | 1 + rmf_site_editor/src/widgets/view_nav_graphs.rs | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rmf_site_editor/examples/extending_menu.rs b/rmf_site_editor/examples/extending_menu.rs index 82510145..7d47b343 100644 --- a/rmf_site_editor/examples/extending_menu.rs +++ b/rmf_site_editor/examples/extending_menu.rs @@ -16,7 +16,7 @@ impl FromWorld for MyMenuHandler { // We need to keep track of the entity in order to make // sure that we can check the callback let unique_export = world - .spawn(MenuItem::Text("My unique export".to_string())) + .spawn(MenuItem::Text("My unique export".into())) .id(); // Make it a child of the "File Menu" @@ -38,7 +38,7 @@ impl FromWorld for MyMenuHandler { // Finally we can create a custom action let custom_nested_menu = world - .spawn(MenuItem::Text("My Awesome Action".to_string())) + .spawn(MenuItem::Text("My Awesome Action".into())) .id(); world .entity_mut(sub_menu) @@ -56,7 +56,7 @@ impl FromWorld for MyMenuHandler { /// an event that is of the same type as the one we are supposed to /// handle. fn watch_unique_export_click(mut reader: EventReader, menu_handle: Res) { - for event in reader.iter() { + for event in reader.read() { if event.clicked() && event.source() == menu_handle.unique_export { println!("Doing our epic export"); } @@ -67,7 +67,7 @@ fn watch_unique_export_click(mut reader: EventReader, menu_handle: Re /// an event that is of the same type as the one we are supposed to /// handle. fn watch_submenu_click(mut reader: EventReader, menu_handle: Res) { - for event in reader.iter() { + for event in reader.read() { if event.clicked() && event.source() == menu_handle.custom_nested_menu { println!("Submenu clicked"); } diff --git a/rmf_site_editor/src/widgets/inspector/inspect_asset_source.rs b/rmf_site_editor/src/widgets/inspector/inspect_asset_source.rs index 8ab7abe0..cb5c8c75 100644 --- a/rmf_site_editor/src/widgets/inspector/inspect_asset_source.rs +++ b/rmf_site_editor/src/widgets/inspector/inspect_asset_source.rs @@ -144,6 +144,7 @@ impl<'a> InspectAssetSourceComponent<'a> { // Button to load from file, disabled for wasm since there are no local files #[cfg(not(target_arch = "wasm32"))] if ui.button("Browse").clicked() { + // TODO(luca) change this to use FileDialogServices and be async if let Some(file) = FileDialog::new().pick_file() { if let Some(src) = file.to_str() { if let (Some(default_file), true) = (self.default_file, is_relative) diff --git a/rmf_site_editor/src/widgets/inspector/mod.rs b/rmf_site_editor/src/widgets/inspector/mod.rs index 2f35ce9f..884d22d9 100644 --- a/rmf_site_editor/src/widgets/inspector/mod.rs +++ b/rmf_site_editor/src/widgets/inspector/mod.rs @@ -106,7 +106,6 @@ use crate::{ interaction::Selection, site::{Category, SiteID}, widgets::prelude::*, - AppState, }; use bevy::{ ecs::system::{SystemParam, SystemState}, diff --git a/rmf_site_editor/src/widgets/view_lights.rs b/rmf_site_editor/src/widgets/view_lights.rs index f5f9add2..ee3ccdbb 100644 --- a/rmf_site_editor/src/widgets/view_lights.rs +++ b/rmf_site_editor/src/widgets/view_lights.rs @@ -108,6 +108,7 @@ impl<'w, 's> ViewLights<'w, 's> { } None => { let future = AsyncComputeTaskPool::get().spawn(async move { + // TODO(luca) change this to use FileDialogServices let file = match AsyncFileDialog::new().save_file().await { Some(file) => file, None => return None, diff --git a/rmf_site_editor/src/widgets/view_nav_graphs.rs b/rmf_site_editor/src/widgets/view_nav_graphs.rs index 80f51bcf..f60e2337 100644 --- a/rmf_site_editor/src/widgets/view_nav_graphs.rs +++ b/rmf_site_editor/src/widgets/view_nav_graphs.rs @@ -215,6 +215,7 @@ impl<'w, 's> ViewNavGraphs<'w, 's> { } None => { let future = AsyncComputeTaskPool::get().spawn(async move { + // TODO(luca) change this to use FileDialogServices let file = match AsyncFileDialog::new().pick_file().await { Some(file) => file, None => return None,