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

[Screen Redesign] Light rearrangement of SeedAddressVerificationSuccess #651

Merged
Merged
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
58 changes: 28 additions & 30 deletions l10n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: seedsigner 0.8.5\n"
"Project-Id-Version: seedsigner 0.8.5-rc1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-11-03 14:15-0600\n"
"POT-Creation-Date: 2024-12-30 13:43-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -121,9 +121,8 @@ msgid "OP_RETURN"
msgstr ""

#. Label for a change output in the PSBT Overview flow diagram
#. Used in a sentence describing the address type (change or receive)
#: src/seedsigner/gui/screens/psbt_screens.py
#: src/seedsigner/views/psbt_views.py src/seedsigner/views/seed_views.py
#: src/seedsigner/views/psbt_views.py
msgid "change"
msgstr ""

Expand Down Expand Up @@ -204,11 +203,15 @@ msgstr ""
msgid "Darker"
msgstr ""

#: src/seedsigner/gui/screens/screen.py src/seedsigner/views/seed_views.py
#: src/seedsigner/gui/screens/screen.py
#: src/seedsigner/gui/screens/seed_screens.py
#: src/seedsigner/views/seed_views.py
msgid "Success!"
msgstr ""

#: src/seedsigner/gui/screens/screen.py src/seedsigner/views/seed_views.py
#: src/seedsigner/gui/screens/screen.py
#: src/seedsigner/gui/screens/seed_screens.py
#: src/seedsigner/views/seed_views.py
msgid "OK"
msgstr ""

Expand Down Expand Up @@ -391,6 +394,25 @@ msgstr ""
msgid "Checking address {}"
msgstr ""

#: src/seedsigner/gui/screens/seed_screens.py
msgid "Address Verified"
msgstr ""

#. Describes the address type (change or receive)
#: src/seedsigner/gui/screens/seed_screens.py
msgid "change address"
msgstr ""

#. Describes the address type (change or receive)
#: src/seedsigner/gui/screens/seed_screens.py
msgid "receive address"
msgstr ""

#. Describes the address index (e.g. "index 7")
#: src/seedsigner/gui/screens/seed_screens.py
msgid "index {}"
msgstr ""

#: src/seedsigner/gui/screens/seed_screens.py
msgid "Multisig Verification"
msgstr ""
Expand Down Expand Up @@ -1262,30 +1284,6 @@ msgstr ""
msgid "Can't validate a single sig addr without specifying a seed"
msgstr ""

#: src/seedsigner/views/seed_views.py
msgid "multisig"
msgstr ""

#. Inserts the seed fingerprint
#: src/seedsigner/views/seed_views.py
msgid "seed {}"
msgstr ""

#. Used in a sentence describing the address type (change or receive)
#: src/seedsigner/views/seed_views.py
msgid "receive"
msgstr ""

#. Address verification success message (e.g. "bc1qabc = seed 12345678's
#. receive address #0.")
#: src/seedsigner/views/seed_views.py
msgid "{} = {}'s {} address #{}."
msgstr ""

#: src/seedsigner/views/seed_views.py
msgid "Address Verified"
msgstr ""

#: src/seedsigner/views/seed_views.py
msgid "Scan Descriptor"
msgstr ""
Expand Down
17 changes: 9 additions & 8 deletions src/seedsigner/gui/screens/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def __post_init__(self):
active_button_label = button_option.active_button_label

else:
raise Exception("Refactor needed!")
raise Exception("Refactor to ButtonOption approach needed!")

