Add option for separate dock widgets for modelling and visualisation #50
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.
Overview
This PR adds a new option in the plugin settings that allows users to display the modelling and visualisation components in separate dock widgets instead of tabs within a single dock. By default, the plugin maintains its existing behavior (single dock with tabs) for backward compatibility.
Changes
New Setting
separate_dock_widgetsboolean setting toPlgSettingsStructure(defaults toFalse)Implementation
The plugin now reads the setting during initialization and creates dock widgets accordingly:
Default Mode (
separate_dock_widgets = False)Separate Mode (
separate_dock_widgets = True)Technical Details
Modified Files:
loopstructural/toolbelt/preferences.py- Added setting fieldloopstructural/gui/dlg_settings.ui- Added checkbox controlloopstructural/gui/dlg_settings.py- Added load/save logicloopstructural/gui/loop_widget.py- Added accessor methods for child widgetsloopstructural/plugin_main.py- Implemented conditional dock creation logic and cleanuptests/qgis/test_plg_preferences.py- Added test coverageThe implementation uses accessor methods (
get_modelling_widget()andget_visualisation_widget()) to extract child widgets fromLoopWidgetand place them in separate docks when the option is enabled.Usage
The setting change requires plugin reinitialization since dock widgets are created during
initGui(), which is standard QGIS behavior.Benefits
Testing
Resolves the request to provide an option for separate dock widgets while maintaining backward compatibility with the existing single-dock-with-tabs interface.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.