mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 21:58:01 -06:00
Settings now point to the right extruder stack
CURA-1758
This commit is contained in:
parent
dd78561e25
commit
4346d5a233
2 changed files with 41 additions and 1 deletions
|
@ -47,6 +47,10 @@ class ExtruderManager(QObject):
|
||||||
return 0 # No active machine, so no extruders.
|
return 0 # No active machine, so no extruders.
|
||||||
return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()])
|
return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()])
|
||||||
|
|
||||||
|
@pyqtProperty("QVariantList", notify=extrudersChanged)
|
||||||
|
def extruderIds(self):
|
||||||
|
return [self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][extruder].getId() for extruder in self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]]
|
||||||
|
|
||||||
## The instance of the singleton pattern.
|
## The instance of the singleton pattern.
|
||||||
#
|
#
|
||||||
# It's None if the extruder manager hasn't been created yet.
|
# It's None if the extruder manager hasn't been created yet.
|
||||||
|
|
|
@ -60,6 +60,8 @@ ScrollView
|
||||||
property var settingDefinitionsModel: definitionsModel
|
property var settingDefinitionsModel: definitionsModel
|
||||||
property var propertyProvider: provider
|
property var propertyProvider: provider
|
||||||
|
|
||||||
|
property var stackId: ExtruderManager.activeExtruderStackId ? ExtruderManager.activeExtruderStackId : Cura.MachineManager.activeMachineId
|
||||||
|
|
||||||
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
||||||
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
||||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||||
|
@ -89,11 +91,45 @@ ScrollView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Binding to ensure that the right containerstack ID is set for the provider.
|
||||||
|
// This ensures that if a setting has a global_inherits_stack id (for instance; Support speed points to the
|
||||||
|
// extruder that actually prints the support, as that is the setting we need to use to calculate the value)
|
||||||
|
Binding
|
||||||
|
{
|
||||||
|
target: provider
|
||||||
|
property: "containerStackId"
|
||||||
|
value:
|
||||||
|
{
|
||||||
|
if(inheritStackProvider.properties.global_inherits_stack == -1 || inheritStackProvider.properties.global_inherits_stack == null)
|
||||||
|
{
|
||||||
|
if( ExtruderManager.activeExtruderStackId)
|
||||||
|
{
|
||||||
|
return ExtruderManager.activeExtruderStackId
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Cura.MachineManager.activeMachineId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ExtruderManager.extruderIds[inheritStackProvider.properties.global_inherits_stack]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Specialty provider that only watches global_inherits (we cant filter on what property changed we get events
|
||||||
|
// so we bypass that to make a dedicated provider.
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: inheritStackProvider
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: model.key
|
||||||
|
watchedProperties: [ "global_inherits_stack"]
|
||||||
|
}
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: provider
|
id: provider
|
||||||
|
|
||||||
containerStackId: ExtruderManager.activeExtruderStackId ? ExtruderManager.activeExtruderStackId : Cura.MachineManager.activeMachineId
|
containerStackId: delegate.stackId
|
||||||
key: model.key ? model.key : ""
|
key: model.key ? model.key : ""
|
||||||
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder" ]
|
watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder" ]
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue