Allow the machine manager to set an empty active machine

Gracefully handle the case where the machine manager is requested to
delete the last machine in Cura. In this case, instead of deleting
everything of this machine and still keep it as an active machine,
the machine manager will set the active machine to None.

The QML files which depend on the active machine were changed to
properly handle themselves when there is no active machine.

CURA-7454
This commit is contained in:
Kostas Karmas 2020-06-09 15:33:22 +02:00
parent 669dcc62dd
commit 5c898b8c57
7 changed files with 23 additions and 11 deletions

View file

@ -154,7 +154,7 @@ class BaseMaterialsModel(ListModel):
# Update the available materials (ContainerNode) for the current active machine and extruder setup.
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
if not global_stack.hasMaterials:
if not global_stack or not global_stack.hasMaterials:
return # There are no materials for this machine, so nothing to do.
extruder_list = global_stack.extruderList
if self._extruder_position > len(extruder_list):