Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the unknown view class text #8302

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -24,7 +25,7 @@ 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()
"Placeholder view for unknown space view class".to_owned()
}

fn on_register(
Expand All @@ -48,13 +49,27 @@ impl SpaceViewClass for SpaceViewClassPlaceholder {

fn ui(
&self,
ctx: &ViewerContext<'_>,
_ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
_state: &mut dyn SpaceViewState,
_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.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(())
}
Expand Down
Loading