Skip to content

Commit b705f6c

Browse files
committed
Remove loading screen
1 parent cff1701 commit b705f6c

File tree

4 files changed

+19
-125
lines changed

4 files changed

+19
-125
lines changed

crates/re_viewer/src/app.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,11 @@ impl App {
731731
render_ctx.before_submit();
732732
}
733733
} else {
734-
// This is part of the loading vs. welcome screen UI logic. The loading screen
735-
// is displayed when no app ID is set. This is e.g. the initial state for the
736-
// web demos.
737-
crate::ui::loading_ui(ui, &self.rx);
734+
// There's nothing to show.
735+
// We get here when
736+
// A) there is nothing loaded
737+
// B) we decided not to show the welcome screen, presumably because data is expected at any time now.
738+
// The user can see the connection status in the top bar.
738739
}
739740
});
740741
}
@@ -941,12 +942,13 @@ impl App {
941942
}
942943
}
943944

944-
/// This function will create an empty blueprint whenever the welcome screen should be
945-
/// displayed.
946-
///
947-
/// The welcome screen can be displayed only when a blueprint is available (and no recording is
948-
/// loaded). This function implements the heuristic which determines when the welcome screen
945+
/// This function implements a heuristic which determines when the welcome screen
949946
/// should show up.
947+
///
948+
/// Why not always show it when no data is loaded?
949+
/// Because sometimes we expet data to arrive at any moment,
950+
/// and showing the wlecome screen for a few frames will just be an annoying flash
951+
/// in the users face.
950952
fn should_show_welcome_screen(&mut self, store_hub: &StoreHub) -> bool {
951953
// Don't show the welcome screen if we have actual data to display.
952954
if store_hub.current_recording().is_some() || store_hub.selected_application_id().is_some()

crates/re_viewer/src/ui/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ pub use recordings_panel::recordings_panel_ui;
1717

1818
pub(crate) use {
1919
self::mobile_warning_ui::mobile_warning_ui, self::top_panel::top_panel,
20-
self::welcome_screen::loading_ui, self::welcome_screen::WelcomeScreen,
20+
self::welcome_screen::WelcomeScreen,
2121
};

crates/re_viewer/src/ui/welcome_screen/mod.rs

Lines changed: 5 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
mod example_page;
22
mod welcome_page;
33

4+
use std::hash::Hash;
5+
46
use egui::Widget;
7+
use welcome_page::welcome_page_ui;
8+
59
use re_log_types::LogMsg;
6-
use re_smart_channel::{ReceiveSet, SmartChannelSource};
10+
use re_smart_channel::ReceiveSet;
711
use re_ui::ReUi;
8-
use std::hash::Hash;
9-
use welcome_page::welcome_page_ui;
1012

1113
#[derive(Debug, Default, PartialEq, Hash)]
1214
enum WelcomeScreenPage {
@@ -104,39 +106,6 @@ impl WelcomeScreen {
104106
}
105107
}
106108

107-
/// Full-screen UI shown while in loading state.
108-
pub fn loading_ui(ui: &mut egui::Ui, rx: &ReceiveSet<LogMsg>) {
109-
let status_strings = status_strings(rx);
110-
if status_strings.is_empty() {
111-
return;
112-
}
113-
114-
ui.centered_and_justified(|ui| {
115-
for status_string in status_strings {
116-
let style = ui.style();
117-
let mut layout_job = egui::text::LayoutJob::default();
118-
layout_job.append(
119-
status_string.status,
120-
0.0,
121-
egui::TextFormat::simple(
122-
egui::TextStyle::Heading.resolve(style),
123-
style.visuals.strong_text_color(),
124-
),
125-
);
126-
layout_job.append(
127-
&format!("\n\n{}", status_string.source),
128-
0.0,
129-
egui::TextFormat::simple(
130-
egui::TextStyle::Body.resolve(style),
131-
style.visuals.text_color(),
132-
),
133-
);
134-
layout_job.halign = egui::Align::Center;
135-
ui.label(layout_job);
136-
}
137-
});
138-
}
139-
140109
fn set_large_button_style(ui: &mut egui::Ui) {
141110
ui.style_mut().spacing.button_padding = egui::vec2(10.0, 7.0);
142111
let visuals = ui.visuals_mut();
@@ -182,64 +151,3 @@ fn large_text_button(ui: &mut egui::Ui, text: impl Into<egui::WidgetText>) -> eg
182151
})
183152
.inner
184153
}
185-
186-
/// Describes the current state of the Rerun viewer.
187-
struct StatusString {
188-
/// General status string (e.g. "Ready", "Loading…", etc.).
189-
status: &'static str,
190-
191-
/// Source string (e.g. listening IP, file path, etc.).
192-
source: String,
193-
194-
/// Whether or not the status is valid once data loading is completed, i.e. if data may still
195-
/// be received later.
196-
long_term: bool,
197-
}
198-
199-
impl StatusString {
200-
fn new(status: &'static str, source: String, long_term: bool) -> Self {
201-
Self {
202-
status,
203-
source,
204-
long_term,
205-
}
206-
}
207-
}
208-
209-
/// Returns the status strings to be displayed by the loading and welcome screen.
210-
fn status_strings(rx: &ReceiveSet<LogMsg>) -> Vec<StatusString> {
211-
rx.sources()
212-
.into_iter()
213-
.map(|s| status_string(&s))
214-
.collect()
215-
}
216-
217-
fn status_string(source: &SmartChannelSource) -> StatusString {
218-
match source {
219-
re_smart_channel::SmartChannelSource::File(path) => {
220-
StatusString::new("Loading…", path.display().to_string(), false)
221-
}
222-
re_smart_channel::SmartChannelSource::RrdHttpStream { url } => {
223-
StatusString::new("Loading…", url.clone(), false)
224-
}
225-
re_smart_channel::SmartChannelSource::RrdWebEventListener => {
226-
StatusString::new("Ready", "Waiting for logging data…".to_owned(), true)
227-
}
228-
re_smart_channel::SmartChannelSource::Sdk => StatusString::new(
229-
"Ready",
230-
"Waiting for logging data from SDK".to_owned(),
231-
true,
232-
),
233-
re_smart_channel::SmartChannelSource::WsClient { ws_server_url } => {
234-
// TODO(emilk): it would be even better to know whether or not we are connected, or are attempting to connect
235-
StatusString::new(
236-
"Ready",
237-
format!("Waiting for data from {ws_server_url}"),
238-
true,
239-
)
240-
}
241-
re_smart_channel::SmartChannelSource::TcpServer { port } => {
242-
StatusString::new("Ready", format!("Listening on port {port}"), true)
243-
}
244-
}
245-
}

crates/re_viewer/src/ui/welcome_screen/welcome_page.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{large_text_button, status_strings, url_large_text_button, WelcomeScreenResponse};
1+
use super::{large_text_button, url_large_text_button, WelcomeScreenResponse};
22
use egui::{NumExt, Ui};
33
use re_data_store::StoreDb;
44
use re_log_types::{
@@ -46,23 +46,7 @@ pub(super) fn welcome_page_ui(
4646
) -> WelcomeScreenResponse {
4747
ui.vertical(|ui| {
4848
let accepts_connections = rx.accepts_tcp_connections();
49-
50-
let show_example = onboarding_content_ui(ui, command_sender, accepts_connections);
51-
52-
for status_strings in status_strings(rx) {
53-
if status_strings.long_term {
54-
ui.add_space(55.0);
55-
ui.vertical_centered(|ui| {
56-
ui.label(status_strings.status);
57-
ui.label(
58-
egui::RichText::new(status_strings.source)
59-
.color(ui.visuals().weak_text_color()),
60-
);
61-
});
62-
}
63-
}
64-
65-
show_example
49+
onboarding_content_ui(ui, command_sender, accepts_connections)
6650
})
6751
.inner
6852
}

0 commit comments

Comments
 (0)