{{ message }}
Fix Font Style Persistence Issue#522
Merged
Merged
Conversation
…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.
Member
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.

Resolves: #504
Problem
Font styles (bold/italic) were not persisting after:
Root Cause
The issue was caused by missing
font_weightandstyleparameters 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:
Fixed clear_values() method in KeyLabel.py:
self.style = Noneto properly clear the font style when resettingFixed load_from_input_dict() for keys in DeckController.py:
font_weight=state_dict["labels"][label].get("font-weight")style=state_dict["labels"][label].get("style")Fixed load_from_input_dict() for dials in DeckController.py:
Files Changed
Testing
The fix ensures that:
Technical Details
The KeyLabel dataclass already had the
stylefield 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