-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,50 @@ | ||
use re_types::components::RecordingUri; | ||
use re_viewer_context::{MaybeMutRef, SystemCommand, SystemCommandSender, ViewerContext}; | ||
use re_viewer_context::{MaybeMutRef, ViewerContext}; | ||
|
||
pub fn singleline_view_recording_uri( | ||
ctx: &ViewerContext<'_>, | ||
_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 | ||
}); | ||
} | ||
#[cfg(not(target_arch = "wasm32"))] | ||
{ | ||
use re_viewer_context::{SystemCommand, SystemCommandSender}; | ||
|
||
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::Uri, | ||
value.uri().to_owned(), | ||
); | ||
|
||
ui.link(value.uri()) | ||
}) | ||
.inner; | ||
|
||
if response.clicked() { | ||
let data_source = re_data_source::DataSource::from_uri( | ||
re_log_types::FileSource::Uri, | ||
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}"), | ||
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 | ||
} | ||
|
||
response | ||
#[cfg(target_arch = "wasm32")] | ||
{ | ||
re_viewer_context::UiLayout::List.label(ui, value.uri()) | ||
} | ||
} |