ui: fix value text eliding when it fits (#38502)

This commit is contained in:
Matt Purnell
2026-08-07 12:39:22 -05:00
committed by GitHub
parent bd7b419a4e
commit faf966adb2
2 changed files with 11 additions and 1 deletions
@@ -138,6 +138,10 @@ def setup_update_available(available: bool = True) -> None:
params.remove("UpdaterTargetBranch")
def set_updater_state(state: str) -> None:
Params().put("UpdaterState", state, block=True)
def setup_calibration_params() -> None:
params = Params()
# live calibration
@@ -479,6 +483,9 @@ def build_tizi_script(pm: PubMaster, main_layout, script: Script) -> None:
# === Settings - Software ===
script.setup(lambda: setup_update_available(False), wait_after=0) # start with no update available
script.click(278, 720) # software
script.setup(lambda: set_updater_state("checking...")) # updater mid-check
script.setup(lambda: set_updater_state("downloading...")) # updater mid-download
script.setup(lambda: set_updater_state("idle"), wait_after=0)
for _ in range(2):
script.click(720, 120) # toggle current release notes
script.setup(setup_update_available) # set update available
+4 -1
View File
@@ -1,3 +1,4 @@
import math
import os
import pyray as rl
from collections.abc import Callable
@@ -104,7 +105,9 @@ class ButtonAction(ItemAction):
value_text = self.value
if value_text:
text_width = measure_text_cached(self._font, value_text, ITEM_TEXT_FONT_SIZE).x
return text_width + BUTTON_WIDTH + TEXT_PADDING
# round up so the width survives float32 storage in rl.Rectangle, otherwise the
# value label can come out a fraction of a pixel too narrow and get elided
return math.ceil(text_width) + BUTTON_WIDTH + TEXT_PADDING
else:
return BUTTON_WIDTH