From 813c6dcb1b98f16aadea36d5f86a663376837dd6 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Tue, 3 Dec 2024 16:26:42 +0100 Subject: [PATCH 1/3] Improve the unknown view class text Now hints at enabling `map_view` if a map view was expected --- .../space_view/space_view_class_placeholder.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs index 3aa10c059ac7..2fe397eb23a7 100644 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs +++ b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs @@ -24,7 +24,15 @@ impl SpaceViewClass for SpaceViewClassPlaceholder { } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { - "The space view class was not recognized.\n\nThis happens if either the blueprint specifies an invalid space view class or this version of the viewer does not know about this type.".to_owned() + "The space view class was not recognized.\n\n\ + \ + This happens if either the blueprint specifies an invalid space view class or this version \ + of the viewer does not know about \ + this type.\n\n\ + \ + **Note**: some views may require a specific Cargo feature to be enabled. In particular, \ + the map view requires the `map_view` feature." + .to_owned() } fn on_register( @@ -54,7 +62,13 @@ impl SpaceViewClass for SpaceViewClassPlaceholder { _query: &ViewQuery<'_>, _system_output: SystemExecutionOutput, ) -> Result<(), SpaceViewSystemExecutionError> { - ui.markdown_ui(&self.help_markdown(ctx.egui_ctx)); + egui::Frame { + inner_margin: egui::Margin::same(re_ui::DesignTokens::view_padding()), + ..Default::default() + } + .show(ui, |ui| { + ui.markdown_ui(&self.help_markdown(ctx.egui_ctx)); + }); Ok(()) } From ec4144726af390da43c8ff1ae75b5d70c325e5ac Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Tue, 3 Dec 2024 16:37:38 +0100 Subject: [PATCH 2/3] Now with flashier ui --- .../space_view_class_placeholder.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs index 2fe397eb23a7..a222ca424fab 100644 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs +++ b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs @@ -24,15 +24,7 @@ impl SpaceViewClass for SpaceViewClassPlaceholder { } fn help_markdown(&self, _egui_ctx: &egui::Context) -> String { - "The space view class was not recognized.\n\n\ - \ - This happens if either the blueprint specifies an invalid space view class or this version \ - of the viewer does not know about \ - this type.\n\n\ - \ - **Note**: some views may require a specific Cargo feature to be enabled. In particular, \ - the map view requires the `map_view` feature." - .to_owned() + "Placeholder view for unknown space view class".to_owned() } fn on_register( @@ -56,7 +48,7 @@ impl SpaceViewClass for SpaceViewClassPlaceholder { fn ui( &self, - ctx: &ViewerContext<'_>, + _ctx: &ViewerContext<'_>, ui: &mut egui::Ui, _state: &mut dyn SpaceViewState, _query: &ViewQuery<'_>, @@ -67,7 +59,15 @@ impl SpaceViewClass for SpaceViewClassPlaceholder { ..Default::default() } .show(ui, |ui| { - ui.markdown_ui(&self.help_markdown(ctx.egui_ctx)); + ui.warning_label("Unknown space view class"); + + ui.markdown_ui( + "This happens if either the blueprint specifies an invalid space view class or \ + this version of the viewer does not know about this type.\n\n\ + \ + **Note**: some views may require a specific Cargo feature to be enabled. In \ + particular, the map view requires the `map_view` feature.", + ); }); Ok(()) From 48e5607ea2427e8f4eef3585a9b0d914d0a4eb32 Mon Sep 17 00:00:00 2001 From: Antoine Beyeler Date: Tue, 3 Dec 2024 16:38:46 +0100 Subject: [PATCH 3/3] Civilised `use` ordering --- .../src/space_view/space_view_class_placeholder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs index a222ca424fab..40ddb42900c1 100644 --- a/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs +++ b/crates/viewer/re_viewer_context/src/space_view/space_view_class_placeholder.rs @@ -1,10 +1,11 @@ +use re_types::SpaceViewClassIdentifier; +use re_ui::UiExt; + use crate::{ SpaceViewClass, SpaceViewClassRegistryError, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewSystemExecutionError, SpaceViewSystemRegistrator, SystemExecutionOutput, ViewQuery, ViewerContext, }; -use re_types::SpaceViewClassIdentifier; -use re_ui::UiExt; /// A placeholder space view class that can be used when the actual class is not registered. #[derive(Default)]