-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
RecordingUri
component and an assorted custom ui
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace rerun.components; | ||
|
||
// --- | ||
|
||
/// A recording URI (Uniform Resource Identifier). | ||
table RecordingUri ( | ||
"attr.rust.derive": "PartialEq, Eq, PartialOrd, Ord, Hash" | ||
) { | ||
recording_uri: rerun.datatypes.Utf8 (order: 100); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use super::RecordingUri; | ||
|
||
impl RecordingUri { | ||
/// Return the Recording URI contained in this component. | ||
pub fn uri(&self) -> &str { | ||
self.0.as_str() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use re_types::components::RecordingUri; | ||
use re_viewer_context::{MaybeMutRef, SystemCommand, SystemCommandSender, ViewerContext}; | ||
|
||
pub fn singleline_view_recording_uri( | ||
ctx: &ViewerContext<'_>, | ||
ui: &mut egui::Ui, | ||
value: &mut MaybeMutRef<'_, RecordingUri>, | ||
) -> egui::Response { | ||
let value = value.as_ref(); | ||
|
||
let response = ui | ||
.scope(|ui| { | ||
if ui.style().wrap_mode.is_none() { | ||
ui.style_mut().wrap_mode = Some(if ui.is_sizing_pass() { | ||
egui::TextWrapMode::Extend | ||
} else { | ||
egui::TextWrapMode::Truncate | ||
}); | ||
} | ||
|
||
ui.link(value.uri()) | ||
}) | ||
.inner; | ||
|
||
if response.clicked() { | ||
let data_source = re_data_source::DataSource::from_uri( | ||
re_log_types::FileSource::Cli, | ||
value.uri().to_owned(), | ||
); | ||
|
||
match data_source.stream(None) { | ||
Ok(rx) => ctx | ||
.command_sender | ||
.send_system(SystemCommand::AddReceiver(rx)), | ||
Err(err) => re_log::warn!("Could not open recording URI: {err}"), | ||
} | ||
} | ||
|
||
response | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.