refactor(mockui): naming & structural cleanup#22
Merged
maggo83 merged 6 commits intok9ert:mainfrom Mar 11, 2026
Merged
Conversation
…ig.json everywhere
…oller.py -> specter_gui.py) The class and module name NavigationController was too generic and didn't reflect the role of this central UI object. SpecterGui better expresses that this is the top-level GUI root for the Specter device UI. - Renamed basic/navigation_controller.py to basic/specter_gui.py - Renamed class NavigationController to SpecterGui throughout - Updated all imports, __all__ exports, comments and docstrings - Updated README docs and MOCKUI_PROGRESS.md
…implementations The classes in helpers/ (UIState, SpecterState, Battery, Wallet) are stub implementations that will later be replaced by real Specter business logic. Renaming to stubs/ makes that intent explicit. - Renamed MockUI/helpers/ directory to MockUI/stubs/ - Updated all imports across basic/, wallet/, __init__.py and tests/
…rthands
TitledScreen now exposes self.gui (the SpecterGui root) instead of
self.parent, avoiding confusion with LVGL's widget parent concept.
Subclasses should use:
self.gui - for SpecterGui-specific methods (show_menu, refresh_ui,
ui_state, keyboard_manager, change_language)
self.state - shorthand for gui.specter_state (no bypass)
self.i18n - shorthand for gui.i18n (no bypass)
self.on_navigate - shorthand for gui.on_navigate (no bypass)
- Removed redundant setattr(self.parent.specter_state, ...) in
interfaces_menu (self.state is the same object)
- Fixed language_menu, settings_menu to use self.i18n shorthand
- Fixed all keyboard_manager references to use self.gui
…e(None) for back - DeviceBar, WalletBar: rename self.parent -> self.gui (consistent with TitledScreen refactor); keep self.gui.show_menu() for forward navigation to specific menus (more readable at the call site than on_navigate) - locked_menu, generate_seedphrase_menu: replace self.gui.show_menu(None) with self.on_navigate(None) — these are "go back" calls and should use the standard TitledScreen callback
…u to TitledScreen Both classes are forms, not menus — they don't use get_menu_items() or _build_menu_items() at all, only post_init(). Subclassing GenericMenu was semantically misleading and added unnecessary indirection. Changes: - Inherit from TitledScreen instead of GenericMenu - Replace TITLE_KEY + post_init(t, state) with a plain __init__(parent) - Translate title via parent.i18n.t() before calling super().__init__() - Set up body flex layout explicitly (was done implicitly by GenericMenu) - Use t = self.i18n.t local alias for translations (self.state accessed directly) - Drop unused imports: RED, ORANGE, GREEN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & Why
Six focused refactoring commits on top of PR #21, cleaning up naming
inconsistencies and fixing a structural mistake in the MockUI module.
No behaviour changes — purely cosmetic/structural.
Commits
NavigationController→SpecterGuiThe class is the top-level GUI root widget, not a generic controller.
Renamed file and class across all call sites.
helpers/→stubs/The directory holds placeholder implementations of
UIState,SpecterState,Battery,Wallet— to be replaced by real Specterbusiness logic later.
stubs/makes that intent explicit.self.parent→self.guiinTitledScreen+ enforce shorthandsself.parentclashed with LVGL's own widget-parent concept, causingconfusion. Renamed to
self.gui. Also audited all screen subclasses toconsistently use the
self.state,self.i18n,self.on_navigateshorthands instead of bypassing them.
parent→guiinDeviceBar/WalletBar;on_navigate(None)for backSame rename in the bar classes. Standardised back navigation to always
use
self.on_navigate(None)in screens.GenerateSeedMenu/PassphraseMenu:GenericMenu→TitledScreenBoth classes inherited from
GenericMenubut never used itsmenu-building machinery (
_build_menu_items). They are forms, notmenus —
TitledScreenis the correct base class.gitignore:
**/translation_keys.pyand**/language_config.jsonBoth are auto-generated by
make sync-i18n/make build-i18n.Using repo-wide globs instead of path-specific entries.
Tests
✅ 119 unit tests
✅ 9 device integration tests (STM32F469 Discovery board)