diff --git a/src/seedsigner/gui/keyboard.py b/src/seedsigner/gui/keyboard.py index bc679ec5a..aac9080e6 100644 --- a/src/seedsigner/gui/keyboard.py +++ b/src/seedsigner/gui/keyboard.py @@ -34,10 +34,34 @@ class Keyboard: KEY_BACKSPACE = { "code": "DEL", - "letter": SeedSignerIconConstants.DELETE, - "font": ICON_KEY_FONT, - "size": 2, + "letter": SeedSignerIconConstants.DELETE, + "font": ICON_KEY_FONT, + "size": 3, } + KEY_BACKSPACE_2 = { + "code": "DEL", + "letter": SeedSignerIconConstants.DELETE, + "font": ICON_KEY_FONT, + "size": 2, + } + KEY_BACKSPACE_4 = { + "code": "DEL", + "letter": SeedSignerIconConstants.DELETE, + "font": ICON_KEY_FONT, + "size": 4, + } + KEY_BACKSPACE_5 = { + "code": "DEL", + "letter": SeedSignerIconConstants.DELETE, + "font": ICON_KEY_FONT, + "size": 5, + } + KEY_BACKSPACE_6 = { + "code": "DEL", + "letter": SeedSignerIconConstants.DELETE, + "font": ICON_KEY_FONT, + "size": 6, + } KEY_SPACE = { "code": "SPACE", diff --git a/src/seedsigner/gui/screens/screen.py b/src/seedsigner/gui/screens/screen.py index 47f6645ee..1f485e935 100644 --- a/src/seedsigner/gui/screens/screen.py +++ b/src/seedsigner/gui/screens/screen.py @@ -1118,6 +1118,8 @@ class KeyboardScreen(BaseTopNavScreen): return_after_n_chars: int = None show_save_button: bool = False initial_value: str = "" + from dataclasses import dataclass, field + custom_additional_keys: dict = field(default_factory=lambda: Keyboard.ADDITIONAL_KEYS) def __post_init__(self): if self.keyboard_font_size is None: @@ -1176,6 +1178,7 @@ def __post_init__(self): GUIConstants.EDGE_PADDING + self.keyboard_width, keyboard_start_y + self.rows * self.key_height + (self.rows - 1) * 2 ), + additional_keys=self.custom_additional_keys, auto_wrap=[Keyboard.WRAP_LEFT, Keyboard.WRAP_RIGHT], render_now=False ) diff --git a/src/seedsigner/gui/screens/seed_screens.py b/src/seedsigner/gui/screens/seed_screens.py index 08d1966bf..796e7c0a6 100644 --- a/src/seedsigner/gui/screens/seed_screens.py +++ b/src/seedsigner/gui/screens/seed_screens.py @@ -51,6 +51,7 @@ def __post_init__(self): GUIConstants.EDGE_PADDING + self.keyboard_width, self.canvas_height ), + additional_keys=[Keyboard.KEY_BACKSPACE_4], auto_wrap=[Keyboard.WRAP_LEFT, Keyboard.WRAP_RIGHT] ) @@ -557,6 +558,7 @@ def __post_init__(self): self.cols = 5 self.keys_charset = "0123456789" self.show_save_button = True + self.custom_additional_keys = [Keyboard.KEY_BACKSPACE_5] super().__post_init__() @@ -589,6 +591,7 @@ def __post_init__(self): self.cols = 6 self.keys_charset = "/'0123456789" self.show_save_button = True + self.custom_additional_keys = [Keyboard.KEY_BACKSPACE_6] super().__post_init__() @@ -763,7 +766,7 @@ def __post_init__(self): Keyboard.KEY_SPACE_2, Keyboard.KEY_CURSOR_LEFT, Keyboard.KEY_CURSOR_RIGHT, - Keyboard.KEY_BACKSPACE + Keyboard.KEY_BACKSPACE_2 ], auto_wrap=[Keyboard.WRAP_LEFT, Keyboard.WRAP_RIGHT], render_now=False @@ -784,7 +787,7 @@ def __post_init__(self): Keyboard.KEY_SPACE_2, Keyboard.KEY_CURSOR_LEFT, Keyboard.KEY_CURSOR_RIGHT, - Keyboard.KEY_BACKSPACE + Keyboard.KEY_BACKSPACE_2 ], auto_wrap=[Keyboard.WRAP_LEFT, Keyboard.WRAP_RIGHT], render_now=False diff --git a/src/seedsigner/gui/screens/tools_screens.py b/src/seedsigner/gui/screens/tools_screens.py index 0b291c01f..ffabc1d76 100644 --- a/src/seedsigner/gui/screens/tools_screens.py +++ b/src/seedsigner/gui/screens/tools_screens.py @@ -10,6 +10,7 @@ from seedsigner.gui.screens.screen import RET_CODE__BACK_BUTTON, BaseScreen, ButtonListScreen, KeyboardScreen from seedsigner.hardware.buttons import HardwareButtonsConstants from seedsigner.models.settings_definition import SettingsConstants, SettingsDefinition +from seedsigner.gui.keyboard import Keyboard @@ -135,6 +136,7 @@ class ToolsDiceEntropyEntryScreen(KeyboardScreen): def __post_init__(self): # TRANSLATOR_NOTE: current roll number vs total rolls (e.g. roll 7 of 50) self.title = _("Dice Roll {}/{}").format(1, self.return_after_n_chars) + self.custom_additional_keys = [Keyboard.KEY_BACKSPACE] # Specify the keys in the keyboard self.rows = 3 @@ -196,6 +198,7 @@ def __post_init__(self): # Override values set by the parent class # TRANSLATOR_NOTE: current coin-flip number vs total flips (e.g. flip 3 of 4) self.title = _("Coin Flip {}/{}").format(1, self.return_after_n_chars) + self.custom_additional_keys = [Keyboard.KEY_BACKSPACE_2] # Specify the keys in the keyboard self.rows = 1