-
Notifications
You must be signed in to change notification settings - Fork 38
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
Adds "< " to "Back" menu items #420
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #420 +/- ##
==========================================
Coverage ? 94.63%
==========================================
Files ? 57
Lines ? 7078
Branches ? 0
==========================================
Hits ? 6698
Misses ? 380
Partials ? 0 ☔ View full report in Codecov by Sentry. |
The |
Hi @jdlcdl ! Can we create a constant for Back and reuse it everywhere? |
src/krux/pages/__init__.py
Outdated
@@ -109,7 +109,7 @@ def load_method(self): | |||
t("Load from SD card"), | |||
None if not self.has_sd_card() else lambda: None, | |||
), | |||
(t("Back"), lambda: None), | |||
("< " + t("Back"), lambda: MENU_EXIT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd item should return None to express that it's ignored.
src/krux/pages/__init__.py
Outdated
@@ -904,7 +904,7 @@ def choose_len_mnemonic(ctx): | |||
[ | |||
(t("12 words"), lambda: MENU_EXIT), | |||
(t("24 words"), lambda: MENU_EXIT), | |||
(t("Back"), lambda: MENU_EXIT), | |||
("< " + t("Back"), lambda: MENU_EXIT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all 2nd items should return None to express that they're ignored, or they could return num words (or None) if they're not ignored.
src/krux/pages/home_pages/home.py
Outdated
@@ -228,7 +228,7 @@ def _sign_menu(self): | |||
t("Sign to SD card"), | |||
None if not self.has_sd_card() else lambda: None, | |||
), | |||
(t("Back"), lambda: None), | |||
("< " + t("Back"), lambda: MENU_EXIT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd item should be None to express that it's ignored.
@@ -199,7 +199,7 @@ def sign_message(self): | |||
t("Sign to SD card"), | |||
None if not self.has_sd_card() else lambda: None, | |||
), | |||
(t("Back"), lambda: None), | |||
("< " + t("Back"), lambda: MENU_EXIT), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd item should be None to express that it's ignored.
I was trying to standardize exiting menus with this MENU_EXIT status, but often it is ignored and doesn't matter. I wasn't intending to alter behavior. I'll move these back to the way they were because I'm not sure if they're inspected elsewhere. |
I was just asking because I didn't know too, but if you tested it's ok! |
Still not ready, but working in that direction. latest commit tries to implement a cta_back() reusable in pages/init.py but to pass tests, couldn't use it in one place, and to pass i18n checks, had to feed it i18n food at least once. Still a work in progress, and have not tested it on device (only limited testing in simulator so far). It's leading me to believe that "Menu" class might take an optional cta_back param and set this up by default so that every menu doesn't always need it; then it would be easier to move from Menu item to Page later. |
Altering to ready-for-review.
|
Reviewed, tested and merged. Thank you! |
Description
Perhaps with another "arrow" glyph, this will look nicer, but "< Back" is still very identifiable as a special menu item.
Also changed some tuples' 2nd item to the more standard "lambda: MENU_EXIT" instead of "lambda: None"
What is the purpose of this pull request?