Skip to content

Commit

Permalink
SFT-1728: incorporated comments and ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mjg-foundation committed Jul 4, 2024
1 parent 140a055 commit 68e88ee
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ async def generate_word(self):
import microns
from utils import recolor
from styles.colors import HIGHLIGHT_TEXT_HEX
from common import settings

last_word = get_last_word(self.selected_words)
styled_last_word = recolor(HIGHLIGHT_TEXT_HEX, last_word)
text = 'Your final word is\n{}.\n\nImport and save this seed?'.format(styled_last_word)
save_wording = ' and save' if not settings.temporary_mode else ''
text = 'Your final word is\n{}.\n\nImport{} this seed?'.format(styled_last_word, save_wording)
result = await InfoPage(text=text,
left_micron=microns.Retry).show()

Expand Down
14 changes: 9 additions & 5 deletions ports/stm32/boards/Passport/modules/flows/restore_seed_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from tasks import save_seed_task
from public_constants import SEED_LENGTHS
import lvgl as lv
from common import settings


class RestoreSeedFlow(Flow):
Expand All @@ -36,13 +37,14 @@ def __init__(self, refresh_cards_when_done=False, autobackup=True, full_backup=F
async def choose_temporary(self):
from pages import ChooserPage

text = 'Would you like to make a permanent seed, or a temporary seed?'
text = 'Import and save a seed, or import one temporarily?'
options = [{'label': 'Permanent', 'value': True},
{'label': 'Temporary', 'value': False}]

permanent = await ChooserPage(text=text,
card_header={'title': 'Seed Type'},
options=options).show()
icon=lv.LARGE_ICON_QUESTION,
options=options,
icon_pad=-6).show()
if permanent is None:
self.set_result(False)
return
Expand All @@ -58,7 +60,7 @@ async def explain_temporary(self):

result = await InfoPage(
icon=lv.LARGE_ICON_SEED,
text='This temporary seed will not be saved, so be sure you have a backup, or create one during setup',
text='Temporary seeds are not saved to Passport. Ensure you have a robust backup in place.',
left_micron=microns.Back,
right_micron=microns.Forward).show()

Expand Down Expand Up @@ -174,7 +176,9 @@ async def enter_seed_words(self):
self.seed_words.append(last_word)

if insufficient_randomness(self.seed_words):
text = "This seed contains 3 or more repeat words and may put funds at risk.\n\nSave seed and continue?"
save_wording = 'Save' if not settings.temporary_mode else 'Import'
text = "This seed contains 3 or more repeat words and may put funds at risk.\n\n{} seed and continue?" \
.format(save_wording)
result2 = await ErrorPage(text=text,
left_micron=microns.Cancel).show()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def clear_seed(self):
from tasks import delay_task
from pages import SuccessPage

await spinner_task('Clearing Temporary Seed', delay_task, args=[1000, False])
await spinner_task('Clearing temporary seed', delay_task, args=[1000, False])
await SuccessPage(text='Temporary seed cleared').show()
settings.exit_temporary_mode()

Expand Down
5 changes: 3 additions & 2 deletions ports/stm32/boards/Passport/modules/pages/chooser_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
self, card_header=None, statusbar=None, options=[],
initial_value=None, on_change=None, scroll_fix=False,
icon=None, icon_color=CHOOSER_ICON, text=None, center=False, item_icon='ICON_SMALL_CHECKMARK',
left_micron=None, right_micron=None):
left_micron=None, right_micron=None, icon_pad=0):

from views import ListItem, View
import passport
Expand All @@ -48,6 +48,7 @@ def __init__(
self.text = text
self.center = center
self.item_icon = item_icon
self.icon_pad = icon_pad

# If initial value is given, then select it, else select the first item
if self.initial_value is not None:
Expand All @@ -72,7 +73,7 @@ def __init__(
with Stylize(self.icon_view) as default:
if self.icon_color is not None:
default.img_recolor(self.icon_color)
top = 20 if passport.IS_COLOR else 12
top = (20 if passport.IS_COLOR else 12) + self.icon_pad
default.pad(top=top, bottom=12)
self.add_child(self.icon_view)

Expand Down
2 changes: 1 addition & 1 deletion ports/stm32/boards/Passport/modules/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def update_cards(self,
# print('account[{}]={}'.format(account, i))

account_card = {
'right_icon': 'ICON_BITCOIN',
'right_icon': 'ICON_BITCOIN' if not common.settings.temporary_mode else 'ICON_SEED',
'header_color': LIGHT_GREY,
'header_fg_color': LIGHT_TEXT,
'statusbar': {'title': 'ACCOUNT', 'icon': 'ICON_FOLDER', 'fg_color': get_account_fg(account)},
Expand Down

0 comments on commit 68e88ee

Please sign in to comment.