Skip to content

Commit

Permalink
New TextLog archetype (#3261)
Browse files Browse the repository at this point in the history
### What
* Part of #2793

Adds
* component `TextLogLevel`
* archetype `TextLog`

### 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/3261) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3261)
- [Docs
preview](https://rerun.io/preview/6b7d5facdeb2da0d3a04b52788e5ac42e472ae7b/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/6b7d5facdeb2da0d3a04b52788e5ac42e472ae7b/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
  • Loading branch information
emilk authored Sep 10, 2023
1 parent f525a91 commit 13b5039
Show file tree
Hide file tree
Showing 383 changed files with 1,710 additions and 770 deletions.
29 changes: 19 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ re_space_view = { path = "crates/re_space_view", version = "=0.9.0-alpha.3", def
re_space_view_bar_chart = { path = "crates/re_space_view_bar_chart", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_spatial = { path = "crates/re_space_view_spatial", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_tensor = { path = "crates/re_space_view_tensor", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text = { path = "crates/re_space_view_text", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text_log = { path = "crates/re_space_view_text_log", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text_document = { path = "crates/re_space_view_text_document", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_time_series = { path = "crates/re_space_view_time_series", version = "=0.9.0-alpha.3", default-features = false }
re_string_interner = { path = "crates/re_string_interner", version = "=0.9.0-alpha.3", default-features = false }
Expand Down
5 changes: 1 addition & 4 deletions crates/re_components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ mod pinhole;
mod quaternion;
mod rect;
mod scalar;
mod text_entry;
mod vec;

mod load_file;
Expand All @@ -50,7 +49,6 @@ pub use self::{
quaternion::Quaternion,
rect::Rect2D,
scalar::{Scalar, ScalarPlotProps},
text_entry::TextEntry,
};

#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -79,7 +77,7 @@ use re_types::components::{

lazy_static! {
//TODO(john): use a run-time type registry
static ref FIELDS: [Field; 27] = [
static ref FIELDS: [Field; 26] = [
<Box3D as LegacyComponent>::field(),
<LegacyVec3D as LegacyComponent>::field(),
<Mesh3D as LegacyComponent>::field(),
Expand All @@ -88,7 +86,6 @@ lazy_static! {
<Rect2D as LegacyComponent>::field(),
<Scalar as LegacyComponent>::field(),
<ScalarPlotProps as LegacyComponent>::field(),
<TextEntry as LegacyComponent>::field(),
<ViewCoordinates as LegacyComponent>::field(),
AnnotationContext::arrow_field(),
ClassId::arrow_field(),
Expand Down
57 changes: 0 additions & 57 deletions crates/re_components/src/text_entry.rs

This file was deleted.

39 changes: 0 additions & 39 deletions crates/re_data_ui/src/component_ui_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub fn create_component_ui_registry() -> ComponentUiRegistry {
add::<re_components::Mesh3D>(&mut registry);
add::<re_components::Pinhole>(&mut registry);
add::<re_components::Rect2D>(&mut registry);
add::<re_components::TextEntry>(&mut registry);
add::<re_components::ViewCoordinates>(&mut registry);
add::<re_types::components::AnnotationContext>(&mut registry);
add::<re_types::components::ClassId>(&mut registry);
Expand Down Expand Up @@ -83,44 +82,6 @@ fn format_arrow(value: &dyn arrow2::array::Array) -> String {

// ----------------------------------------------------------------------------

impl DataUi for re_components::TextEntry {
fn data_ui(
&self,
_ctx: &mut ViewerContext<'_>,
ui: &mut egui::Ui,
verbosity: UiVerbosity,
_query: &re_arrow_store::LatestAtQuery,
) {
use re_viewer_context::level_to_rich_text;

let Self { body, level } = self;

match verbosity {
UiVerbosity::Small => {
ui.horizontal(|ui| {
if let Some(level) = level {
ui.label(level_to_rich_text(ui, level));
}
ui.label(format!("{body:?}")); // Debug format to get quotes and escapes
});
}
UiVerbosity::All | UiVerbosity::Reduced => {
egui::Grid::new("text_entry").num_columns(2).show(ui, |ui| {
ui.label("level:");
if let Some(level) = level {
ui.label(level_to_rich_text(ui, level));
}
ui.end_row();

ui.label("body:");
ui.label(format!("{body:?}")); // Debug format to get quotes and escapes
ui.end_row();
});
}
}
}
}

impl DataUi for re_components::Mesh3D {
fn data_ui(
&self,
Expand Down
16 changes: 16 additions & 0 deletions crates/re_log_types/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,19 @@ impl LegacyComponent for re_types::components::Point2D {
Self::name()
}
}

// TODO(emilk): required to use with `range_entity_with_primary`. remove once the migration is over
impl LegacyComponent for re_types::components::Text {
fn legacy_name() -> ComponentName {
use re_types::Loggable as _;
Self::name()
}
}

// TODO(emilk): required to use with `range_entity_with_primary`. remove once the migration is over
impl LegacyComponent for re_types::components::TextLogLevel {
fn legacy_name() -> ComponentName {
use re_types::Loggable as _;
Self::name()
}
}
6 changes: 6 additions & 0 deletions crates/re_log_types/src/time_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ impl TimeRange {
max: TimeInt::MIN,
};

/// Contains all time.
pub const EVERYTHING: Self = Self {
min: TimeInt::MIN,
max: TimeInt::MAX,
};

#[inline]
pub fn new(min: TimeInt, max: TimeInt) -> Self {
Self { min, max }
Expand Down
2 changes: 1 addition & 1 deletion crates/re_sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub mod time {
pub mod components {
pub use re_components::{
Box3D, EncodedMesh3D, Mesh3D, MeshFormat, Pinhole, Quaternion, RawMesh3D, Rect2D, Scalar,
ScalarPlotProps, TextEntry, ViewCoordinates,
ScalarPlotProps, ViewCoordinates,
};
pub use re_types::components::{
AnnotationContext, ClassId, Color, DisconnectedSpace, DrawOrder, InstanceKey, KeypointId,
Expand Down
8 changes: 0 additions & 8 deletions crates/re_space_view_text/src/lib.rs

This file was deleted.

6 changes: 3 additions & 3 deletions crates/re_space_view_text_document/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# re_space_view_text
# re_space_view_text_log

Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.

[![Latest version](https://img.shields.io/crates/v/re_space_view_text.svg)](https://crates.io/crates/re_space_view_text)
[![Documentation](https://docs.rs/re_space_view_text/badge.svg)](https://docs.rs/re_space_view_text)
[![Latest version](https://img.shields.io/crates/v/re_space_view_text_log.svg)](https://crates.io/crates/re_space_view_text_log)
[![Documentation](https://docs.rs/re_space_view_text_log/badge.svg)](https://docs.rs/re_space_view_text_log)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)

Expand Down
4 changes: 3 additions & 1 deletion crates/re_space_view_text_document/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ impl SpaceViewClass for TextDocumentSpaceView {
.auto_shrink([false, false])
.show(ui, |ui| {
// TODO(jleibs): better handling for multiple results
if text_document.text_entries.len() == 1 {
if text_document.text_entries.is_empty() {
ui.label("No TextDocument entries found.");
} else if text_document.text_entries.len() == 1 {
let mut text =
egui::RichText::new(text_document.text_entries[0].body.as_str());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "A Space View that shows text entries in a table and scrolls with
edition.workspace = true
homepage.workspace = true
license.workspace = true
name = "re_space_view_text"
name = "re_space_view_text_log"
publish = true
readme = "README.md"
repository.workspace = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# re_space_view_text
# re_space_view_text_log

Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.

[![Latest version](https://img.shields.io/crates/v/re_space_view_text.svg)](https://crates.io/crates/re_space_view_text)
[![Documentation](https://docs.rs/re_space_view_text/badge.svg)](https://docs.rs/re_space_view_text)
[![Latest version](https://img.shields.io/crates/v/re_space_view_text_log.svg)](https://crates.io/crates/re_space_view_text_log)
[![Documentation](https://docs.rs/re_space_view_text_log/badge.svg)](https://docs.rs/re_space_view_text_log)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)

Expand Down
8 changes: 8 additions & 0 deletions crates/re_space_view_text_log/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! Rerun `TextLog` Space View
//!
//! A Space View that shows `TextLog` entries in a table and scrolls with the active time.
mod space_view_class;
mod view_part_system;

pub use space_view_class::TextSpaceView;
Loading

0 comments on commit 13b5039

Please sign in to comment.