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

Remove show from Python SDK #1429

Merged
merged 2 commits into from
Feb 28, 2023
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
19 changes: 4 additions & 15 deletions rerun_py/rerun_sdk/rerun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,14 @@ def serve(open_browser: bool = True) -> None:


def disconnect() -> None:
"""Disconnect from the remote rerun server (if any)."""
bindings.disconnect()


def show() -> None:
"""
Show previously logged data.

This only works if you have not called `connect`.

NOTE: There is a bug which causes this function to only work once on some platforms.
Closes all TCP connections, servers, and files.

Closes all TCP connections, servers, and files that have been opened with
[`rerun.connect`], [`rerun.serve`], [`rerun.save`] or [`rerun.spawn`].
"""

if not bindings.is_enabled():
print("Rerun is disabled - show() call ignored")
return

bindings.show()
bindings.disconnect()


def save(path: str) -> None:
Expand Down
22 changes: 1 addition & 21 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ fn rerun_bindings(py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(shutdown, m)?)?;
m.add_function(wrap_pyfunction!(is_enabled, m)?)?;
m.add_function(wrap_pyfunction!(set_enabled, m)?)?;

#[cfg(feature = "native_viewer")]
{
m.add_function(wrap_pyfunction!(disconnect, m)?)?;
m.add_function(wrap_pyfunction!(show, m)?)?;
}
m.add_function(wrap_pyfunction!(disconnect, m)?)?;
m.add_function(wrap_pyfunction!(save, m)?)?;

m.add_function(wrap_pyfunction!(set_time_sequence, m)?)?;
Expand Down Expand Up @@ -330,26 +325,11 @@ fn set_enabled(enabled: bool) {
///
/// Subsequent log messages will be buffered and either sent on the next call to `connect`,
/// or shown with `show`.
#[cfg(feature = "native_viewer")]
#[pyfunction]
fn disconnect() {
global_session().disconnect();
}

/// Show the buffered log data.
///
/// NOTE: currently this only works _once_.
/// Calling this function more than once is undefined behavior.
/// We will try to fix this in the future.
/// Blocked on <https://github.com/emilk/egui/issues/1918>.
#[cfg(feature = "native_viewer")]
#[pyfunction]
fn show() -> PyResult<()> {
global_session()
.show()
.map_err(|err| PyRuntimeError::new_err(format!("Failed to show Rerun Viewer: {err}")))
}

#[pyfunction]
fn save(path: &str) -> PyResult<()> {
let mut session = global_session();
Expand Down