-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix PP script warnings and QML setting warnings when adding/removing scripts in plugin #20938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
should be set as boolean rather than string
-Removed references to self.extruder_count from the settings JSON (the logic for enabling these settings based on extruder count is handled in the initialize() method) -Reordered settings so that dependencies are defined before they're referenced -Cleaned up invalid JSON properties
minimum value should be a number, not a string
minimum value should be a number and not a string
minimum value should be a number and not a string
Should use default_value rather than value since that is expected
value field needed for overriding from initialize
Move the condition to initialize
Added checks for null or undefined 'definition' objects in SettingCategory.qml, SettingComboBox.qml, SettingItem.qml, and SettingTextField.qml to prevent runtime errors. This improves stability when settings definitions are missing or not yet loaded.
Test Results23 998 tests 23 996 ✅ 43s ⏱️ Results for commit ad206e6. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request improves the robustness and clarity of Cura's QML UI components and post-processing plugin scripts by adding null/undefined safety checks and standardizing data types.
- Added null checks for
definitionproperties throughout QML UI components to prevent runtime errors when data is missing - Standardized
minimum_valuefields in post-processing scripts from strings to integers for better type consistency - Enhanced FilamentChange.py with dynamic retract method setting based on G-code flavor
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| resources/qml/Settings/SettingTextField.qml | Added null checks for definition in text field validation and unit display |
| resources/qml/Settings/SettingItem.qml | Added comprehensive null safety for definition property access throughout the component |
| resources/qml/Settings/SettingComboBox.qml | Protected combo box model and selection handlers against null definition |
| resources/qml/Settings/SettingCategory.qml | Added null checks for category icon, expansion state, and click handlers |
| plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | Changed minimum_value from string to integer type |
| plugins/PostProcessingPlugin/scripts/FilamentChange.py | Removed value field, fixed enabled property, and added dynamic retract method logic |
| plugins/PostProcessingPlugin/scripts/DisplayInfoOnLCD.py | Added missing default_value for hidden setting |
| plugins/PostProcessingPlugin/scripts/CreateThumbnail.py | Standardized minimum_value fields to integer type |
| plugins/PostProcessingPlugin/scripts/ColorMix.py | Changed minimum_value fields to integers and fixed regex escape |
| plugins/PostProcessingPlugin/scripts/AddCoolingProfile.py | Reorganized settings structure and cleaned up dual extruder fan control logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This pull request makes several improvements to the robustness and clarity of the Cura post-processing plugin scripts and QML UI components. The most significant changes are focused on making the UI and settings handling more resilient to missing or undefined data, as well as cleaning up and clarifying settings logic in several post-processing scripts.
QML UI Robustness Improvements:
definitionin various QML files (SettingCategory.qml,SettingComboBox.qml,SettingItem.qml) to prevent runtime errors whendefinitionis undefined. This affects property bindings, event handlers, and UI element visibility, ensuring the UI remains stable even if data is missing. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Post-Processing Script Settings Cleanup:
Standardized
minimum_valuefields in settings to use integers instead of strings across multiple scripts (ColorMix.py,CreateThumbnail.py,PauseAtHeight.py), improving type consistency and validation. [1] [2] [3] [4] [5] [6] [7] [8] [9]Adjusted logic for enabling/disabling cooling fan settings in
AddCoolingProfile.py, including fixing the control flow for dual extruder support and removing redundant or misplaced settings. [1] [2] [3]Filament Change Script Enhancements:
retract_methodinFilamentChange.pyby dynamically setting it based on the selected G-code flavor, ensuring correct behavior for different printer firmware. Also, fixed theenabledfield formachine_gcode_flavorand removed an unusedvaluefield. [1] [2] [3]Other Improvements:
default_valuefor a hidden setting inDisplayInfoOnLCD.pyto ensure consistent initialization.ColorMix.pyfor correct parsing of negative float values.These changes collectively improve the reliability and maintainability of the Cura UI and post-processing plugins.