|
|
@ -3,7 +3,6 @@ import time |
|
|
|
from openpilot.system.ui.lib.application import gui_app |
|
|
|
from openpilot.system.ui.lib.application import gui_app |
|
|
|
from openpilot.system.ui.lib.text_measure import measure_text_cached |
|
|
|
from openpilot.system.ui.lib.text_measure import measure_text_cached |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PASSWORD_MASK_CHAR = "•" |
|
|
|
PASSWORD_MASK_CHAR = "•" |
|
|
|
PASSWORD_MASK_DELAY = 1.5 # Seconds to show character before masking |
|
|
|
PASSWORD_MASK_DELAY = 1.5 # Seconds to show character before masking |
|
|
|
|
|
|
|
|
|
|
@ -76,7 +75,7 @@ class InputBox: |
|
|
|
def add_char_at_cursor(self, char): |
|
|
|
def add_char_at_cursor(self, char): |
|
|
|
"""Add a character at the current cursor position.""" |
|
|
|
"""Add a character at the current cursor position.""" |
|
|
|
if len(self._input_text) < self._max_text_size: |
|
|
|
if len(self._input_text) < self._max_text_size: |
|
|
|
self._input_text = self._input_text[: self._cursor_position] + char + self._input_text[self._cursor_position :] |
|
|
|
self._input_text = self._input_text[: self._cursor_position] + char + self._input_text[self._cursor_position:] |
|
|
|
self.set_cursor_position(self._cursor_position + 1) |
|
|
|
self.set_cursor_position(self._cursor_position + 1) |
|
|
|
|
|
|
|
|
|
|
|
if self._password_mode: |
|
|
|
if self._password_mode: |
|
|
@ -88,7 +87,7 @@ class InputBox: |
|
|
|
def delete_char_before_cursor(self): |
|
|
|
def delete_char_before_cursor(self): |
|
|
|
"""Delete the character before the cursor position (backspace).""" |
|
|
|
"""Delete the character before the cursor position (backspace).""" |
|
|
|
if self._cursor_position > 0: |
|
|
|
if self._cursor_position > 0: |
|
|
|
self._input_text = self._input_text[: self._cursor_position - 1] + self._input_text[self._cursor_position :] |
|
|
|
self._input_text = self._input_text[: self._cursor_position - 1] + self._input_text[self._cursor_position:] |
|
|
|
self.set_cursor_position(self._cursor_position - 1) |
|
|
|
self.set_cursor_position(self._cursor_position - 1) |
|
|
|
return True |
|
|
|
return True |
|
|
|
return False |
|
|
|
return False |
|
|
@ -96,7 +95,7 @@ class InputBox: |
|
|
|
def delete_char_at_cursor(self): |
|
|
|
def delete_char_at_cursor(self): |
|
|
|
"""Delete the character at the cursor position (delete).""" |
|
|
|
"""Delete the character at the cursor position (delete).""" |
|
|
|
if self._cursor_position < len(self._input_text): |
|
|
|
if self._cursor_position < len(self._input_text): |
|
|
|
self._input_text = self._input_text[: self._cursor_position] + self._input_text[self._cursor_position + 1 :] |
|
|
|
self._input_text = self._input_text[: self._cursor_position] + self._input_text[self._cursor_position + 1:] |
|
|
|
self.set_cursor_position(self._cursor_position) |
|
|
|
self.set_cursor_position(self._cursor_position) |
|
|
|
return True |
|
|
|
return True |
|
|
|
return False |
|
|
|
return False |
|
|
@ -164,7 +163,7 @@ class InputBox: |
|
|
|
if recent_edit and self._input_text: |
|
|
|
if recent_edit and self._input_text: |
|
|
|
last_pos = max(0, self._cursor_position - 1) |
|
|
|
last_pos = max(0, self._cursor_position - 1) |
|
|
|
if last_pos < len(self._input_text): |
|
|
|
if last_pos < len(self._input_text): |
|
|
|
return masked_text[:last_pos] + self._input_text[last_pos] + masked_text[last_pos + 1 :] |
|
|
|
return masked_text[:last_pos] + self._input_text[last_pos] + masked_text[last_pos + 1:] |
|
|
|
|
|
|
|
|
|
|
|
return masked_text |
|
|
|
return masked_text |
|
|
|
|
|
|
|
|
|
|
|