mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 05:07:50 -06:00
The extrudersCHanged signal was incorrectly being emitted before the global stack had updated. This was causing the extruderIds to always return the old extruderIds to connected qml components.
The setting slider was incorrectly setting the slider value when updating the model. CURA-9793
This commit is contained in:
parent
c495f0de3f
commit
3ddebe7a84
3 changed files with 9 additions and 6 deletions
|
@ -2,13 +2,14 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from PyQt6.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant # For communicating data and events to Qt.
|
from PyQt6.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant # For communicating data and events to Qt.
|
||||||
|
|
||||||
|
from UM.Application import Application
|
||||||
from UM.FlameProfiler import pyqtSlot
|
from UM.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
import cura.CuraApplication # To get the global container stack to find the current machine.
|
import cura.CuraApplication # To get the global container stack to find the current machine.
|
||||||
from cura.Settings.GlobalStack import GlobalStack
|
from cura.Settings.GlobalStack import GlobalStack
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
from UM.Scene.SceneNode import SceneNode
|
|
||||||
from UM.Scene.Selection import Selection
|
from UM.Scene.Selection import Selection
|
||||||
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
from UM.Settings.ContainerRegistry import ContainerRegistry # Finding containers by ID.
|
||||||
|
@ -45,13 +46,18 @@ class ExtruderManager(QObject):
|
||||||
self._selected_object_extruders = [] # type: List[Union[str, "ExtruderStack"]]
|
self._selected_object_extruders = [] # type: List[Union[str, "ExtruderStack"]]
|
||||||
|
|
||||||
Selection.selectionChanged.connect(self.resetSelectedObjectExtruders)
|
Selection.selectionChanged.connect(self.resetSelectedObjectExtruders)
|
||||||
|
Application.getInstance().globalContainerStackChanged.connect(self.emitExtrudersChanged) # When the machine is swapped we must update the active machine extruders
|
||||||
|
|
||||||
extrudersChanged = pyqtSignal(QVariant)
|
extrudersChanged = pyqtSignal()
|
||||||
"""Signal to notify other components when the list of extruders for a machine definition changes."""
|
"""Signal to notify other components when the list of extruders for a machine definition changes."""
|
||||||
|
|
||||||
activeExtruderChanged = pyqtSignal()
|
activeExtruderChanged = pyqtSignal()
|
||||||
"""Notify when the user switches the currently active extruder."""
|
"""Notify when the user switches the currently active extruder."""
|
||||||
|
|
||||||
|
def emitExtrudersChanged(self):
|
||||||
|
# The emit function can't be directly connected to another signal. This wrapper function is required.
|
||||||
|
self.extrudersChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty(str, notify = activeExtruderChanged)
|
@pyqtProperty(str, notify = activeExtruderChanged)
|
||||||
def activeExtruderStackId(self) -> Optional[str]:
|
def activeExtruderStackId(self) -> Optional[str]:
|
||||||
"""Gets the unique identifier of the currently active extruder stack.
|
"""Gets the unique identifier of the currently active extruder stack.
|
||||||
|
@ -375,8 +381,6 @@ class ExtruderManager(QObject):
|
||||||
extruders_changed = True
|
extruders_changed = True
|
||||||
|
|
||||||
self.fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
self.fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||||
if extruders_changed:
|
|
||||||
self.extrudersChanged.emit(global_stack_id)
|
|
||||||
|
|
||||||
# After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing
|
# After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing
|
||||||
# "fdmextruder". We need to check a machine here so its extruder definition is correct according to this.
|
# "fdmextruder". We need to check a machine here so its extruder definition is correct according to this.
|
||||||
|
|
|
@ -59,6 +59,7 @@ RecommendedSettingSection
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
settingName: "infill_pattern"
|
settingName: "infill_pattern"
|
||||||
|
updateAllExtruders: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RecommendedSettingItem
|
RecommendedSettingItem
|
||||||
|
|
|
@ -83,9 +83,7 @@ RowLayout
|
||||||
function roundSliderValueUpdateSetting()
|
function roundSliderValueUpdateSetting()
|
||||||
{
|
{
|
||||||
// If the user interacts with the slider we round the value and update the setting.
|
// If the user interacts with the slider we round the value and update the setting.
|
||||||
print("roundSliderValueUpdateSetting()")
|
|
||||||
const roundedSliderValue = roundToNearestTen ? Math.round(settingSlider.value / 10) * 10 : Math.round(settingSlider.value)
|
const roundedSliderValue = roundToNearestTen ? Math.round(settingSlider.value / 10) * 10 : Math.round(settingSlider.value)
|
||||||
settingSlider.value = roundedSliderValue
|
|
||||||
updateSetting(roundedSliderValue)
|
updateSetting(roundedSliderValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue