mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
fix(core): prevent unnecessary display refreshing
[no changelog]
This commit is contained in:
parent
0c4b1d6213
commit
5f30194a34
@ -52,7 +52,8 @@ class RustLayout(ui.Layout):
|
||||
|
||||
painted = self.layout.paint()
|
||||
|
||||
ui.refresh()
|
||||
if painted:
|
||||
ui.refresh()
|
||||
if storage_cache.homescreen_shown is not None and painted:
|
||||
storage_cache.homescreen_shown = None
|
||||
|
||||
|
@ -36,8 +36,8 @@ if __debug__:
|
||||
(io.TOUCH_END, 220, 220),
|
||||
):
|
||||
msg = self.layout.touch_event(event, x, y)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
if msg is not None:
|
||||
raise Result(msg)
|
||||
|
||||
|
@ -19,8 +19,8 @@ class HomescreenBase(RustLayout):
|
||||
super().__init__(layout=layout)
|
||||
|
||||
def _paint(self) -> None:
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def _first_paint(self) -> None:
|
||||
if storage_cache.homescreen_shown is not self.RENDER_INDICATOR:
|
||||
@ -76,8 +76,8 @@ class Homescreen(HomescreenBase):
|
||||
while True:
|
||||
is_connected = await usbcheck
|
||||
self.layout.usb_event(is_connected)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def create_tasks(self) -> Tuple[loop.AwaitableTask, ...]:
|
||||
return super().create_tasks() + (self.usb_checker_task(),)
|
||||
|
@ -36,8 +36,8 @@ class RustProgress:
|
||||
self.layout = layout
|
||||
ui.backlight_fade(ui.BacklightLevels.DIM)
|
||||
self.layout.attach_timer_fn(self.set_timer)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
ui.backlight_fade(ui.BacklightLevels.NORMAL)
|
||||
|
||||
def set_timer(self, token: int, deadline: int) -> None:
|
||||
@ -46,8 +46,8 @@ class RustProgress:
|
||||
def report(self, value: int, description: str | None = None):
|
||||
msg = self.layout.progress_event(value, description or "")
|
||||
assert msg is None
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
|
||||
def progress(
|
||||
|
@ -56,7 +56,8 @@ class RustLayout(LayoutParentType[T]):
|
||||
|
||||
painted = self.layout.paint()
|
||||
|
||||
ui.refresh()
|
||||
if painted:
|
||||
ui.refresh()
|
||||
if storage_cache.homescreen_shown is not None and painted:
|
||||
storage_cache.homescreen_shown = None
|
||||
|
||||
|
@ -19,8 +19,8 @@ class HomescreenBase(RustLayout):
|
||||
super().__init__(layout=layout)
|
||||
|
||||
def _paint(self) -> None:
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def _first_paint(self) -> None:
|
||||
if storage_cache.homescreen_shown is not self.RENDER_INDICATOR:
|
||||
@ -65,8 +65,8 @@ class Homescreen(HomescreenBase):
|
||||
while True:
|
||||
is_connected = await usbcheck
|
||||
self.layout.usb_event(is_connected)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def create_tasks(self) -> Tuple[loop.AwaitableTask, ...]:
|
||||
return super().create_tasks() + (self.usb_checker_task(),)
|
||||
|
@ -58,7 +58,8 @@ class RustLayout(LayoutParentType[T]):
|
||||
|
||||
painted = self.layout.paint()
|
||||
|
||||
ui.refresh()
|
||||
if painted:
|
||||
ui.refresh()
|
||||
if storage_cache.homescreen_shown is not None and painted:
|
||||
storage_cache.homescreen_shown = None
|
||||
|
||||
|
@ -36,8 +36,8 @@ if __debug__:
|
||||
(io.TOUCH_END, 220, 220),
|
||||
):
|
||||
msg = self.layout.touch_event(event, x, y)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
if msg is not None:
|
||||
raise Result(msg)
|
||||
|
||||
|
@ -19,8 +19,8 @@ class HomescreenBase(RustLayout):
|
||||
super().__init__(layout=layout)
|
||||
|
||||
def _paint(self) -> None:
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def _first_paint(self) -> None:
|
||||
if storage_cache.homescreen_shown is not self.RENDER_INDICATOR:
|
||||
@ -76,8 +76,8 @@ class Homescreen(HomescreenBase):
|
||||
while True:
|
||||
is_connected = await usbcheck
|
||||
self.layout.usb_event(is_connected)
|
||||
self.layout.paint()
|
||||
ui.refresh()
|
||||
if self.layout.paint():
|
||||
ui.refresh()
|
||||
|
||||
def create_tasks(self) -> Tuple[loop.AwaitableTask, ...]:
|
||||
return super().create_tasks() + (self.usb_checker_task(),)
|
||||
|
Loading…
Reference in New Issue
Block a user