mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
Merge pull request #664 from kdmukai/keyboard_space_del_icons
Add SPACE, DEL icons to `Keyboard`; various UI consistency tweaks
This commit is contained in:
+10
-19
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: seedsigner 0.8.5-rc1\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-01-15 10:45-0600\n"
|
||||
"POT-Creation-Date: 2025-01-19 10:20-0600\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -36,16 +36,6 @@ msgstr ""
|
||||
msgid "sats"
|
||||
msgstr ""
|
||||
|
||||
#. The abbreviated label for the special key <del> on a standard keyboard.
|
||||
#: src/seedsigner/gui/keyboard.py
|
||||
msgid "del"
|
||||
msgstr ""
|
||||
|
||||
#. The abbreviated label for the special key <space> on a standard keyboard.
|
||||
#: src/seedsigner/gui/keyboard.py
|
||||
msgid "space"
|
||||
msgstr ""
|
||||
|
||||
#: src/seedsigner/gui/toast.py
|
||||
msgid ""
|
||||
"You can remove\n"
|
||||
@@ -215,7 +205,7 @@ msgstr ""
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
#: src/seedsigner/gui/screens/screen.py src/seedsigner/views/psbt_views.py
|
||||
#: src/seedsigner/gui/screens/screen.py
|
||||
msgid "Caution"
|
||||
msgstr ""
|
||||
|
||||
@@ -901,13 +891,7 @@ msgstr ""
|
||||
|
||||
#. Variable is either "change" or "self-transfer".
|
||||
#: src/seedsigner/views/psbt_views.py
|
||||
msgid ""
|
||||
"PSBT's {} address could not be verified with your multisig wallet "
|
||||
"descriptor."
|
||||
msgstr ""
|
||||
|
||||
#: src/seedsigner/views/psbt_views.py
|
||||
msgid "Suspicious PSBT"
|
||||
msgid "PSBT's {} address could not be verified from wallet descriptor."
|
||||
msgstr ""
|
||||
|
||||
#. Variable is either "change" or "self-transfer".
|
||||
@@ -915,6 +899,10 @@ msgstr ""
|
||||
msgid "PSBT's {} address could not be generated from your seed."
|
||||
msgstr ""
|
||||
|
||||
#: src/seedsigner/views/psbt_views.py
|
||||
msgid "Suspicious PSBT"
|
||||
msgstr ""
|
||||
|
||||
#: src/seedsigner/views/psbt_views.py
|
||||
msgid "Address Verification Failed"
|
||||
msgstr ""
|
||||
@@ -1459,10 +1447,13 @@ msgstr ""
|
||||
msgid "Back to Main Menu"
|
||||
msgstr ""
|
||||
|
||||
#. The network setting (mainnet/testnet/regtest) doesn't match the provided
|
||||
#. derivation path
|
||||
#: src/seedsigner/views/view.py
|
||||
msgid "Network Mismatch"
|
||||
msgstr ""
|
||||
|
||||
#. Button option to alter a setting
|
||||
#: src/seedsigner/views/view.py
|
||||
msgid "Change Setting"
|
||||
msgstr ""
|
||||
|
||||
@@ -217,9 +217,9 @@ class SeedSignerIconConstants:
|
||||
|
||||
# Messaging icons
|
||||
INFO = "\ue912"
|
||||
ERROR = "\ue913"
|
||||
SUCCESS = "\ue914"
|
||||
WARNING = "\ue915"
|
||||
SUCCESS = "\ue913"
|
||||
WARNING = "\ue914"
|
||||
ERROR = "\ue915"
|
||||
|
||||
# Informational icons
|
||||
ADDRESS = "\ue916"
|
||||
@@ -241,8 +241,9 @@ class SeedSignerIconConstants:
|
||||
DELETE = "\ue922"
|
||||
SPACE = "\ue923"
|
||||
|
||||
# Must be updated whenever new icons are added. See usage in `Icon` class below.
|
||||
MIN_VALUE = SCAN
|
||||
MAX_VALUE = QRCODE
|
||||
MAX_VALUE = SPACE
|
||||
|
||||
|
||||
|
||||
@@ -280,17 +281,6 @@ def calc_text_centering(font: ImageFont,
|
||||
|
||||
|
||||
|
||||
def load_icon(icon_name: str, load_selected_variant: bool = False):
|
||||
icon_url = os.path.join(pathlib.Path(__file__).parent.resolve(), "..", "resources", "icons", icon_name)
|
||||
icon = Image.open(icon_url + ".png").convert("RGB")
|
||||
if not load_selected_variant:
|
||||
return icon
|
||||
else:
|
||||
icon_selected = Image.open(icon_url + "_selected.png").convert("RGB")
|
||||
return (icon, icon_selected)
|
||||
|
||||
|
||||
|
||||
def load_image(image_name: str) -> Image.Image:
|
||||
image_url = os.path.join(pathlib.Path(__file__).parent.resolve(), "..", "resources", "img", image_name)
|
||||
image = Image.open(image_url).convert("RGB")
|
||||
|
||||
@@ -3,7 +3,7 @@ from PIL import Image, ImageDraw, ImageFont
|
||||
from typing import Tuple
|
||||
from gettext import gettext as _
|
||||
|
||||
from seedsigner.gui.components import Fonts, GUIConstants
|
||||
from seedsigner.gui.components import Fonts, GUIConstants, SeedSignerIconConstants
|
||||
from seedsigner.hardware.buttons import HardwareButtonsConstants
|
||||
|
||||
|
||||
@@ -30,58 +30,55 @@ class Keyboard:
|
||||
ENTER_RIGHT = "enter_right"
|
||||
|
||||
REGULAR_KEY_FONT = "regular"
|
||||
COMPACT_KEY_FONT = "compact"
|
||||
ICON_KEY_FONT = GUIConstants.ICON_FONT_NAME__SEEDSIGNER
|
||||
|
||||
# TRANSLATOR_NOTE: The abbreviated label for the special key <del> on a standard keyboard.
|
||||
del_label = _("del")
|
||||
KEY_BACKSPACE = {
|
||||
"code": "DEL",
|
||||
"letter": del_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.DELETE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 2,
|
||||
}
|
||||
# TRANSLATOR_NOTE: The abbreviated label for the special key <space> on a standard keyboard.
|
||||
space_label = _("space")
|
||||
|
||||
KEY_SPACE = {
|
||||
"code": "SPACE",
|
||||
"letter": space_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.SPACE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 1,
|
||||
}
|
||||
KEY_SPACE_2 = {
|
||||
"code": "SPACE",
|
||||
"letter": space_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.SPACE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 2,
|
||||
}
|
||||
KEY_SPACE_3 = {
|
||||
"code": "SPACE",
|
||||
"letter": space_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.SPACE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 3,
|
||||
}
|
||||
KEY_SPACE_4 = {
|
||||
"code": "SPACE",
|
||||
"letter": space_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.SPACE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 4,
|
||||
}
|
||||
KEY_SPACE_5 = {
|
||||
"code": "SPACE",
|
||||
"letter": space_label,
|
||||
"font": COMPACT_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.SPACE,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 5,
|
||||
}
|
||||
KEY_CURSOR_LEFT = {
|
||||
"code": "CURSOR_LEFT",
|
||||
"letter": "<",
|
||||
"font": REGULAR_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.CHEVRON_LEFT,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 1,
|
||||
}
|
||||
KEY_CURSOR_RIGHT = {
|
||||
"code": "CURSOR_RIGHT",
|
||||
"letter": ">",
|
||||
"font": REGULAR_KEY_FONT,
|
||||
"letter": SeedSignerIconConstants.CHEVRON_RIGHT,
|
||||
"font": ICON_KEY_FONT,
|
||||
"size": 1,
|
||||
}
|
||||
KEY_PREVIOUS_PAGE = {
|
||||
@@ -123,9 +120,11 @@ class Keyboard:
|
||||
|
||||
def render_key(self):
|
||||
font = self.keyboard.font
|
||||
text_height = self.keyboard.text_height
|
||||
if self.is_additional_key:
|
||||
if Keyboard.ADDITIONAL_KEYS[self.code]["font"] == Keyboard.COMPACT_KEY_FONT:
|
||||
font = self.keyboard.additonal_key_compact_font
|
||||
if Keyboard.ADDITIONAL_KEYS[self.code]["font"] == Keyboard.ICON_KEY_FONT:
|
||||
font = self.keyboard.icon_key_font
|
||||
text_height = self.keyboard.icon_key_height
|
||||
|
||||
outline_color = "#333"
|
||||
if not self.is_active:
|
||||
@@ -159,15 +158,12 @@ class Keyboard:
|
||||
radius=4
|
||||
)
|
||||
|
||||
# Fixed-width fonts will all have same height, ignoring below baseline (e.g. "Q" or "q")
|
||||
(left, top, right, bottom) = font.getbbox("X", anchor="ls")
|
||||
text_height = -1 * top
|
||||
self.keyboard.draw.text(
|
||||
(
|
||||
self.screen_x + int(self.keyboard.key_width * self.size / 2),
|
||||
self.screen_y + self.keyboard.key_height - int((self.keyboard.key_height - text_height)/2)
|
||||
),
|
||||
_(self.letter),
|
||||
self.letter,
|
||||
fill=font_color,
|
||||
font=font,
|
||||
anchor="ms"
|
||||
@@ -217,8 +213,15 @@ class Keyboard:
|
||||
|
||||
# Set up the rendering and state params
|
||||
self.active_keys = list(self.charset)
|
||||
self.icon_key_font = Fonts.get_font(GUIConstants.ICON_FONT_NAME__SEEDSIGNER, 26)
|
||||
|
||||
# Fixed-width fonts will all have same height, ignoring below baseline (e.g. "Q" or "q")
|
||||
(left, top, right, bottom) = self.font.getbbox("X", anchor="ls")
|
||||
self.text_height = -1 * top
|
||||
|
||||
(left, top, right, bottom) = self.icon_key_font.getbbox(SeedSignerIconConstants.DELETE + SeedSignerIconConstants.SPACE, anchor="ls")
|
||||
self.icon_key_height = -1 * top
|
||||
|
||||
self.additonal_key_compact_font = Fonts.get_font("RobotoCondensed-Bold", 18)
|
||||
self.x_start = rect[0]
|
||||
self.y_start = rect[1]
|
||||
self.x_gap = 2
|
||||
|
||||
@@ -309,7 +309,7 @@ class ButtonListScreen(BaseTopNavScreen):
|
||||
if len(self.button_data) == 1:
|
||||
button_list_height = button_height
|
||||
else:
|
||||
button_list_height = (len(self.button_data) * button_height) + (GUIConstants.COMPONENT_PADDING * (len(self.button_data) - 1))
|
||||
button_list_height = (len(self.button_data) * button_height) + (GUIConstants.LIST_ITEM_PADDING * (len(self.button_data) - 1))
|
||||
|
||||
if self.is_bottom_list:
|
||||
button_list_y = self.canvas_height - (button_list_height + GUIConstants.EDGE_PADDING)
|
||||
@@ -1013,9 +1013,12 @@ class WarningEdgesMixin:
|
||||
|
||||
@dataclass
|
||||
class WarningScreen(WarningEdgesMixin, LargeIconStatusScreen):
|
||||
"""
|
||||
Exclamation point icon + yellow WARNING color
|
||||
"""
|
||||
title: str = _mft("Caution")
|
||||
status_icon_name: str = SeedSignerIconConstants.WARNING
|
||||
status_color: str = "yellow"
|
||||
status_color: str = GUIConstants.WARNING_COLOR
|
||||
status_headline: str = _mft("Privacy Leak!") # The colored text under the alert icon
|
||||
button_data: list = field(default_factory=lambda: [ButtonOption("I Understand")])
|
||||
|
||||
@@ -1023,11 +1026,25 @@ class WarningScreen(WarningEdgesMixin, LargeIconStatusScreen):
|
||||
|
||||
@dataclass
|
||||
class DireWarningScreen(WarningScreen):
|
||||
"""
|
||||
Exclamation point icon + orange DIRE_WARNING color
|
||||
"""
|
||||
status_headline: str = _mft("Classified Info!") # The colored text under the alert icon
|
||||
status_color: str = GUIConstants.DIRE_WARNING_COLOR
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class ErrorScreen(WarningScreen):
|
||||
"""
|
||||
X icon + red ERROR color
|
||||
"""
|
||||
title: str = _mft("Error")
|
||||
status_icon_name: str = SeedSignerIconConstants.ERROR
|
||||
status_color: str = GUIConstants.ERROR_COLOR
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class ResetScreen(BaseTopNavScreen):
|
||||
def __post_init__(self):
|
||||
|
||||
@@ -6,7 +6,7 @@ from PIL.ImageOps import autocontrast
|
||||
from typing import List
|
||||
|
||||
from seedsigner.helpers.l10n import mark_for_translation as _mft
|
||||
from seedsigner.gui.components import Button, CheckboxButton, CheckedSelectionButton, FontAwesomeIconConstants, Fonts, GUIConstants, Icon, IconButton, IconTextLine, TextArea
|
||||
from seedsigner.gui.components import Button, CheckboxButton, CheckedSelectionButton, FontAwesomeIconConstants, Fonts, GUIConstants, Icon, IconButton, IconTextLine, SeedSignerIconConstants, TextArea
|
||||
from seedsigner.gui.screens.scan_screens import ScanScreen
|
||||
from seedsigner.gui.screens.screen import BaseScreen, BaseTopNavScreen, ButtonListScreen, ButtonOption
|
||||
from seedsigner.hardware.buttons import HardwareButtonsConstants
|
||||
@@ -82,7 +82,7 @@ class IOTestScreen(BaseTopNavScreen):
|
||||
self.components.append(self.joystick_click_button)
|
||||
|
||||
self.joystick_up_button = IconButton(
|
||||
icon_name=FontAwesomeIconConstants.ANGLE_UP,
|
||||
icon_name=SeedSignerIconConstants.CHEVRON_UP,
|
||||
icon_size=GUIConstants.ICON_INLINE_FONT_SIZE,
|
||||
width=input_button_width,
|
||||
height=input_button_height,
|
||||
@@ -93,7 +93,7 @@ class IOTestScreen(BaseTopNavScreen):
|
||||
self.components.append(self.joystick_up_button)
|
||||
|
||||
self.joystick_down_button = IconButton(
|
||||
icon_name=FontAwesomeIconConstants.ANGLE_DOWN,
|
||||
icon_name=SeedSignerIconConstants.CHEVRON_DOWN,
|
||||
icon_size=GUIConstants.ICON_INLINE_FONT_SIZE,
|
||||
width=input_button_width,
|
||||
height=input_button_height,
|
||||
@@ -104,9 +104,8 @@ class IOTestScreen(BaseTopNavScreen):
|
||||
self.components.append(self.joystick_down_button)
|
||||
|
||||
self.joystick_left_button = IconButton(
|
||||
text=FontAwesomeIconConstants.ANGLE_LEFT,
|
||||
font_name=GUIConstants.ICON_FONT_NAME__FONT_AWESOME,
|
||||
font_size=GUIConstants.ICON_INLINE_FONT_SIZE,
|
||||
icon_name=SeedSignerIconConstants.CHEVRON_LEFT,
|
||||
icon_size=GUIConstants.ICON_INLINE_FONT_SIZE,
|
||||
width=input_button_width,
|
||||
height=input_button_height,
|
||||
screen_x=dpad_center_x - input_button_width - GUIConstants.COMPONENT_PADDING,
|
||||
@@ -116,7 +115,7 @@ class IOTestScreen(BaseTopNavScreen):
|
||||
self.components.append(self.joystick_left_button)
|
||||
|
||||
self.joystick_right_button = IconButton(
|
||||
icon_name=FontAwesomeIconConstants.ANGLE_RIGHT,
|
||||
icon_name=SeedSignerIconConstants.CHEVRON_RIGHT,
|
||||
icon_size=GUIConstants.ICON_INLINE_FONT_SIZE,
|
||||
width=input_button_width,
|
||||
height=input_button_height,
|
||||
|
||||
@@ -140,7 +140,7 @@ class ToolsDiceEntropyEntryScreen(KeyboardScreen):
|
||||
self.rows = 3
|
||||
self.cols = 3
|
||||
self.keyboard_font_name = GUIConstants.ICON_FONT_NAME__FONT_AWESOME
|
||||
self.keyboard_font_size = None # Force auto-scaling to Key height
|
||||
self.keyboard_font_size = 36
|
||||
self.keys_charset = "".join([
|
||||
FontAwesomeIconConstants.DICE_ONE,
|
||||
FontAwesomeIconConstants.DICE_TWO,
|
||||
|
||||
@@ -460,16 +460,14 @@ class PSBTAddressVerificationFailedView(View):
|
||||
|
||||
def run(self):
|
||||
if self.is_multisig:
|
||||
title = _("Caution")
|
||||
# TRANSLATOR_NOTE: Variable is either "change" or "self-transfer".
|
||||
text = _("PSBT's {} address could not be verified with your multisig wallet descriptor.").format(_("change") if self.is_change else _("self-transfer"))
|
||||
text = _("PSBT's {} address could not be verified from wallet descriptor.").format(_("change") if self.is_change else _("self-transfer"))
|
||||
else:
|
||||
title = _("Suspicious PSBT")
|
||||
# TRANSLATOR_NOTE: Variable is either "change" or "self-transfer".
|
||||
text = _("PSBT's {} address could not be generated from your seed.").format(_("change") if self.is_change else _("self-transfer"))
|
||||
|
||||
DireWarningScreen(
|
||||
title=title,
|
||||
title=_("Suspicious PSBT"),
|
||||
status_headline=_("Address Verification Failed"),
|
||||
text=text,
|
||||
button_data=[ButtonOption("Discard PSBT")],
|
||||
|
||||
@@ -5,6 +5,7 @@ from gettext import gettext as _
|
||||
from seedsigner.helpers.l10n import mark_for_translation as _mft
|
||||
from seedsigner.models.settings import SettingsConstants
|
||||
from seedsigner.views.view import BackStackView, ErrorView, MainMenuView, NotYetImplementedView, View, Destination
|
||||
from seedsigner.gui.screens.screen import ButtonOption
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -163,13 +164,7 @@ class ScanView(View):
|
||||
# For now, don't even try to re-do the attempted operation, just reset and
|
||||
# start everything over.
|
||||
self.controller.resume_main_flow = None
|
||||
return Destination(ErrorView, view_args=dict(
|
||||
title=_("Error"),
|
||||
status_headline=_("Unknown QR Type"),
|
||||
text=_("QRCode is invalid or is a data format not yet supported."),
|
||||
button_text=_("Done"),
|
||||
next_destination=Destination(MainMenuView, clear_history=True),
|
||||
))
|
||||
return Destination(ScanInvalidQRTypeView)
|
||||
|
||||
return Destination(MainMenuView)
|
||||
|
||||
@@ -212,3 +207,23 @@ class ScanAddressView(ScanView):
|
||||
@property
|
||||
def is_valid_qr_type(self):
|
||||
return self.decoder.is_address
|
||||
|
||||
|
||||
|
||||
class ScanInvalidQRTypeView(View):
|
||||
def run(self):
|
||||
from seedsigner.gui.screens import WarningScreen
|
||||
|
||||
# TODO: This screen says "Error" but is intentionally using the WarningScreen in
|
||||
# order to avoid the perception that something is broken on our end. This should
|
||||
# either change to use the red ErrorScreen or the "Error" title should be
|
||||
# changed to something softer.
|
||||
self.run_screen(
|
||||
WarningScreen,
|
||||
title=_("Error"),
|
||||
status_headline=_("Unknown QR Type"),
|
||||
text=_("QRCode is invalid or is a data format not yet supported."),
|
||||
button_data=[ButtonOption("Done")],
|
||||
)
|
||||
|
||||
return Destination(MainMenuView, clear_history=True)
|
||||
|
||||
@@ -279,8 +279,9 @@ class SeedMnemonicInvalidView(View):
|
||||
def run(self):
|
||||
button_data = [self.EDIT, self.DISCARD]
|
||||
selected_menu_num = self.run_screen(
|
||||
WarningScreen,
|
||||
DireWarningScreen,
|
||||
title=_("Invalid Mnemonic!"),
|
||||
status_icon_name=SeedSignerIconConstants.ERROR,
|
||||
status_headline=None,
|
||||
text=_("Checksum failure; not a valid seed phrase."),
|
||||
show_back_button=False,
|
||||
@@ -1206,6 +1207,7 @@ class SeedBIP85InvalidChildIndexView(View):
|
||||
DireWarningScreen(
|
||||
title=_("BIP-85 Index Error"),
|
||||
show_back_button=False,
|
||||
status_icon_name=SeedSignerIconConstants.ERROR,
|
||||
status_headline=_("Invalid Child Index"),
|
||||
text=_("BIP-85 Child Index must be between 0 and 2^31-1."),
|
||||
button_data=[ButtonOption("Try Again")]
|
||||
@@ -1366,6 +1368,7 @@ class SeedWordsBackupTestMistakeView(View):
|
||||
selected_menu_num = DireWarningScreen(
|
||||
title=_("Verification Error"),
|
||||
show_back_button=False,
|
||||
status_icon_name=SeedSignerIconConstants.ERROR,
|
||||
status_headline=status_headline,
|
||||
button_data=button_data,
|
||||
text=text,
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Type
|
||||
from seedsigner.helpers.l10n import mark_for_translation as _mft
|
||||
from seedsigner.gui.components import SeedSignerIconConstants
|
||||
from seedsigner.gui.screens import RET_CODE__POWER_BUTTON, RET_CODE__BACK_BUTTON
|
||||
from seedsigner.gui.screens.screen import BaseScreen, ButtonOption, DireWarningScreen, LargeButtonScreen, PowerOffScreen, PowerOffNotRequiredScreen, ResetScreen, WarningScreen
|
||||
from seedsigner.gui.screens.screen import BaseScreen, ButtonOption, LargeButtonScreen, WarningScreen, ErrorScreen
|
||||
from seedsigner.models.settings import Settings, SettingsConstants
|
||||
from seedsigner.models.settings_definition import SettingsDefinition
|
||||
from seedsigner.models.threads import BaseThread
|
||||
@@ -245,6 +245,7 @@ class PowerOptionsView(View):
|
||||
|
||||
class RestartView(View):
|
||||
def run(self):
|
||||
from seedsigner.gui.screens.screen import ResetScreen
|
||||
thread = RestartView.DoResetThread()
|
||||
thread.start()
|
||||
self.run_screen(ResetScreen)
|
||||
@@ -270,6 +271,7 @@ class RestartView(View):
|
||||
|
||||
class PowerOffView(View):
|
||||
def run(self):
|
||||
from seedsigner.gui.screens.screen import PowerOffNotRequiredScreen
|
||||
self.run_screen(PowerOffNotRequiredScreen)
|
||||
return Destination(BackStackView)
|
||||
|
||||
@@ -300,6 +302,7 @@ class NotYetImplementedView(View):
|
||||
class ErrorView(View):
|
||||
title: str = _mft("Error")
|
||||
show_back_button: bool = True
|
||||
status_icon_name: str = SeedSignerIconConstants.ERROR
|
||||
status_headline: str = None
|
||||
text: str = None
|
||||
button_text: str = None
|
||||
@@ -307,8 +310,9 @@ class ErrorView(View):
|
||||
|
||||
def run(self):
|
||||
self.run_screen(
|
||||
WarningScreen,
|
||||
ErrorScreen,
|
||||
title=self.title,
|
||||
status_icon_name=self.status_icon_name,
|
||||
status_headline=self.status_headline,
|
||||
text=self.text,
|
||||
button_data=[ButtonOption(self.button_text)],
|
||||
@@ -324,9 +328,14 @@ class NetworkMismatchErrorView(ErrorView):
|
||||
|
||||
def __post_init__(self):
|
||||
from seedsigner.views.settings_views import SettingsEntryUpdateSelectionView
|
||||
self.title: str = _("Network Mismatch")
|
||||
self.show_back_button: bool = False
|
||||
self.button_text: str = _("Change Setting")
|
||||
|
||||
# TRANSLATOR_NOTE: The network setting (mainnet/testnet/regtest) doesn't match the provided derivation path
|
||||
self.title = _("Network Mismatch")
|
||||
self.status_icon_name = SeedSignerIconConstants.WARNING
|
||||
self.show_back_button = False
|
||||
|
||||
# TRANSLATOR_NOTE: Button option to alter a setting
|
||||
self.button_text = _("Change Setting")
|
||||
self.next_destination = Destination(SettingsEntryUpdateSelectionView, view_args=dict(attr_name=SettingsConstants.SETTING__NETWORK), clear_history=True)
|
||||
super().__post_init__()
|
||||
|
||||
@@ -342,10 +351,9 @@ class NetworkMismatchErrorView(ErrorView):
|
||||
class UnhandledExceptionView(View):
|
||||
error: list[str]
|
||||
|
||||
|
||||
def run(self):
|
||||
self.run_screen(
|
||||
DireWarningScreen,
|
||||
ErrorScreen,
|
||||
title=_("System Error"),
|
||||
status_headline=self.error[0],
|
||||
text=self.error[1] + "\n" + self.error[2],
|
||||
|
||||
@@ -26,7 +26,7 @@ patch('PIL.ImageFont.core.HAVE_RAQM', False).start()
|
||||
from seedsigner.controller import Controller
|
||||
from seedsigner.gui.renderer import Renderer
|
||||
from seedsigner.gui.screens.seed_screens import SeedAddPassphraseScreen
|
||||
from seedsigner.gui.toast import BaseToastOverlayManagerThread, RemoveSDCardToastManagerThread, SDCardStateChangeToastManagerThread
|
||||
from seedsigner.gui.toast import RemoveSDCardToastManagerThread, SDCardStateChangeToastManagerThread
|
||||
from seedsigner.hardware.microsd import MicroSD
|
||||
from seedsigner.helpers import embit_utils
|
||||
from seedsigner.models.decode_qr import DecodeQR
|
||||
@@ -36,9 +36,9 @@ from seedsigner.models.seed import Seed
|
||||
from seedsigner.models.settings import Settings
|
||||
from seedsigner.models.settings_definition import SettingsConstants, SettingsDefinition
|
||||
from seedsigner.views import (MainMenuView, PowerOptionsView, RestartView, NotYetImplementedView, UnhandledExceptionView,
|
||||
psbt_views, seed_views, settings_views, tools_views)
|
||||
psbt_views, seed_views, settings_views, tools_views, scan_views)
|
||||
from seedsigner.views.screensaver import OpeningSplashView
|
||||
from seedsigner.views.view import ErrorView, NetworkMismatchErrorView, OptionDisabledView, PowerOffView, View
|
||||
from seedsigner.views.view import NetworkMismatchErrorView, OptionDisabledView, PowerOffView
|
||||
|
||||
from .utils import ScreenshotComplete, ScreenshotConfig, ScreenshotRenderer
|
||||
|
||||
@@ -359,12 +359,7 @@ def generate_screenshots(locale):
|
||||
ScreenshotConfig(UnhandledExceptionView, dict(error=["IndexError", "line 1, in some_buggy_code.py", "list index out of range"])),
|
||||
ScreenshotConfig(NetworkMismatchErrorView, dict(derivation_path="m/84'/1'/0'")),
|
||||
ScreenshotConfig(OptionDisabledView, dict(settings_attr=SettingsConstants.SETTING__MESSAGE_SIGNING)),
|
||||
ScreenshotConfig(ErrorView, dict(
|
||||
title="Error",
|
||||
status_headline="Unknown QR Type",
|
||||
text="QRCode is invalid or is a data format not yet supported.",
|
||||
button_text="Back",
|
||||
)),
|
||||
ScreenshotConfig(scan_views.ScanInvalidQRTypeView)
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -646,7 +646,7 @@ class TestMessageSigningFlows(FlowTest):
|
||||
FlowStep(seed_views.SeedFinalizeView, button_data_selection=seed_views.SeedFinalizeView.FINALIZE),
|
||||
FlowStep(seed_views.SeedOptionsView, button_data_selection=seed_views.SeedOptionsView.SIGN_MESSAGE),
|
||||
FlowStep(scan_views.ScanView, before_run=load_invalid_signmessage_qr), # simulate read message QR; ret val is ignored
|
||||
FlowStep(ErrorView),
|
||||
FlowStep(scan_views.ScanInvalidQRTypeView),
|
||||
FlowStep(MainMenuView),
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user