system/ui: use • for password masking in InputBox (#35313)

use • for password masking
pull/35316/head
Dean Lee 2 months ago committed by GitHub
parent 4c9655b5e4
commit 68fa8c56ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      system/ui/lib/inputbox.py

@ -2,6 +2,9 @@ import pyray as rl
from openpilot.system.ui.lib.application import gui_app
PASSWORD_MASK_CHAR = ""
class InputBox:
def __init__(self, max_text_size=255, password_mode=False):
self._max_text_size = max_text_size
@ -49,7 +52,7 @@ class InputBox:
return
font = gui_app.font()
display_text = "*" * len(self._input_text) if self._password_mode else self._input_text
display_text = PASSWORD_MASK_CHAR * len(self._input_text) if self._password_mode else self._input_text
padding = 10
if self._cursor_position > 0:
@ -111,7 +114,7 @@ class InputBox:
# Display text
font = gui_app.font()
display_text = "*" * len(self._input_text) if self._password_mode else self._input_text
display_text = PASSWORD_MASK_CHAR * len(self._input_text) if self._password_mode else self._input_text
padding = 10
# Clip text within input box bounds
@ -148,7 +151,7 @@ class InputBox:
# Calculate cursor position from click
if len(self._input_text) > 0:
font = gui_app.font()
display_text = "*" * len(self._input_text) if self._password_mode else self._input_text
display_text = PASSWORD_MASK_CHAR * len(self._input_text) if self._password_mode else self._input_text
# Find the closest character position to the click
relative_x = mouse_pos.x - (rect.x + 10) + self._text_offset

Loading…
Cancel
Save