button_kwargs = dict(
text=_(button_label), # Wrap here for just-in-time translations
Expand Down Expand Up @@ -923,13 +923,14 @@ def __post_init__(self):
self.components.append(self.warning_headline_textarea)
next_y = next_y + self.warning_headline_textarea.height

self.components.append(TextArea(
height=self.buttons[0].screen_y - next_y,
text=_(self.text),
width=self.canvas_width,
edge_padding=self.text_edge_padding, # Don't render all the way up to the far left/right edges
screen_y=next_y,
))
if self.text:
self.components.append(TextArea(
height=self.buttons[0].screen_y - next_y,
text=_(self.text),
width=self.canvas_width,
edge_padding=self.text_edge_padding, # Don't render all the way up to the far left/right edges
screen_y=next_y,
))



Expand Down
62 changes: 52 additions & 10 deletions src/seedsigner/gui/screens/seed_screens.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import math
import logging
import math
import time

from dataclasses import dataclass
from gettext import gettext as _
from PIL import Image, ImageDraw, ImageFilter
from typing import List

from PIL import Image, ImageDraw, ImageFilter
from seedsigner.gui.renderer import Renderer
from seedsigner.hardware.buttons import HardwareButtons, HardwareButtonsConstants
from seedsigner.helpers.qr import QR
from seedsigner.models.threads import BaseThread, ThreadsafeCounter

from .screen import RET_CODE__BACK_BUTTON, BaseScreen, BaseTopNavScreen, ButtonListScreen, ButtonOption, KeyboardScreen, WarningEdgesMixin
from ..components import (Button, FontAwesomeIconConstants, Fonts, FormattedAddress, IconButton,
from seedsigner.gui.components import (Button, FontAwesomeIconConstants, Fonts, FormattedAddress, IconButton,
IconTextLine, SeedSignerIconConstants, TextArea, GUIConstants, reflow_text_into_pages)

from seedsigner.gui.keyboard import Keyboard, TextEntryDisplay
from seedsigner.hardware.buttons import HardwareButtons, HardwareButtonsConstants
from seedsigner.gui.renderer import Renderer
from seedsigner.models.threads import BaseThread, ThreadsafeCounter

from .screen import RET_CODE__BACK_BUTTON, BaseScreen, BaseTopNavScreen, ButtonListScreen, ButtonOption, KeyboardScreen, LargeIconStatusScreen, WarningEdgesMixin

logger = logging.getLogger(__name__)



@dataclass
class SeedMnemonicEntryScreen(BaseTopNavScreen):
initial_letters: list = None
Expand Down Expand Up @@ -1057,7 +1057,6 @@ def _run(self):
self.hw_button2.render()

self.renderer.show_image()




Expand Down Expand Up @@ -1512,6 +1511,49 @@ def run(self):



@dataclass
class SeedAddressVerificationSuccessScreen(LargeIconStatusScreen):
address: str = None
verified_index: int = None
verified_index_is_change: bool = None


def __post_init__(self):
# Customize defaults
self.title = _("Success!")
self.status_headline = _("Address Verified")
self.button_data = [ButtonOption("OK")]
self.is_bottom_list = True
self.show_back_button = False
super().__post_init__()

if self.verified_index_is_change:
# TRANSLATOR_NOTE: Describes the address type (change or receive)
address_type = _("change address")
else:
# TRANSLATOR_NOTE: Describes the address type (change or receive)
address_type = _("receive address")

self.components.append(FormattedAddress(
screen_y=self.components[-1].screen_y + self.components[-1].height + GUIConstants.COMPONENT_PADDING,
address=self.address,
max_lines=1, # Use abbreviated format w/ellipsis
))

self.components.append(TextArea(
text=address_type,
screen_y=self.components[-1].screen_y + self.components[-1].height + 2*GUIConstants.COMPONENT_PADDING,
))

# TRANSLATOR_NOTE: Describes the address index (e.g. "index 7")
index_str = _("index {}").format(self.verified_index)
self.components.append(TextArea(
text=index_str,
screen_y=self.components[-1].screen_y + self.components[-1].height + GUIConstants.COMPONENT_PADDING,
))



@dataclass
class LoadMultisigWalletDescriptorScreen(ButtonListScreen):
def __post_init__(self):
Expand Down
34 changes: 5 additions & 29 deletions src/seedsigner/views/seed_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1977,36 +1977,12 @@ def __init__(self, seed_num: int):


def run(self):
from seedsigner.gui.screens.screen import LargeIconStatusScreen
address = self.controller.unverified_address["address"]
sig_type = self.controller.unverified_address["sig_type"]
verified_index = self.controller.unverified_address["verified_index"]
verified_index_is_change = self.controller.unverified_address["verified_index_is_change"]

if sig_type == SettingsConstants.MULTISIG:
source = _("multisig")
else:
# TRANSLATOR_NOTE: Inserts the seed fingerprint
source = _("seed {}").format(self.seed.get_fingerprint())

# TRANSLATOR_NOTE: Used in a sentence describing the address type (change or receive)
change_text = _("change")

# TRANSLATOR_NOTE: Used in a sentence describing the address type (change or receive)
receive_text = _("receive")

# TRANSLATOR_NOTE: Address verification success message (e.g. "bc1qabc = seed 12345678's receive address #0.")
text = _("{} = {}'s {} address #{}.").format(
address[:7],
source,
change_text if verified_index_is_change else receive_text,
verified_index
self.run_screen(
seed_screens.SeedAddressVerificationSuccessScreen,
address = self.controller.unverified_address["address"],
verified_index = self.controller.unverified_address["verified_index"],
verified_index_is_change = self.controller.unverified_address["verified_index_is_change"],
)
LargeIconStatusScreen(
status_headline=_("Address Verified"),
text=text,
show_back_button=False,
).display()

return Destination(MainMenuView)

Expand Down
Loading