The addMachineExtruders function assumes that this is a new printer (first time the printer is activated since a restart of Cura) and it needs to add the extruder stacks to it. However most of the time when we're switching, it's not to a new printer. If it's not a new printer, this function would get called anyway and we'd be adding the extruders multiple times. This then does a lot of unnecessary work and eventually fails a couple of calls deep.
This change prevents it from adding the extruders if there are already extruders associated with the printer, thus preventing this unnecessary work (switch is faster) and preventing the error from happening.
Discovered during work on CURA-7501.
This is a bit of defensive coding. If the position is out of bounds for Cura it should now ignore those extruders.
This could be due to broken firmware, or maybe someone MITM-ing the connection and changing it, or perhaps because the printer was changed while the sync was ongoing? Whatever the cause, it now puts a warning in the log about it and doesn't crash any more.
Fixes Sentry issue CURA-156.
The QML profiler showed me that it was causing a *lot* of issues
when switching between extruders. More than 10% of the time in QML
was spent on just updating ine property in the workspace summary dialog.
There were other properties that were also being updated without there being a point.
Contributes to #8250
In some situations this could cause a slowdown, since halfway through
calculating the values the extruder switch would happen. If this is
split up a bit, it's at least less noticeable
Contributes to #8250
All the settings that are changed get a notification from the settingRelation.
There should be no need to re-fire all of those settings again!
Contributes to #8250
When printers share the same group_id, they are removed, regardless if
they are hidden or not. This was resulting in sometimes removing
multiple printers when removing a printer that was created by a project
file.
This PR fixes that by actually checking whether the printer to be
removed is hidden.
CURA-7522
When removing a printer, the files in %appdata%/cura/<version>/
/definition_changes/ remained intact. This commit fixes that by
making sure that the definitionChanges are removed before removing
the 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
The meta data entry was rename to be more representative of its
function. In addition, the bool metadata entry is now properly
handled using the parseBool function.
CURA-7438
This makes the cluster size also available when the machine is offline.
Also fixes an issue where the cluster size is improperly restored
once the internet connection comes back online, resulting in the printer
showing as a single printer until next sync
CURA-7347
Extruders is deprecated. Always use the extruderList.
In fact, the else case beneath was already using extruderList in the same way.
Hopefully we can one day get rid of all the string conversion for the position in this class. I don't dare to refactor that without having a review though.
Done during Turbo Testing and Tooling to reduce the number of warnings in our log.