From e62b6a38e9cf6431321dafefc78ea86c9a1ccf13 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 12 May 2025 02:06:04 +0800 Subject: [PATCH] system/ui: set keyboard to use full window area (#35181) set keyboard to use full window area --- system/ui/widgets/keyboard.py | 5 ++++- system/ui/widgets/network.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/system/ui/widgets/keyboard.py b/system/ui/widgets/keyboard.py index 13fdb912b5..d496c5f749 100644 --- a/system/ui/widgets/keyboard.py +++ b/system/ui/widgets/keyboard.py @@ -1,8 +1,10 @@ import pyray as rl +from openpilot.system.ui.lib.application import gui_app from openpilot.system.ui.lib.button import gui_button from openpilot.system.ui.lib.label import gui_label # Constants for special keys +CONTENT_MARGIN = 50 BACKSPACE_KEY = "<-" ENTER_KEY = "Enter" SPACE_KEY = " " @@ -55,7 +57,8 @@ class Keyboard: self._clear() return result - def render(self, rect, title, sub_title): + def render(self, title, sub_title): + rect = rl.Rectangle(CONTENT_MARGIN, CONTENT_MARGIN, gui_app.width - 2 * CONTENT_MARGIN, gui_app.height - 2 * CONTENT_MARGIN) gui_label(rl.Rectangle(rect.x, rect.y, rect.width, 95), title, 90) gui_label(rl.Rectangle(rect.x, rect.y + 95, rect.width, 60), sub_title, 55, rl.GRAY) if gui_button(rl.Rectangle(rect.x + rect.width - 300, rect.y, 300, 100), "Cancel"): diff --git a/system/ui/widgets/network.py b/system/ui/widgets/network.py index 14f4017925..49e2dd8296 100644 --- a/system/ui/widgets/network.py +++ b/system/ui/widgets/network.py @@ -62,7 +62,7 @@ class WifiManagerUI: match self.state: case StateNeedsAuth(network): - result = self.keyboard.render(rect, "Enter password", f"for {network.ssid}") + result = self.keyboard.render("Enter password", f"for {network.ssid}") if result == 1: self.connect_to_network(network, self.keyboard.text) elif result == 0: