CURA-4870 Match the printer type in the dropdown with one of the

available printer types in the group
This commit is contained in:
Diego Prado Gesto 2018-03-07 22:33:15 +01:00
parent be8fc9f3f1
commit 3629c3959e
5 changed files with 72 additions and 49 deletions

View file

@ -451,6 +451,12 @@ class MachineManager(QObject):
def stacksHaveErrors(self) -> bool:
return bool(self._stacks_have_errors)
@pyqtProperty(str, notify = globalContainerChanged)
def activeMachineDefinitionName(self) -> str:
if self._global_container_stack:
return self._global_container_stack.definition.getName()
return ""
@pyqtProperty(str, notify = globalContainerChanged)
def activeMachineName(self) -> str:
if self._global_container_stack:
@ -1024,6 +1030,17 @@ class MachineManager(QObject):
self._setMaterial(position, new_material)
continue
def switchPrinterType(self, machine_type):
container_registry = ContainerRegistry.getInstance()
machine_definition = container_registry.findDefinitionContainers(name = machine_type)[0]
self._global_container_stack.definition = machine_definition
self.globalContainerChanged.emit()
# machine_stack = CuraStackBuilder.createMachine("ultimaker_s5" + "_instance", "ultimaker_s5")
# # if not machine_stack:
# # raise Exception("No machine found for ID {}".format(machine_id))
# Logger.log("d", "Setting active machine to %s", machine_stack.getId())
# self.setActiveMachine(machine_stack.getId())
@pyqtSlot(QObject)
def applyRemoteConfiguration(self, configuration: ConfigurationModel):
self.blurSettings.emit()