Optimizations and performance boost to pre-loader for launcher and game client.
This commit is contained in:
@@ -105,7 +105,7 @@ ACTIVITY_LOG_TRIM_LINES = 500
|
||||
TRANSFER_RATE_WINDOW_SECONDS = 3.0
|
||||
TRANSFER_RATE_MINIMUM_INTERVAL_SECONDS = 0.2
|
||||
TRANSFER_RATE_IDLE_SECONDS = 2.0
|
||||
DASHBOARD_PRELOADER_MINIMUM_MILLISECONDS = 650
|
||||
DASHBOARD_PRELOADER_MINIMUM_MILLISECONDS = 300
|
||||
DASHBOARD_PRELOADER_TIMEOUT_MILLISECONDS = 10_000
|
||||
DASHBOARD_TRANSITION_STEP_MILLISECONDS = 16
|
||||
DASHBOARD_TRANSITION_STEPS = 9
|
||||
@@ -120,6 +120,7 @@ SERVER_STATUS_STALE_SECONDS = 5 * 60
|
||||
DASHBOARD_STARTUP_COMPONENTS = frozenset(
|
||||
{
|
||||
"broadcast",
|
||||
"cached_content",
|
||||
"compatibility",
|
||||
"launcher_update",
|
||||
"logo",
|
||||
@@ -130,6 +131,7 @@ DASHBOARD_STARTUP_COMPONENTS = frozenset(
|
||||
"version",
|
||||
}
|
||||
)
|
||||
DASHBOARD_STARTUP_REQUIRED_COMPONENTS = frozenset({"cached_content"})
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -559,9 +561,9 @@ def dashboard_preloader_delay(
|
||||
|
||||
|
||||
def dashboard_content_ready(ready_components: set[str] | frozenset[str]) -> bool:
|
||||
"""Return whether every user-visible startup component has settled."""
|
||||
"""Return whether cached content is ready for an interactive dashboard."""
|
||||
|
||||
return DASHBOARD_STARTUP_COMPONENTS.issubset(ready_components)
|
||||
return DASHBOARD_STARTUP_REQUIRED_COMPONENTS.issubset(ready_components)
|
||||
|
||||
|
||||
def dashboard_transition_opacity(step: int, *, fading_in: bool) -> float:
|
||||
@@ -1284,6 +1286,7 @@ def run_dashboard(paths: AppPaths) -> None:
|
||||
startup_timeout_after: str | None = None
|
||||
startup_progress_after: str | None = None
|
||||
startup_progress_target = 0.0
|
||||
remote_refresh_started = False
|
||||
root.deiconify()
|
||||
root.lift()
|
||||
startup_overlay.lift()
|
||||
@@ -1375,6 +1378,7 @@ def run_dashboard(paths: AppPaths) -> None:
|
||||
set_root_opacity(1.0)
|
||||
root.lift()
|
||||
root.focus_set()
|
||||
root.after_idle(start_remote_content_refresh)
|
||||
|
||||
def fade_dashboard_in(step: int = 0) -> None:
|
||||
if not set_root_opacity(
|
||||
@@ -3389,6 +3393,13 @@ def run_dashboard(paths: AppPaths) -> None:
|
||||
threading.Thread(target=version_worker, name="ptlinux-version", daemon=True).start()
|
||||
refresh_launcher_update_check()
|
||||
|
||||
def start_remote_content_refresh() -> None:
|
||||
nonlocal remote_refresh_started
|
||||
if remote_refresh_started:
|
||||
return
|
||||
remote_refresh_started = True
|
||||
refresh_remote_content()
|
||||
|
||||
def release_game_launch_controls(
|
||||
client_id: int,
|
||||
*,
|
||||
@@ -4282,15 +4293,19 @@ def run_dashboard(paths: AppPaths) -> None:
|
||||
if cached_launcher_update is not None:
|
||||
show_launcher_update_check(cached_launcher_update, log_reason=False)
|
||||
refresh_runtime_compatibility()
|
||||
mark_startup_component_ready(
|
||||
"cached_content",
|
||||
"Cached dashboard content ready",
|
||||
)
|
||||
poll_events()
|
||||
load_official_logo()
|
||||
update_startup_progress("Loading online dashboard content…")
|
||||
startup_overlay.update_idletasks()
|
||||
startup_timeout_after = root.after(
|
||||
DASHBOARD_PRELOADER_TIMEOUT_MILLISECONDS,
|
||||
timeout_startup_preloader,
|
||||
)
|
||||
refresh_remote_content()
|
||||
if not startup_transition_started:
|
||||
startup_timeout_after = root.after(
|
||||
DASHBOARD_PRELOADER_TIMEOUT_MILLISECONDS,
|
||||
timeout_startup_preloader,
|
||||
)
|
||||
maybe_start_dashboard_transition()
|
||||
try:
|
||||
root.mainloop()
|
||||
|
||||
Reference in New Issue
Block a user