refactor(widgets): extract duplicated container init into BaseWidget#825
Merged
refactor(widgets): extract duplicated container init into BaseWidget#825
Conversation
- Add _init_container() and build_widget_label() to BaseWidget - Refactor all standard widgets to use the new base methods - Remove build_widget_label() from utilities.py - Clean up unused QFrame/QHBoxLayout/add_shadow imports per widget - Update Writing-Widget.md documentation
5b2246e to
8de165b
Compare
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.
Move the repeated widget container setup block from widget subclasses into
BaseWidget._init_container(). Movebuild_widget_label()from a standalone function inutilities.pyto aBaseWidgetinstance method for better encapsulation.Widgets NOT changed (we can consider refactoring these in the future for consistency)
widget_layout.addWidgetTaskbarDropWidgetinstead ofQFrame, layout obtained from.main_layout_offline_textand_no_window_textto layout before container creation, hides container_workspace_containernaming, different from standard pattern (buttons added dynamically, different class)offline_textadded between creation and shadow, 2 items added towidget_layoutQPushButtonas container, no_widget_containerat all"container"class and also has collapse button logic interleaved