mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
bugfix: don't set class attr to dynamic method
This commit is contained in:
@@ -1360,8 +1360,12 @@ class Button(BaseComponent):
|
||||
text_y_offset: int = 0
|
||||
background_color: str = GUIConstants.BUTTON_BACKGROUND_COLOR
|
||||
selected_color: str = GUIConstants.ACCENT_COLOR
|
||||
|
||||
# Cannot define these class attrs w/the get_*_font_*() methods because the attrs will
|
||||
# not be dynamically reinterpreted after initial class import.
|
||||
font_name: str = None
|
||||
font_size: int = None
|
||||
|
||||
font_color: str = GUIConstants.BUTTON_FONT_COLOR
|
||||
selected_font_color: str = GUIConstants.BUTTON_SELECTED_FONT_COLOR
|
||||
outline_color: str = None
|
||||
@@ -1674,8 +1678,12 @@ class TopNav(BaseComponent):
|
||||
background_color: str = GUIConstants.BACKGROUND_COLOR
|
||||
icon_name: str = None
|
||||
icon_color: str = GUIConstants.BODY_FONT_COLOR
|
||||
font_name: str = GUIConstants.get_top_nav_title_font_name()
|
||||
font_size: int = GUIConstants.get_top_nav_title_font_size()
|
||||
|
||||
# Cannot define these class attrs w/the get_*_font_*() methods because the attrs will
|
||||
# not be dynamically reinterpreted after initial class import.
|
||||
font_name: str = None
|
||||
font_size: int = None
|
||||
|
||||
font_color: str = GUIConstants.BODY_FONT_COLOR
|
||||
show_back_button: bool = True
|
||||
show_power_button: bool = False
|
||||
@@ -1688,7 +1696,6 @@ class TopNav(BaseComponent):
|
||||
|
||||
if not self.font_size:
|
||||
self.font_size = GUIConstants.get_top_nav_title_font_size()
|
||||
print(f"self.font_size: {self.font_size}")
|
||||
|
||||
super().__post_init__()
|
||||
if not self.width:
|
||||
|
||||
@@ -289,8 +289,12 @@ class ButtonListScreen(BaseTopNavScreen):
|
||||
selected_button: int = 0
|
||||
is_button_text_centered: bool = True
|
||||
is_bottom_list: bool = False
|
||||
|
||||
# Cannot define these class attrs w/the get_*_font_*() methods because the attrs will
|
||||
# not be dynamically reinterpreted after initial class import.
|
||||
button_font_name: str = None
|
||||
button_font_size: int = None
|
||||
|
||||
button_selected_color: str = GUIConstants.ACCENT_COLOR
|
||||
|
||||
# Params for version of list used for Settings
|
||||
@@ -554,8 +558,12 @@ class ButtonListScreen(BaseTopNavScreen):
|
||||
@dataclass
|
||||
class LargeButtonScreen(BaseTopNavScreen):
|
||||
button_data: list = None
|
||||
|
||||
# Cannot define these class attrs w/the get_*_font_*() methods because the attrs will
|
||||
# not be dynamically reinterpreted after initial class import.
|
||||
button_font_name: str = None
|
||||
button_font_size: int = None
|
||||
|
||||
button_selected_color: str = GUIConstants.ACCENT_COLOR
|
||||
selected_button: int = 0
|
||||
|
||||
@@ -563,6 +571,7 @@ class LargeButtonScreen(BaseTopNavScreen):
|
||||
if not self.button_font_name:
|
||||
self.button_font_name = GUIConstants.get_button_font_name()
|
||||
if not self.button_font_size:
|
||||
# TODO: Define the +2 with a constant or via a formula (e.g. int(x * 1.1))
|
||||
self.button_font_size = GUIConstants.get_button_font_size() + 2
|
||||
|
||||
super().__post_init__()
|
||||
|
||||
@@ -183,7 +183,12 @@ def generate_screenshots(locale):
|
||||
if settings_entry.visibility == SettingsConstants.VISIBILITY__HIDDEN:
|
||||
continue
|
||||
|
||||
settings_views_list.append(ScreenshotConfig(settings_views.SettingsEntryUpdateSelectionView, dict(attr_name=settings_entry.attr_name), screenshot_name=f"SettingsEntryUpdateSelectionView_{settings_entry.attr_name}"))
|
||||
if settings_entry.attr_name == SettingsConstants.SETTING__LOCALE:
|
||||
# Locale selection has its own dedicated View
|
||||
settings_views_list.append(ScreenshotConfig(settings_views.LocaleSelectionView))
|
||||
else:
|
||||
# Generic SettingsEntry selection View
|
||||
settings_views_list.append(ScreenshotConfig(settings_views.SettingsEntryUpdateSelectionView, dict(attr_name=settings_entry.attr_name), screenshot_name=f"SettingsEntryUpdateSelectionView_{settings_entry.attr_name}"))
|
||||
|
||||
settingsqr_data_persistent = f"settings::v1 name=English_noob_mode persistent=E coords=spa,spd denom=thr network=M qr_density=M xpub_export=E sigs=ss scripts=nat xpub_details=E passphrase=E camera=0 compact_seedqr=E bip85=D priv_warn=E dire_warn=E partners=E locale={locale}"
|
||||
settingsqr_data_not_persistent = f"settings::v1 name=Mode_Ephemeral persistent=D coords=spa,spd denom=thr network=M qr_density=M xpub_export=E sigs=ss scripts=nat xpub_details=E passphrase=E camera=0 compact_seedqr=E bip85=D priv_warn=E dire_warn=E partners=E locale={locale}"
|
||||
|
||||
@@ -13,7 +13,6 @@ from seedsigner.views.view import MainMenuView
|
||||
class TestL10nFlows(FlowTest):
|
||||
def test_change_locale(self):
|
||||
settings_entry = SettingsDefinition.get_settings_entry(SettingsConstants.SETTING__LOCALE)
|
||||
spanish_display_name = SettingsConstants.ALL_LOCALES[SettingsConstants.LOCALE__SPANISH]
|
||||
|
||||
# Initially we get English
|
||||
assert _(MainMenuView.SCAN.button_label) == "Scan"
|
||||
|
||||
Reference in New Issue
Block a user