First container is now updated withouth recursion possible

We now use a set of keys that we are handling in order to prevent the lock

CURA-1758
This commit is contained in:
Jaime van Kessel 2016-07-22 10:43:26 +02:00
parent 8307dba643
commit cafb46cb1d
2 changed files with 7 additions and 5 deletions

View File

@ -50,6 +50,8 @@ class MachineManager(QObject):
Preferences.getInstance().addPreference("cura/active_machine", "")
self._global_event_keys = set()
active_machine_id = Preferences.getInstance().getValue("cura/active_machine")
self._printer_output_devices = []
@ -199,6 +201,10 @@ class MachineManager(QObject):
def _onGlobalPropertyChanged(self, key, property_name):
if property_name == "value":
## We can get recursion issues. So we store a list of keys that we are still handling to prevent this.
if key in self._global_event_keys:
return
self._global_event_keys.add(key)
self.globalValueChanged.emit()
if self._active_container_stack and self._active_container_stack != self._global_container_stack:
@ -220,8 +226,6 @@ class MachineManager(QObject):
# Remove from the value from the other stacks as well, unless the
# top value from the other stacklevels is different than the new value
for container in extruder_stack.getContainers():
if container == extruder_stack.getTop():
continue
if container.__class__ == UM.Settings.InstanceContainer and container.getInstance(key) != None:
if container.getProperty(key, "value") != new_value:
extruder_stack.getTop().setProperty(key, "value", new_value)
@ -231,6 +235,7 @@ class MachineManager(QObject):
if self._global_container_stack.getProperty(key, "value") != new_value:
self._global_container_stack.getTop().setProperty(key, "value", new_value)
self._global_event_keys.remove(key)
if property_name == "global_inherits_stack":
if self._active_container_stack and self._active_container_stack != self._global_container_stack:
@ -254,7 +259,6 @@ class MachineManager(QObject):
if not has_errors:
self._global_stack_valid = True
self.globalValidationChanged.emit()
def _onGlobalContainerChanged(self):
if self._global_container_stack:
self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged)

View File

@ -60,8 +60,6 @@ ScrollView
property var settingDefinitionsModel: definitionsModel
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
//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.