Skip to content

Conversation

@HellAholic
Copy link
Contributor

@HellAholic HellAholic commented Sep 9, 2025

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:

  • Added null checks for definition in various QML files (SettingCategory.qml, SettingComboBox.qml, SettingItem.qml) to prevent runtime errors when definition is 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_value fields 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:

  • Improved handling of the retract_method in FilamentChange.py by dynamically setting it based on the selected G-code flavor, ensuring correct behavior for different printer firmware. Also, fixed the enabled field for machine_gcode_flavor and removed an unused value field. [1] [2] [3]

Other Improvements:

  • Added missing default_value for a hidden setting in DisplayInfoOnLCD.py to ensure consistent initialization.
  • Fixed a regular expression escape issue in ColorMix.py for correct parsing of negative float values.

These changes collectively improve the reliability and maintainability of the Cura UI and post-processing plugins.

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.
@HellAholic HellAholic added Type: Improvement Improvement to existing functionality. PR: Community Contribution 👑 Community Contribution PR's PR: BooBoos 😇 Suggestions for Typos, like the NoMesh or there is a suggested refactor PR: Post Processing ➕ Like adding beeps, more tunability or different Gcode pause at heights labels Sep 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Test Results

23 998 tests   23 996 ✅  43s ⏱️
     1 suites       2 💤
     1 files         0 ❌

Results for commit ad206e6.

♻️ This comment has been updated with latest results.

@HellAholic HellAholic marked this pull request as ready for review September 9, 2025 19:10
@HellAholic HellAholic requested a review from Copilot September 9, 2025 19:10
Copy link

Copilot AI left a 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 definition properties throughout QML UI components to prevent runtime errors when data is missing
  • Standardized minimum_value fields 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.

@HellAholic HellAholic changed the title Fix FilamentChagne Fix PP script warnings and QML setting warnings when adding/removing scripts in plugin Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: BooBoos 😇 Suggestions for Typos, like the NoMesh or there is a suggested refactor PR: Community Contribution 👑 Community Contribution PR's PR: Post Processing ➕ Like adding beeps, more tunability or different Gcode pause at heights Type: Improvement Improvement to existing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants