2017-06-14 17:27:02 +00:00
|
|
|
from typing import *
|
2017-06-14 15:41:45 +00:00
|
|
|
|
2019-05-17 12:22:36 +00:00
|
|
|
|
2024-11-15 09:07:01 +00:00
|
|
|
# upymod/modtrezorui/modtrezorui-display.h
|
2017-06-14 15:41:45 +00:00
|
|
|
class Display:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
Provide access to device display.
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2019-06-09 09:24:06 +00:00
|
|
|
WIDTH: int # display width in pixels
|
|
|
|
HEIGHT: int # display height in pixels
|
|
|
|
FONT_MONO: int # id of monospace font
|
|
|
|
FONT_NORMAL: int # id of normal-width font
|
2023-03-06 17:54:23 +00:00
|
|
|
FONT_DEMIBOLD: int # id of demibold font
|
2024-04-09 11:23:36 +00:00
|
|
|
FONT_BOLD_UPPER: int # id of bold-width-uppercased font
|
2017-06-14 15:41:45 +00:00
|
|
|
|
|
|
|
def __init__(self) -> None:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
Initialize the display.
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
|
|
|
|
def refresh(self) -> None:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
Refresh display (update screen).
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
|
|
|
|
def bar(self, x: int, y: int, w: int, h: int, color: int) -> None:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
|
|
|
Renders a bar at position (x,y = upper left corner) with width w and
|
|
|
|
height h of color color.
|
|
|
|
"""
|
|
|
|
|
2021-03-18 09:48:50 +00:00
|
|
|
def orientation(self, degrees: int | None = None) -> int:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
Sets display orientation to 0, 90, 180 or 270 degrees.
|
|
|
|
Everything needs to be redrawn again when this function is used.
|
2019-05-17 12:22:36 +00:00
|
|
|
Call without the degrees parameter to just perform the read of the
|
|
|
|
value.
|
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
|
2021-03-18 09:48:50 +00:00
|
|
|
def backlight(self, val: int | None = None) -> int:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
Sets backlight intensity to the value specified in val.
|
|
|
|
Call without the val parameter to just perform the read of the value.
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2017-06-14 15:41:45 +00:00
|
|
|
|
2018-03-09 10:37:06 +00:00
|
|
|
def save(self, prefix: str) -> None:
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2018-03-09 10:37:06 +00:00
|
|
|
Saves current display contents to PNG file with given prefix.
|
2019-05-17 12:22:36 +00:00
|
|
|
"""
|
2019-12-09 16:01:04 +00:00
|
|
|
|
|
|
|
def clear_save(self) -> None:
|
|
|
|
"""
|
|
|
|
Clears buffers in display saving.
|
|
|
|
"""
|