Skip to content

Commit 7edcd33

Browse files
committed
Improve DireWarning vs Error usage and color consistency
1 parent 5e16c98 commit 7edcd33

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

src/seedsigner/gui/screens/screen.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1013,21 +1013,38 @@ def __post_init__(self):
10131013

10141014
@dataclass
10151015
class WarningScreen(WarningEdgesMixin, LargeIconStatusScreen):
1016+
"""
1017+
Exclamation point icon + yellow WARNING color
1018+
"""
10161019
title: str = _mft("Caution")
10171020
status_icon_name: str = SeedSignerIconConstants.WARNING
1018-
status_color: str = "yellow"
1021+
status_color: str = GUIConstants.WARNING_COLOR
10191022
status_headline: str = _mft("Privacy Leak!") # The colored text under the alert icon
10201023
button_data: list = field(default_factory=lambda: [ButtonOption("I Understand")])
10211024

10221025

10231026

10241027
@dataclass
10251028
class DireWarningScreen(WarningScreen):
1029+
"""
1030+
Exclamation point icon + orange DIRE_WARNING color
1031+
"""
10261032
status_headline: str = _mft("Classified Info!") # The colored text under the alert icon
10271033
status_color: str = GUIConstants.DIRE_WARNING_COLOR
10281034

10291035

10301036

1037+
@dataclass
1038+
class ErrorScreen(WarningScreen):
1039+
"""
1040+
X icon + red ERROR color
1041+
"""
1042+
title: str = _mft("Error")
1043+
status_icon_name: str = SeedSignerIconConstants.ERROR
1044+
status_color: str = GUIConstants.ERROR_COLOR
1045+
1046+
1047+
10311048
@dataclass
10321049
class ResetScreen(BaseTopNavScreen):
10331050
def __post_init__(self):

src/seedsigner/views/psbt_views.py

-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ def run(self):
469469
DireWarningScreen(
470470
title=_("Suspicious PSBT"),
471471
status_headline=_("Address Verification Failed"),
472-
status_icon_name=SeedSignerIconConstants.ERROR,
473472
text=text,
474473
button_data=[ButtonOption("Discard PSBT")],
475474
show_back_button=False,

src/seedsigner/views/view.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from seedsigner.helpers.l10n import mark_for_translation as _mft
66
from seedsigner.gui.components import SeedSignerIconConstants
77
from seedsigner.gui.screens import RET_CODE__POWER_BUTTON, RET_CODE__BACK_BUTTON
8-
from seedsigner.gui.screens.screen import BaseScreen, ButtonOption, DireWarningScreen, LargeButtonScreen, PowerOffScreen, PowerOffNotRequiredScreen, ResetScreen, WarningScreen
8+
from seedsigner.gui.screens.screen import BaseScreen, ButtonOption, LargeButtonScreen, WarningScreen, ErrorScreen
99
from seedsigner.models.settings import Settings, SettingsConstants
1010
from seedsigner.models.settings_definition import SettingsDefinition
1111
from seedsigner.models.threads import BaseThread
@@ -245,6 +245,7 @@ def run(self):
245245

246246
class RestartView(View):
247247
def run(self):
248+
from seedsigner.gui.screens.screen import ResetScreen
248249
thread = RestartView.DoResetThread()
249250
thread.start()
250251
self.run_screen(ResetScreen)
@@ -270,6 +271,7 @@ def run(self):
270271

271272
class PowerOffView(View):
272273
def run(self):
274+
from seedsigner.gui.screens.screen import PowerOffNotRequiredScreen
273275
self.run_screen(PowerOffNotRequiredScreen)
274276
return Destination(BackStackView)
275277

@@ -308,7 +310,7 @@ class ErrorView(View):
308310

309311
def run(self):
310312
self.run_screen(
311-
WarningScreen,
313+
ErrorScreen,
312314
title=self.title,
313315
status_icon_name=self.status_icon_name,
314316
status_headline=self.status_headline,
@@ -349,12 +351,10 @@ def __post_init__(self):
349351
class UnhandledExceptionView(View):
350352
error: list[str]
351353

352-
353354
def run(self):
354355
self.run_screen(
355-
DireWarningScreen,
356+
ErrorScreen,
356357
title=_("System Error"),
357-
status_icon_name=SeedSignerIconConstants.ERROR,
358358
status_headline=self.error[0],
359359
text=self.error[1] + "\n" + self.error[2],
360360
allow_text_overflow=True, # Fit what we can, let the rest go off the edges

0 commit comments

Comments
 (0)