Skip to content

Commit

Permalink
Normalise various text strings in UI (#2902)
Browse files Browse the repository at this point in the history
### What

Normalises various text strings as per #2724. The writing rules are now
made explicit in `design/writing_rules.md`.

Fixes #2724

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2902) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2902)
- [Docs preview](https://rerun.io/preview/pr%3Aantoine%2Ffix-texts/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aantoine%2Ffix-texts/examples)
  • Loading branch information
abey79 authored Aug 4, 2023
1 parent db248e9 commit 30f8ea0
Show file tree
Hide file tree
Showing 27 changed files with 100 additions and 91 deletions.
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");
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
8 changes: 4 additions & 4 deletions crates/re_log_types/src/data_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl DataCell {
/// Builds a new `DataCell` from a uniform iterable of native component values.
///
/// Fails if the given iterable cannot be serialized to arrow, which should never happen when
/// using Rerun's builtin components.
/// using Rerun's built-in components.
#[inline]
pub fn try_from_native<'a, C>(
values: impl IntoIterator<Item = impl Into<::std::borrow::Cow<'a, C>>>,
Expand All @@ -167,7 +167,7 @@ impl DataCell {
/// Builds a new `DataCell` from a uniform iterable of native component values.
///
/// Fails if the given iterable cannot be serialized to arrow, which should never happen when
/// using Rerun's builtin components.
/// using Rerun's built-in components.
#[inline]
pub fn try_from_native_sparse<'a, C>(
values: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, C>>>>,
Expand All @@ -184,7 +184,7 @@ impl DataCell {
/// Builds a new `DataCell` from a uniform iterable of native component values.
///
/// Panics if the given iterable cannot be serialized to arrow, which should never happen when
/// using Rerun's builtin components.
/// using Rerun's built-in components.
/// See [`Self::try_from_native`] for the fallible alternative.
#[inline]
pub fn from_native<'a, C>(
Expand All @@ -199,7 +199,7 @@ impl DataCell {
/// Builds a new `DataCell` from a uniform iterable of native component values.
///
/// Panics if the given iterable cannot be serialized to arrow, which should never happen when
/// using Rerun's builtin components.
/// using Rerun's built-in components.
/// See [`Self::try_from_native`] for the fallible alternative.
#[inline]
pub fn from_native_sparse<'a, C>(
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/shader/global_bindings.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct FrameUniformBuffer {
camera_forward: Vec3,

/// How many pixels there are per point.
/// I.e. the ui scaling factor.
/// I.e. the UI zoom factor.
pixels_from_point: f32,

/// (tan(fov_y / 2) * aspect_ratio, tan(fov_y /2)), i.e. half ratio of screen dimension to screen distance in x & y.
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/src/global_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct FrameUniformBuffer {
pub camera_forward: glam::Vec3,

/// How many pixels there are per point.
/// I.e. the ui scaling factor.
/// I.e. the UI zoom factor
pub pixels_from_point: f32,

/// (tan(fov_y / 2) * aspect_ratio, tan(fov_y /2)), i.e. half ratio of screen dimension to screen distance in x & y.
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/src/view_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub struct TargetConfiguration {

/// How many pixels are there per point.
///
/// I.e. the ui scaling factor.
/// I.e. the UI zoom factor.
/// Note that this does not affect any of the camera & projection properties and is only used
/// whenever point sizes were explicitly specified.
pub pixels_from_point: f32,
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
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/src/picking.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Handles picking in 2D & 3D spaces.
//! Handles picking in 2D and 3D spaces.
use ahash::HashSet;
use re_data_store::InstancePathHash;
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 dimension slider")
} else {
response.on_hover_text("Show selector ui in the Space View.")
response.on_hover_text("Show dimension slider")
};
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
4 changes: 2 additions & 2 deletions crates/re_types/definitions/fbs/attributes.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace fbs.attributes;
/// In unions, this effectively defines the arrow tag of each variant, since the tag depends on the
/// fields's order in the datatype!
///
/// NOTE: We do not use flatbuffers' builtin `id` attribute as it only works on `table`s, whereas we
/// NOTE: We do not use flatbuffers' built-in `id` attribute as it only works on `table`s, whereas we
/// need a stable order for all kinds of things.
attribute "order";

Expand All @@ -34,7 +34,7 @@ attribute "transparent";
/// If specified on a field, the field becomes nullable, which affects both its native as well as
/// its arrow datatypes.
///
/// NOTE: We do not use flatbuffers' builtin `required` attribute because A) it has many
/// NOTE: We do not use flatbuffers' built-in `required` attribute because A) it has many
/// limitations that do not make sense for our use case and B) our overall data model is built
/// around the idea of nullability, rather than requirements (i.e. the exact opposite).
attribute "nullable";
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions crates/re_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub trait Loggable: Sized {
/// The Arrow array's datatype will match [`Loggable::to_arrow_datatype`].
///
/// Panics on failure.
/// This will _never_ fail for Rerun's builtin [`Loggable`]s.
/// This will _never_ fail for Rerun's built-in [`Loggable`]s.
///
/// For the fallible version, see [`Loggable::try_to_arrow`].
#[inline]
Expand All @@ -110,7 +110,7 @@ pub trait Loggable: Sized {
/// them into an Arrow array.
/// The Arrow array's datatype will match [`Loggable::to_arrow_datatype`].
///
/// This will _never_ fail for Rerun's builtin [`Loggable`].
/// This will _never_ fail for Rerun's built-in [`Loggable`].
/// For the non-fallible version, see [`Loggable::to_arrow`].
#[inline]
fn try_to_arrow<'a>(
Expand All @@ -128,7 +128,7 @@ pub trait Loggable: Sized {
/// The Arrow array's datatype will match [`Loggable::to_arrow_datatype`].
///
/// Panics on failure.
/// This will _never_ fail for Rerun's builtin [`Loggable`].
/// This will _never_ fail for Rerun's built-in [`Loggable`].
///
/// For the fallible version, see [`Loggable::try_to_arrow_opt`].
#[inline]
Expand All @@ -146,7 +146,7 @@ pub trait Loggable: Sized {
/// [`Loggable`], serializes them into an Arrow array.
/// The Arrow array's datatype will match [`Loggable::to_arrow_datatype`].
///
/// This will _never_ fail for Rerun's builtin [`Loggable`].
/// This will _never_ fail for Rerun's built-in [`Loggable`].
/// For the non-fallible version, see [`Loggable::to_arrow_opt`].
fn try_to_arrow_opt<'a>(
data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>,
Expand Down Expand Up @@ -278,7 +278,7 @@ pub trait Archetype {
/// Serializes all non-null [`Component`]s of this [`Archetype`] into Arrow arrays.
///
/// Panics on failure.
/// This can _never_ fail for Rerun's builtin archetypes.
/// This can _never_ fail for Rerun's built-in archetypes.
///
/// For the fallible version, see [`Archetype::try_to_arrow`].
#[inline]
Expand All @@ -288,7 +288,7 @@ pub trait Archetype {

/// Serializes all non-null [`Component`]s of this [`Archetype`] into Arrow arrays.
///
/// This can _never_ fail for Rerun's builtin archetypes.
/// This can _never_ fail for Rerun's built-in archetypes.
/// For the non-fallible version, see [`Archetype::to_arrow`].
fn try_to_arrow(
&self,
Expand Down
24 changes: 11 additions & 13 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,33 +98,31 @@ impl UICommand {
),

UICommand::ToggleMemoryPanel => (
"Toggle memory panel",
"Investigate what is using up RAM in Rerun Viewer",
"Toggle Memory Panel",
"View and track current RAM usage inside Rerun Viewer",
),
UICommand::ToggleBlueprintPanel => ("Toggle blueprint panel", "Toggle the left panel"),
UICommand::ToggleSelectionPanel => ("Toggle selection panel", "Toggle the right panel"),
UICommand::ToggleTimePanel => ("Toggle time panel", "Toggle the bottom time panel"),
UICommand::ToggleBlueprintPanel => ("Toggle Blueprint Panel", "Toggle the left panel"),
UICommand::ToggleSelectionPanel => ("Toggle Selection Panel", "Toggle the right panel"),
UICommand::ToggleTimePanel => ("Toggle Time Panel", "Toggle the bottom panel"),

#[cfg(not(target_arch = "wasm32"))]
UICommand::ToggleFullscreen => (
"Toggle fullscreen",
"Toggle between windowed and fullscreen viewer",
),
#[cfg(not(target_arch = "wasm32"))]
UICommand::ZoomIn => ("Zoom In", "Increases the ui scaling factor"),
UICommand::ZoomIn => ("Zoom In", "Increases the UI zoom level"),
#[cfg(not(target_arch = "wasm32"))]
UICommand::ZoomOut => ("Zoom Out", "Decreases the ui scaling factor"),
UICommand::ZoomOut => ("Zoom Out", "Decreases the UI zoom level"),
#[cfg(not(target_arch = "wasm32"))]
UICommand::ZoomReset => (
"Reset Zoom",
"Resets ui scaling factor to the OS provided default",
"Resets the UI zoom level to the operating system's default value",
),

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")
}
UICommand::ToggleCommandPalette => ("Command Palette…", "Toggle the Command Palette"),

UICommand::PlaybackTogglePlayPause => {
("Toggle play/pause", "Either play or pause the time")
Expand Down
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -167,7 +167,7 @@ impl App {
populate_space_view_class_registry_with_builtin(&mut space_view_class_registry)
{
re_log::error!(
"Failed to populate space view type registry with builtin space views: {}",
"Failed to populate Space View type registry with built-in Space Views: {}",
err
);
}
Expand Down
Loading

0 comments on commit 30f8ea0

Please sign in to comment.