What changed, and why it matters
This is a minor code cleanup (DRY = Don't Repeat Yourself) in the user interface of a Bitcoin seed-signing device. It merges two nearly identical blocks of code that update the on-screen title into one shared block. There is no security-relevant change.
No security action needed. Treat as routine code-quality maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors KeyboardScreen in src/seedsigner/gui/screens/screen.py. Previously, the title-update logic (calling update_title(), rendering a TextArea, and rendering top-nav buttons) was duplicated for both delete and add input paths. The refactor introduces a boolean flag title_needs_update, sets it on delete/add, and executes the update once after the input branch. Behavior is functionally equivalent; no security logic is modified.
Changed components
src/seedsigner/gui/screens/screen.pyKeyboardScreen classInspect captured patch +13 / −19
diff --git a/src/seedsigner/gui/screens/screen.py b/src/seedsigner/gui/screens/screen.py
index a1493c4..30b634f 100644
--- a/src/seedsigner/gui/screens/screen.py
+++ b/src/seedsigner/gui/screens/screen.py
@@ -1226,6 +1226,8 @@ class KeyboardScreen(BaseTopNavScreen):
)
with self.renderer.lock:
+ # Track if we need to update the title after input changes
+ title_needs_update = False
# Check possible exit conditions
if self.top_nav.is_selected and input == HardwareButtonsConstants.KEY_PRESS:
return RET_CODE__BACK_BUTTON
@@ -1271,16 +1273,7 @@ class KeyboardScreen(BaseTopNavScreen):
if len(self.user_input) > 0:
self.user_input = self.user_input[:-1]
self.cursor_position -= 1
-
- # Update the title to reflect decremented dice roll count
- if self.update_title():
- TextArea(
- text=self.title,
- font_name=GUIConstants.get_top_nav_title_font_name(),
- font_size=GUIConstants.get_top_nav_title_font_size(),
- height=self.top_nav.height,
- ).render()
- self.top_nav.render_buttons()
+ title_needs_update = True
elif input == HardwareButtonsConstants.KEY_PRESS and ret_val not in Keyboard.ADDITIONAL_KEYS:
# User has locked in the current letter
@@ -1289,19 +1282,20 @@ class KeyboardScreen(BaseTopNavScreen):
ret_val = self.keys_to_values[ret_val]
self.user_input += ret_val
self.cursor_position += 1
+ title_needs_update = True
if self.cursor_position == self.return_after_n_chars:
return self.user_input
- # Render a new TextArea over the TopNav title bar
- if self.update_title():
- TextArea(
- text=self.title,
- font_name=GUIConstants.get_top_nav_title_font_name(),
- font_size=GUIConstants.get_top_nav_title_font_size(),
- height=self.top_nav.height,
- ).render()
- self.top_nav.render_buttons()
+ # Update the title if input changed (add or delete)
+ if title_needs_update and self.update_title():
+ TextArea(
+ text=self.title,
+ font_name=GUIConstants.get_top_nav_title_font_name(),
+ font_size=GUIConstants.get_top_nav_title_font_size(),
+ height=self.top_nav.height,
+ ).render()
+ self.top_nav.render_buttons()
elif input in HardwareButtonsConstants.KEYS__LEFT_RIGHT_UP_DOWN:
# Live joystick movement; haven't locked this new letter in yet.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.