Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves issue 555 #603

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/seedsigner/gui/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,32 @@ class Keyboard:
"code": "DEL",
"letter": "del",
"font": COMPACT_KEY_FONT,
"size": 2,
"size": 3,
}
KEY_BACKSPACE_2 = {
"code": "DEL",
"letter": "del",
"font": COMPACT_KEY_FONT,
"size": 2,
}
KEY_BACKSPACE_4 = {
"code": "DEL",
"letter": "del",
"font": COMPACT_KEY_FONT,
"size": 4,
}
KEY_BACKSPACE_5 = {
"code": "DEL",
"letter": "del",
"font": COMPACT_KEY_FONT,
"size": 5,
}
KEY_BACKSPACE_6 = {
"code": "DEL",
"letter": "del",
"font": COMPACT_KEY_FONT,
"size": 6,
}
KEY_SPACE = {
"code": "SPACE",
"letter": "space",
Expand Down
3 changes: 3 additions & 0 deletions src/seedsigner/gui/screens/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,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):
super().__post_init__()
Expand Down Expand Up @@ -1106,6 +1108,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
)
Expand Down
7 changes: 5 additions & 2 deletions src/seedsigner/gui/screens/seed_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,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]
)

Expand Down Expand Up @@ -540,6 +541,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__()

Expand Down Expand Up @@ -572,6 +574,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__()

Expand Down Expand Up @@ -741,7 +744,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
Expand All @@ -762,7 +765,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
Expand Down
5 changes: 4 additions & 1 deletion src/seedsigner/gui/screens/tools_screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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



Expand Down Expand Up @@ -129,6 +130,7 @@ class ToolsDiceEntropyEntryScreen(KeyboardScreen):
def __post_init__(self):
# Override values set by the parent class
self.title = f"Dice Roll 1/{self.return_after_n_chars}"
self.custom_additional_keys = [Keyboard.KEY_BACKSPACE]

# Specify the keys in the keyboard
self.rows = 3
Expand Down Expand Up @@ -187,7 +189,8 @@ class ToolsCoinFlipEntryScreen(KeyboardScreen):
def __post_init__(self):
# Override values set by the parent class
self.title = f"Coin Flip 1/{self.return_after_n_chars}"

self.custom_additional_keys = [Keyboard.KEY_BACKSPACE_2]

# Specify the keys in the keyboard
self.rows = 1
self.cols = 4
Expand Down
Loading