-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the remaining space views and name them consistently (#5498)
### What Just lots of boiler plate with some name changes. Also split the apy.py file into a few sub-modules because it was getting large. All SpaceViews now end in View. - Spatial2DView - Spatial3DView - BarChartView - TensorView - TextDocumentView - TextLogView - TimeSeriesView Testing it out on the plots example: ![image](https://github.com/rerun-io/rerun/assets/3312232/97890949-de50-464e-b640-014f151177b5) ### 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 the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5498/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5498/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5498/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5498) - [Docs preview](https://rerun.io/preview/bcbce7510db61092c96237a2668518ba564f0227/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/bcbce7510db61092c96237a2668518ba564f0227/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
- Loading branch information
Showing
6 changed files
with
317 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
from .api import Container, SpaceView | ||
from .components import ColumnShareArrayLike, RowShareArrayLike | ||
from .components.container_kind import ContainerKind | ||
|
||
|
||
class Horizontal(Container): | ||
"""A horizontal container.""" | ||
|
||
def __init__(self, *contents: Container | SpaceView, column_shares: Optional[ColumnShareArrayLike] = None): | ||
""" | ||
Construct a new horizontal container. | ||
Parameters | ||
---------- | ||
*contents: | ||
All positional arguments are the contents of the container, which may be either other containers or space views. | ||
column_shares | ||
The layout shares of the columns in the container. The share is used to determine what fraction of the total width each | ||
column should take up. The column with index `i` will take up the fraction `shares[i] / total_shares`. | ||
""" | ||
super().__init__(*contents, kind=ContainerKind.Horizontal, column_shares=column_shares) | ||
|
||
|
||
class Vertical(Container): | ||
"""A vertical container.""" | ||
|
||
def __init__(self, *contents: Container | SpaceView, row_shares: Optional[RowShareArrayLike] = None): | ||
""" | ||
Construct a new vertical container. | ||
Parameters | ||
---------- | ||
*contents: | ||
All positional arguments are the contents of the container, which may be either other containers or space views. | ||
row_shares | ||
The layout shares of the rows in the container. The share is used to determine what fraction of the total height each | ||
row should take up. The ros with index `i` will take up the fraction `shares[i] / total_shares`. | ||
""" | ||
super().__init__(*contents, kind=ContainerKind.Vertical, row_shares=row_shares) | ||
|
||
|
||
class Grid(Container): | ||
"""A grid container.""" | ||
|
||
def __init__( | ||
self, | ||
*contents: Container | SpaceView, | ||
column_shares: Optional[ColumnShareArrayLike] = None, | ||
row_shares: Optional[RowShareArrayLike] = None, | ||
grid_columns: Optional[int] = None, | ||
): | ||
""" | ||
Construct a new grid container. | ||
Parameters | ||
---------- | ||
*contents: | ||
All positional arguments are the contents of the container, which may be either other containers or space views. | ||
column_shares | ||
The layout shares of the columns in the container. The share is used to determine what fraction of the total width each | ||
column should take up. The column with index `i` will take up the fraction `shares[i] / total_shares`. | ||
row_shares | ||
The layout shares of the rows in the container. The share is used to determine what fraction of the total height each | ||
row should take up. The ros with index `i` will take up the fraction `shares[i] / total_shares`. | ||
grid_columns | ||
The number of columns in the grid. | ||
""" | ||
super().__init__( | ||
*contents, | ||
kind=ContainerKind.Grid, | ||
column_shares=column_shares, | ||
row_shares=row_shares, | ||
grid_columns=grid_columns, | ||
) | ||
|
||
|
||
class Tabs(Container): | ||
"""A tab container.""" | ||
|
||
def __init__(self, *contents: Container | SpaceView): | ||
""" | ||
Construct a new tab container. | ||
Parameters | ||
---------- | ||
*contents: | ||
All positional arguments are the contents of the container, which may be either other containers or space views. | ||
""" | ||
super().__init__(*contents, kind=ContainerKind.Tabs) |
Oops, something went wrong.