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

Normalize various text string in UI #2902

Merged
merged 9 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions crates/re_data_ui/src/annotation_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn color_ui(ui: &mut egui::Ui, info: &AnnotationInfo, size: Vec2) {
color_picker::show_color(ui, color, size);
if info.color.is_none() {
ui.weak("(auto)")
.on_hover_text("Color chosen automatically, since it was not logged.");
.on_hover_text("Color chosen automatically, since it was not logged");
}
});
}
Expand All @@ -273,6 +273,6 @@ fn small_color_ui(ui: &mut egui::Ui, info: &AnnotationInfo) {
let response = color_picker::show_color(ui, color, size);

if info.color.is_none() {
response.on_hover_text("Color chosen automatically, since it was not logged.");
response.on_hover_text("Color chosen automatically, since it was not logged");
}
}
8 changes: 4 additions & 4 deletions crates/re_data_ui/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ pub fn tensor_summary_ui_grid_contents(

re_ui
.grid_left_hand_label(ui, "Data type")
.on_hover_text("Data type used for all individual elements within the tensor.");
.on_hover_text("Data type used for all individual elements within the tensor");
ui.label(tensor.dtype().to_string());
ui.end_row();

re_ui
.grid_left_hand_label(ui, "Shape")
.on_hover_text("Extent of every dimension.");
.on_hover_text("Extent of every dimension");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a lint for this in scripts/lint.py!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I got lazy because linting rust with regex is rather annoying. How do you feel about putting in place some (syn-based?) rust-based rust lint?

ui.vertical(|ui| {
// For unnamed tensor dimension more than a single line usually doesn't make sense!
// But what if some are named and some are not?
Expand Down Expand Up @@ -294,7 +294,7 @@ pub fn tensor_summary_ui_grid_contents(

if let Some((min, max)) = range {
ui.label("Data range")
.on_hover_text("All values of the tensor range within these bounds.");
.on_hover_text("All values of the tensor range within these bounds");
ui.monospace(format!(
"[{} - {}]",
re_format::format_f64(*min),
Expand All @@ -305,7 +305,7 @@ pub fn tensor_summary_ui_grid_contents(
// Show finite range only if it is different from the actual range.
if let (true, Some((min, max))) = (range != finite_range, finite_range) {
ui.label("Finite data range")
.on_hover_text("The finite values (ignoring all NaN & -Inf/+Inf) of the tensor range within these bounds.");
.on_hover_text("The finite values (ignoring all NaN & -Inf/+Inf) of the tensor range within these bounds");
ui.monospace(format!(
"[{} - {}]",
re_format::format_f64(*min),
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view/src/empty_space_view_state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use re_viewer_context::SpaceViewState;

/// Space view state without any contents.
/// Space View state without any contents.
#[derive(Default)]
pub struct EmptySpaceViewState;

Expand Down
18 changes: 9 additions & 9 deletions crates/re_space_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl SpatialSpaceViewState {
);
});
ui.label("Point radius")
.on_hover_text("Point radius used whenever not explicitly specified.");
.on_hover_text("Point radius used whenever not explicitly specified");
});
ui.horizontal(|ui| {
ui.push_id("lines", |ui| {
Expand All @@ -163,14 +163,14 @@ impl SpatialSpaceViewState {
&mut self.auto_size_config.line_radius,
);
ui.label("Line radius")
.on_hover_text("Line radius used whenever not explicitly specified.");
.on_hover_text("Line radius used whenever not explicitly specified");
});
});
});
ui.end_row();

ctx.re_ui.grid_left_hand_label(ui, "Camera")
.on_hover_text("The virtual camera which controls what is shown on screen.");
.on_hover_text("The virtual camera which controls what is shown on screen");
ui.vertical(|ui| {
if spatial_kind == SpatialSpaceViewKind::ThreeD {
if ui.button("Reset").on_hover_text(
Expand All @@ -180,14 +180,14 @@ impl SpatialSpaceViewState {
self.state_3d.reset_camera(&self.scene_bbox_accum, &view_coordinates);
}
re_ui.checkbox(ui, &mut self.state_3d.spin, "Spin")
.on_hover_text("Spin camera around the orbit center.");
.on_hover_text("Spin camera around the orbit center");
}
});
ui.end_row();

if spatial_kind == SpatialSpaceViewKind::ThreeD {
ctx.re_ui.grid_left_hand_label(ui, "Coordinates")
.on_hover_text("The world coordinate system used for this view.");
.on_hover_text("The world coordinate system used for this view");
ui.vertical(|ui|{
let up_description = if let Some(up) = view_coordinates.and_then(|v| v.up()) {
format!("Up is {up}")
Expand All @@ -210,7 +210,7 @@ impl SpatialSpaceViewState {
}

ctx.re_ui.grid_left_hand_label(ui, "Bounding box")
.on_hover_text("The bounding box encompassing all Entities in the view right now.");
.on_hover_text("The bounding box encompassing all Entities in the view right now");
ui.vertical(|ui| {
ui.style_mut().wrap = Some(false);
let BoundingBox { min, max } = self.scene_bbox;
Expand Down Expand Up @@ -261,11 +261,11 @@ fn size_ui(
ui.set_min_width(64.0);

ui.selectable_value(&mut mode, AutoSizeUnit::Auto, AutoSizeUnit::Auto)
.on_hover_text("Determine automatically.");
.on_hover_text("Determine automatically");
ui.selectable_value(&mut mode, AutoSizeUnit::UiPoints, AutoSizeUnit::UiPoints)
.on_hover_text("Manual in UI points.");
.on_hover_text("Manual in UI points");
ui.selectable_value(&mut mode, AutoSizeUnit::World, AutoSizeUnit::World)
.on_hover_text("Manual in scene units.");
.on_hover_text("Manual in scene units");
});
if mode != mode_before {
*size = match mode {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_space_view_tensor/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ impl PerTensorState {
self.slice.dim_mapping != default_mapping,
egui::Button::new("Reset mapping"),
)
.on_disabled_hover_text("The default is already set up.")
.on_hover_text("Reset dimension mapping to the default.")
.on_disabled_hover_text("The default is already set up")
.on_hover_text("Reset dimension mapping to the default")
.clicked()
{
self.slice.dim_mapping = DimensionMapping::create(tensor.shape());
Expand Down
4 changes: 2 additions & 2 deletions crates/re_space_view_tensor/src/tensor_dimension_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ pub fn dimension_mapping_ui(

let response = re_ui.visibility_toggle_button(ui, &mut selector.visible);
if selector.visible {
response.on_hover_text("Hide selector ui from the Space View.")
response.on_hover_text("Hide selector ui from the Space View")
abey79 marked this conversation as resolved.
Show resolved Hide resolved
} else {
response.on_hover_text("Show selector ui in the Space View.")
response.on_hover_text("Show selector ui in the Space View")
};
ui.end_row();
}
Expand Down
4 changes: 2 additions & 2 deletions crates/re_time_panel/src/time_control_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl TimeControlUi {
.speed(1)
.clamp_range(0.0..=f32::INFINITY),
)
.on_hover_text("Frames Per Second");
.on_hover_text("Frames per second");
});
time_control.set_fps(fps);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ impl TimeControlUi {
.speed(drag_speed)
.suffix("x"),
)
.on_hover_text("Playback speed.");
.on_hover_text("Playback speed");
});

time_control.set_speed(speed);
Expand Down
2 changes: 1 addition & 1 deletion crates/re_time_panel/src/time_selection_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn loop_selection_ui(
} else {
// inactive - show a tooltip at least:
ui.interact(rect, middle_id, egui::Sense::hover())
.on_hover_text("Click the loop button to turn on the loop selection, or use shift-drag to select a new loop selection.");
.on_hover_text("Click the loop button to turn on the loop selection, or use shift-drag to select a new loop selection");
}
}

Expand Down
8 changes: 4 additions & 4 deletions crates/re_ui/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl UICommand {
UICommand::Quit => ("Quit", "Close the Rerun Viewer"),

UICommand::ResetViewer => (
"Reset viewer",
"Reset the viewer to how it looked the first time you ran it",
"Reset Viewer",
"Reset the Viewer to how it looked the first time you ran it",
),

#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -98,7 +98,7 @@ impl UICommand {
),

UICommand::ToggleMemoryPanel => (
"Toggle memory panel",
"Toggle Memory Panel",
"Investigate what is using up RAM in Rerun Viewer",
abey79 marked this conversation as resolved.
Show resolved Hide resolved
),
UICommand::ToggleBlueprintPanel => ("Toggle blueprint panel", "Toggle the left panel"),
Expand All @@ -123,7 +123,7 @@ impl UICommand {
UICommand::SelectionPrevious => ("Previous selection", "Go to previous selection"),
UICommand::SelectionNext => ("Next selection", "Go to next selection"),
UICommand::ToggleCommandPalette => {
("Command palette…", "Toggle the command palette window")
abey79 marked this conversation as resolved.
Show resolved Hide resolved
("Command Palette…", "Toggle the command palette window")
}

UICommand::PlaybackTogglePlayPause => {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const MIN_ZOOM_FACTOR: f32 = 0.2;
#[cfg(not(target_arch = "wasm32"))]
const MAX_ZOOM_FACTOR: f32 = 4.0;

/// The Rerun viewer as an [`eframe`] application.
/// The Rerun Viewer as an [`eframe`] application.
pub struct App {
build_info: re_build_info::BuildInfo,
startup_options: StartupOptions,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/blueprint_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn title_bar_ui(
.show_inside(ui, |ui| {
ui.horizontal_centered(|ui| {
ui.strong("Blueprint")
.on_hover_text("The Blueprint is where you can configure the Rerun Viewer.");
.on_hover_text("The Blueprint is where you can configure the Rerun Viewer");

ui.allocate_ui_with_layout(
ui.available_size_before_wrap(),
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/ui/memory_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl MemoryPanel {

if let Some(counted) = mem_use.counted {
ui.label(format!("counted: {}", format_bytes(counted as _)))
.on_hover_text("Live bytes, counted by our own allocator.");
.on_hover_text("Live bytes, counted by our own allocator");
} else if cfg!(debug_assertions) {
ui.label("Memory-tracking allocator not installed.");
}
Expand All @@ -137,7 +137,7 @@ impl MemoryPanel {
&mut is_tracking_callstacks,
"Detailed allocation tracking",
)
.on_hover_text("This will slow down the program.");
.on_hover_text("This will slow down the program");
re_memory::accounting_allocator::set_tracking_callstacks(is_tracking_callstacks);

if let Some(tracking_stats) = re_memory::accounting_allocator::tracking_stats() {
Expand Down
8 changes: 4 additions & 4 deletions crates/re_viewer/src/ui/rerun_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl App {
// On the web the browser controls the zoom
let zoom_factor = self.app_options().zoom_factor;
ui.weak(format!("Zoom {:.0}%", zoom_factor * 100.0))
.on_hover_text("The zoom factor applied on top of the OS scaling factor.");
.on_hover_text("The zoom factor applied on top of the OS scaling factor");
abey79 marked this conversation as resolved.
Show resolved Hide resolved
UICommand::ZoomIn.menu_button_ui(ui, &self.command_sender);
UICommand::ZoomOut.menu_button_ui(ui, &self.command_sender);
ui.add_enabled_ui(zoom_factor != 1.0, |ui| {
Expand Down Expand Up @@ -180,7 +180,7 @@ impl App {
&mut self.state.app_options.show_metrics,
"Show performance metrics",
)
.on_hover_text("Show metrics for milliseconds/frame and RAM usage in the top bar.")
.on_hover_text("Show metrics for milliseconds/frame and RAM usage in the top bar")
.clicked()
{
ui.close_menu();
Expand Down Expand Up @@ -290,11 +290,11 @@ impl App {
&mut debug.show_interactive_widgets,
"Show interactive widgets",
)
.on_hover_text("Show an overlay on all interactive widgets.")
.on_hover_text("Show an overlay on all interactive widgets")
.changed();
any_clicked |= re_ui
.checkbox(ui, &mut debug.show_blocking_widget, "Show blocking widgets")
.on_hover_text("Show what widget blocks the interaction of another widget.")
.on_hover_text("Show what widget blocks the interaction of another widget")
.changed();

if any_clicked {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/selection_history_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl SelectionHistoryUi {
history: &mut SelectionHistory,
) -> Option<ItemCollection> {
ui.horizontal_centered(|ui| {
ui.strong("Selection").on_hover_text("The Selection View contains information and options about the currently selected object(s).");
ui.strong("Selection").on_hover_text("The Selection View contains information and options about the currently selected object(s)");

// TODO(emilk): an egui helper for right-to-left
ui.allocate_ui_with_layout(
Expand Down
30 changes: 15 additions & 15 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ fn what_is_selected_ui(
egui::Grid::new("component_path")
.num_columns(2)
.show(ui, |ui| {
ui.label("Entity:");
ui.label("Entity");
item_ui::entity_path_button(ctx, ui, None, entity_path);
ui.end_row();

ui.label("Component:");
ui.label("Component");
ui.label(component_name.short_name())
.on_hover_text(component_name.full_name());
ui.end_row();
Expand All @@ -149,24 +149,24 @@ fn what_is_selected_ui(
Item::SpaceView(space_view_id) => {
if let Some(space_view) = viewport.space_view_mut(space_view_id) {
ui.horizontal(|ui| {
ui.label("Space view:");
ui.label("Space View");
ui.text_edit_singleline(&mut space_view.display_name);
});
}
}
Item::InstancePath(space_view_id, instance_path) => {
egui::Grid::new("space_view_id_entity_path").show(ui, |ui| {
if instance_path.instance_key.is_splat() {
ui.label("Entity:");
ui.label("Entity");
} else {
ui.label("Entity instance:");
ui.label("Entity instance");
}
item_ui::instance_path_button(ctx, ui, *space_view_id, instance_path);
ui.end_row();

if let Some(space_view_id) = space_view_id {
if let Some(space_view) = viewport.space_view_mut(space_view_id) {
ui.label("in Space View:");
abey79 marked this conversation as resolved.
Show resolved Hide resolved
ui.label("in Space View");
re_viewport::item_ui::space_view_button(ctx, ui, space_view);
ui.end_row();
}
Expand All @@ -182,7 +182,7 @@ fn what_is_selected_ui(
egui::Grid::new("data_blueprint_group")
.num_columns(2)
.show(ui, |ui| {
ui.label("Data Group:");
ui.label("Data Group");
item_ui::data_blueprint_group_button_to(
ctx,
ui,
Expand All @@ -192,7 +192,7 @@ fn what_is_selected_ui(
);
ui.end_row();

ui.label("in Space View:");
abey79 marked this conversation as resolved.
Show resolved Hide resolved
ui.label("in Space View");
re_viewport::item_ui::space_view_button(ctx, ui, space_view);
ui.end_row();
});
Expand Down Expand Up @@ -222,16 +222,16 @@ fn blueprint_ui(
Item::SpaceView(space_view_id) => {
ui.horizontal(|ui| {
if ui
.button("Add/remove entities")
.on_hover_text("Manually add or remove entities from the Space View.")
.button("Add/remove Entities")
.on_hover_text("Manually add or remove Entities from the Space View")
.clicked()
{
viewport
.show_add_remove_entities_window(*space_view_id);
}

if ui
.button("Clone view")
.button("Clone Space View")
.on_hover_text("Create an exact duplicate of this Space View including all blueprint settings")
abey79 marked this conversation as resolved.
Show resolved Hide resolved
.clicked()
{
Expand Down Expand Up @@ -324,7 +324,7 @@ fn list_existing_data_blueprints(
ui.weak("(Not shown in any Space View)");
// TODO(andreas): Offer options for adding?
} else {
ui.label("Is shown in:");
ui.label("Is shown in");

ui.indent("list of data blueprints indent", |ui| {
for space_view_id in &space_views_with_path {
Expand Down Expand Up @@ -369,7 +369,7 @@ fn entity_props_ui(
.speed(speed)
.suffix("s"),
)
.on_hover_text("Include this much history of the Entity in the Space View.");
.on_hover_text("Include this much history of the Entity in the Space View");
visible_history.nanos = (time_sec * 1e9).round() as _;
}
TimeType::Sequence => {
Expand All @@ -379,7 +379,7 @@ fn entity_props_ui(
.clamp_range(0.0..=f32::INFINITY)
.speed(speed),
)
.on_hover_text("Include this much history of the Entity in the Space View.");
.on_hover_text("Include this much history of the Entity in the Space View");
}
}
ui.end_row();
Expand Down Expand Up @@ -446,7 +446,7 @@ fn pinhole_props_ui(
.clamp_range(0.0..=1.0e8)
.speed(speed),
)
.on_hover_text("Controls how far away the image plane is.")
.on_hover_text("Controls how far away the image plane is")
.changed()
{
entity_props.pinhole_image_plane_distance = EditableAutoValue::UserEdited(distance);
Expand Down
Loading