Fix Font Style Persistence Issue by designgears · Pull Request #522 · StreamController/StreamController · GitHub
Skip to content

Fix Font Style Persistence Issue#522

Merged
Core447 merged 1 commit into
StreamController:mainfrom
designgears:font-style-fix
Mar 5, 2026
Merged

Fix Font Style Persistence Issue#522
Core447 merged 1 commit into
StreamController:mainfrom
designgears:font-style-fix

Conversation

@designgears

@designgears designgears commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Resolves: #504

Problem

Font styles (bold/italic) were not persisting after:

  • Reloading the application
  • Moving labels to new buttons
  • Using the reset functionality

Root Cause

The issue was caused by missing font_weight and style parameters when loading KeyLabel objects from JSON data. When labels were loaded from the page configuration, these font styling attributes were not being properly restored, causing them to revert to default values.

Solution

Added the missing font styling parameters to all KeyLabel creation points:

  1. Fixed clear_values() method in KeyLabel.py:

    • Added self.style = None to properly clear the font style when resetting
  2. Fixed load_from_input_dict() for keys in DeckController.py:

    • Added font_weight=state_dict["labels"][label].get("font-weight")
    • Added style=state_dict["labels"][label].get("style")
  3. Fixed load_from_input_dict() for dials in DeckController.py:

    • Added the same missing parameters for dial label loading

Files Changed

  • src/backend/DeckManagement/Subclasses/KeyLabel.py
  • src/backend/DeckManagement/DeckController.py

Testing

The fix ensures that:

  • ✅ Font styles (bold/italic) persist after app reload
  • ✅ Font styles transfer correctly when moving labels between buttons
  • ✅ Font styles are properly cleared when using reset functionality
  • ✅ All font attributes (family, size, weight, style) are consistently loaded and saved

Technical Details

The KeyLabel dataclass already had the style field defined, but it wasn't being populated during the JSON loading process. This meant that even though the font style was correctly saved to the page configuration, it was lost when the application restarted or when labels were moved between different inputs.

Screencast_20260106_115929.webm

…l initialization

Add missing font_weight and style parameters when creating KeyLabel objects in ControllerKey and ControllerDial. Also initialize style attribute in KeyLabel class to prevent AttributeError.
@Core447 Core447 merged commit f551820 into StreamController:main Mar 5, 2026
@Core447

Core447 commented Mar 5, 2026

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

BUG: Font style forgotten when moving button (and on subsequent loads)

2 participants