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

New TextLog archetype #3261

Merged
merged 28 commits into from
Sep 10, 2023
Merged
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
26d2fc3
Add TextLogLevel component
emilk Sep 8, 2023
7ab0852
Add TextLog archetype
emilk Sep 8, 2023
4614b4f
Add doctests and roundtrip tests for TextLog
emilk Sep 8, 2023
cb7fa26
Rename crate `re_space_view_text` -> `re_space_view_text_log`
emilk Sep 8, 2023
6f50509
Port the viewer to use the new `TextLog` archetype
emilk Sep 8, 2023
dbf947d
Port old log_text_entry
emilk Sep 8, 2023
6ce085a
Add Color to TextLog
emilk Sep 8, 2023
e5d94e7
Add more converters for Rust datatype::Color
emilk Sep 8, 2023
83545a8
Port more things to the new API
emilk Sep 8, 2023
b7a7308
Better C++ extension injection, handling strings
emilk Sep 8, 2023
620ace1
Pre-define TextLogLevel:s for Rust and C++
emilk Sep 8, 2023
3283ae8
Remove old Python TextEntry
emilk Sep 8, 2023
27746b1
Remove old text_entry_simple
emilk Sep 8, 2023
85dfc19
Avoid name clash
emilk Sep 8, 2023
489cc66
profile scopes
emilk Sep 8, 2023
15262cf
Remove old TextEntry form Rust
emilk Sep 8, 2023
ed72e5d
Fix typos
emilk Sep 8, 2023
b6b546d
Fix lint
emilk Sep 8, 2023
4aa8127
Remove dead link
emilk Sep 8, 2023
acb5b07
Extend TextLogLevelType with .INFO etc
emilk Sep 8, 2023
c4768f1
Remove old LogLevel
emilk Sep 8, 2023
edb3f6c
source_hash
emilk Sep 8, 2023
14e4ce0
C++ associated constants
emilk Sep 8, 2023
f641962
Fix C++
emilk Sep 8, 2023
d3e22d0
Remove linenumber for autogen warning
emilk Sep 8, 2023
c633daf
Remove trailing dot
emilk Sep 10, 2023
8cbdbbc
Merge branch 'main' into emilk/text-log
emilk Sep 10, 2023
6b7d5fa
Make sure the code-examples match
emilk Sep 10, 2023
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
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
@@ -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 }
5 changes: 1 addition & 4 deletions crates/re_components/src/lib.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ mod pinhole;
mod quaternion;
mod rect;
mod scalar;
mod text_entry;
mod vec;

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

#[cfg(not(target_arch = "wasm32"))]
@@ -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(),
@@ -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(),
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
@@ -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);
@@ -83,44 +82,6 @@ fn format_arrow(value: &dyn arrow2::array::Array) -> String {

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

impl DataUi for re_components::TextEntry {
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
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,
16 changes: 16 additions & 0 deletions crates/re_log_types/src/component.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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 }
2 changes: 1 addition & 1 deletion crates/re_sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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,
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)

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
@@ -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());

Original file line number Diff line number Diff line change
@@ -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
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)

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