|
|
|
@ -8,7 +8,7 @@ from openpilot.system.ui.lib.application import gui_app, FontWeight |
|
|
|
|
from openpilot.system.ui.widgets import Widget |
|
|
|
|
from openpilot.system.ui.widgets.button import ButtonStyle, Button |
|
|
|
|
from openpilot.system.ui.widgets.inputbox import InputBox |
|
|
|
|
from openpilot.system.ui.widgets.label import gui_label |
|
|
|
|
from openpilot.system.ui.widgets.label import Label, TextAlignment |
|
|
|
|
|
|
|
|
|
KEY_FONT_SIZE = 96 |
|
|
|
|
DOUBLE_CLICK_THRESHOLD = 0.5 # seconds |
|
|
|
@ -62,8 +62,8 @@ class Keyboard(Widget): |
|
|
|
|
self._layout_name: Literal["lowercase", "uppercase", "numbers", "specials"] = "lowercase" |
|
|
|
|
self._caps_lock = False |
|
|
|
|
self._last_shift_press_time = 0 |
|
|
|
|
self._title = "" |
|
|
|
|
self._sub_title = "" |
|
|
|
|
self._title = Label("", 90, FontWeight.BOLD, TextAlignment.LEFT) |
|
|
|
|
self._sub_title = Label("", 55, FontWeight.NORMAL, TextAlignment.LEFT) |
|
|
|
|
|
|
|
|
|
self._max_text_size = max_text_size |
|
|
|
|
self._min_text_size = min_text_size |
|
|
|
@ -115,8 +115,8 @@ class Keyboard(Widget): |
|
|
|
|
self._backspace_pressed = False |
|
|
|
|
|
|
|
|
|
def set_title(self, title: str, sub_title: str = ""): |
|
|
|
|
self._title = title |
|
|
|
|
self._sub_title = sub_title |
|
|
|
|
self._title.set_text(title) |
|
|
|
|
self._sub_title.set_text(sub_title) |
|
|
|
|
|
|
|
|
|
def _eye_button_callback(self): |
|
|
|
|
self._password_mode = not self._password_mode |
|
|
|
@ -133,8 +133,8 @@ class Keyboard(Widget): |
|
|
|
|
|
|
|
|
|
def _render(self, rect: rl.Rectangle): |
|
|
|
|
rect = rl.Rectangle(rect.x + CONTENT_MARGIN, rect.y + CONTENT_MARGIN, rect.width - 2 * CONTENT_MARGIN, rect.height - 2 * CONTENT_MARGIN) |
|
|
|
|
gui_label(rl.Rectangle(rect.x, rect.y, rect.width, 95), self._title, 90, font_weight=FontWeight.BOLD) |
|
|
|
|
gui_label(rl.Rectangle(rect.x, rect.y + 95, rect.width, 60), self._sub_title, 55, font_weight=FontWeight.NORMAL) |
|
|
|
|
self._title.render(rl.Rectangle(rect.x, rect.y, rect.width, 95)) |
|
|
|
|
self._sub_title.render(rl.Rectangle(rect.x, rect.y + 95, rect.width, 60)) |
|
|
|
|
self._cancel_button.render(rl.Rectangle(rect.x + rect.width - 386, rect.y, 386, 125)) |
|
|
|
|
|
|
|
|
|
# Draw input box and password toggle |
|
|
|
|