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

Allow setting view visibility from blueprint api #6108

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion crates/re_types_builder/src/codegen/python/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub fn code_for_view(reporter: &Reporter, objects: &Objects, obj: &Object) -> St
from .. import archetypes as blueprint_archetypes
from .. import components as blueprint_components
from ... import datatypes
from ... import components
from ..._baseclasses import AsComponents
from ...datatypes import EntityPathLike, Utf8Like
from ..api import SpaceView, SpaceViewContentsLike
Expand All @@ -39,6 +40,7 @@ fn init_method(reporter: &Reporter, objects: &Objects, obj: &Object) -> String {
origin: EntityPathLike = "/",
contents: SpaceViewContentsLike = "$origin/**",
name: Utf8Like | None = None,
visible: blueprint_components.VisibleLike | None = None,
"#
.to_owned();

Expand Down Expand Up @@ -100,6 +102,13 @@ See [rerun.blueprint.archetypes.SpaceViewContents][]."
.to_owned(),
),
("name", "The display name of the view.".to_owned()),
(
"visible",
"Whether this view is visible.

Defaults to true if not specified."
.to_owned(),
),
];
for field in &obj.fields {
let doc_content = field.docs.doc_lines_for_untagged_and("py");
Expand Down Expand Up @@ -165,7 +174,7 @@ See [rerun.blueprint.archetypes.SpaceViewContents][]."
}
code.push_indented(
1,
&format!(r#"super().__init__(class_identifier="{identifier}", origin=origin, contents=contents, name=name, properties=properties)"#),
&format!(r#"super().__init__(class_identifier="{identifier}", origin=origin, contents=contents, name=name, visible=visible, properties=properties)"#),
1,
);

Expand Down
9 changes: 8 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ..notebook import as_html
from ..recording_stream import RecordingStream
from .archetypes import ContainerBlueprint, PanelBlueprint, SpaceViewBlueprint, SpaceViewContents, ViewportBlueprint
from .components import ColumnShareArrayLike, RowShareArrayLike
from .components import ColumnShareArrayLike, RowShareArrayLike, VisibleLike
from .components.container_kind import ContainerKindLike

SpaceViewContentsLike = Union[Utf8ArrayLike, SpaceViewContents]
Expand Down Expand Up @@ -42,6 +42,7 @@ def __init__(
origin: EntityPathLike,
contents: SpaceViewContentsLike,
name: Utf8Like | None,
visible: VisibleLike | None = None,
properties: dict[str, AsComponents] = {},
):
"""
Expand All @@ -60,6 +61,10 @@ def __init__(
contents
The contents of the space view specified as a query expression. This is either a single expression,
or a list of multiple expressions. See [rerun.blueprint.archetypes.SpaceViewContents][].
visible:
Whether this space view is visible.

Defaults to true if not specified.
properties
Dictionary of property archetypes to add to space view's internal hierarchy.

Expand All @@ -69,6 +74,7 @@ def __init__(
self.name = name
self.origin = origin
self.contents = contents
self.visible = visible
self.properties = properties

def blueprint_path(self) -> str:
Expand Down Expand Up @@ -105,6 +111,7 @@ def _log_to_stream(self, stream: RecordingStream) -> None:
class_identifier=self.class_identifier,
display_name=self.name,
space_origin=self.origin,
visible=self.visible,
)

stream.log(self.blueprint_path(), arch, recording=stream) # type: ignore[attr-defined]
Expand Down
13 changes: 12 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/bar_chart_view.py

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

10 changes: 9 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/spatial2d_view.py

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

9 changes: 8 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/spatial3d_view.py

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

15 changes: 14 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/tensor_view.py

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

13 changes: 12 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/text_document_view.py

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

15 changes: 14 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/text_log_view.py

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

13 changes: 12 additions & 1 deletion rerun_py/rerun_sdk/rerun/blueprint/views/time_series_view.py

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

Loading