mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-23 21:53:43 +08:00
spinner
This commit is contained in:
@@ -40,5 +40,7 @@ class ProgressReader:
|
||||
|
||||
|
||||
def open_with_progress(pkl_path):
|
||||
total = sum(os.path.getsize(p) for p in get_existing_chunks(pkl_path))
|
||||
# only the data chunks are read, not the tiny .chunkmanifest — counting it caps progress at 99%
|
||||
chunks = [p for p in get_existing_chunks(pkl_path) if not p.endswith(".chunkmanifest")]
|
||||
total = sum(os.path.getsize(p) for p in chunks)
|
||||
return ProgressReader(open_file_chunked(pkl_path), total)
|
||||
|
||||
@@ -231,7 +231,7 @@ class HudRenderer(Widget):
|
||||
rect.y + rect.height - 14 - (self._txt_wheel.height + icon.height) / 2)
|
||||
rl.draw_texture_ex(icon, pos, 0.0, 1.0, rl.Color(255, 255, 255, int(255 * opacity * alpha)))
|
||||
|
||||
if loading:
|
||||
if loading and ui_state.usbgpu_load_progress < 100:
|
||||
pct_text = f"{ui_state.usbgpu_load_progress}%"
|
||||
size = FONT_SIZES.max_speed
|
||||
cell = measure_text_cached(self._font_bold, "0", size) # fixed digit cell so the number doesn't shift
|
||||
@@ -242,6 +242,12 @@ class HudRenderer(Widget):
|
||||
glyph = measure_text_cached(self._font_bold, c, size).x
|
||||
rl.draw_text_ex(self._font_bold, c, rl.Vector2(x + (w - glyph) / 2, y), size, 0, rl.WHITE)
|
||||
x += w
|
||||
elif loading:
|
||||
# bytes loaded, eGPU still warming up (no progress signal) — spinning arc instead of a frozen 100%
|
||||
r = 14.0
|
||||
center = rl.Vector2(pos.x - 8 - r, pos.y + icon.height / 2)
|
||||
start = (rl.get_time() * 360) % 360
|
||||
rl.draw_ring(center, r - 4, r, start, start + 270, 32, rl.WHITE)
|
||||
|
||||
def _draw_steering_wheel(self, rect: rl.Rectangle) -> None:
|
||||
wheel_txt = self._txt_wheel_critical if self._show_wheel_critical else self._txt_wheel
|
||||
|
||||
Reference in New Issue
Block a user