Merge branch 'master' into mypy_fixes

Contributes to CURA-5330
This commit is contained in:
Diego Prado Gesto 2018-06-08 15:29:22 +02:00
commit e5e96bc600
98 changed files with 19713 additions and 16495 deletions

View file

@ -655,6 +655,15 @@ class MachineManager(QObject):
return ""
@pyqtProperty(str, notify = activeVariantChanged)
def activeVariantId(self) -> str:
if self._active_container_stack:
variant = self._active_container_stack.variant
if variant:
return variant.getId()
return ""
@pyqtProperty(str, notify = activeVariantChanged)
def activeVariantBuildplateName(self) -> str:
if self._global_container_stack:
@ -983,6 +992,14 @@ class MachineManager(QObject):
container = extruder.userChanges
container.setProperty(setting_name, property_name, property_value)
## Reset all setting properties of a setting for all extruders.
# \param setting_name The ID of the setting to reset.
@pyqtSlot(str)
def resetSettingForAllExtruders(self, setting_name: str) -> None:
for key, extruder in self._global_container_stack.extruders.items():
container = extruder.userChanges
container.removeInstance(setting_name)
@pyqtProperty("QVariantList", notify = globalContainerChanged)
def currentExtruderPositions(self) -> List[str]:
if self._global_container_stack is None:
@ -1239,6 +1256,8 @@ class MachineManager(QObject):
# If there is no machine, then create a new one and set it to the non-hidden instance
if not new_machine:
new_machine = CuraStackBuilder.createMachine(machine_definition_id + "_sync", machine_definition_id)
if not new_machine:
return
new_machine.addMetaDataEntry("um_network_key", self.activeMachineNetworkKey)
new_machine.addMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName)
new_machine.addMetaDataEntry("hidden", False)
@ -1300,8 +1319,8 @@ class MachineManager(QObject):
# Check if the connect_group_name is correct. If not, update all the containers connected to the same printer
if self.activeMachineNetworkGroupName != group_name:
metadata_filter = {"um_network_key": self.activeMachineNetworkKey}
hidden_containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
for container in hidden_containers:
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
for container in containers:
container.setMetaDataEntry("connect_group_name", group_name)
## This method checks if there is an instance connected to the given network_key