mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 19:49:00 +08:00
CURA-4606 CURA-5010 fix print information crashing on printer switch
This commit is contained in:
parent
11be94c735
commit
2df9802ba5
@ -75,6 +75,7 @@ class PrintInformation(QObject):
|
|||||||
self._multi_build_plate_model = self._application.getMultiBuildPlateModel()
|
self._multi_build_plate_model = self._application.getMultiBuildPlateModel()
|
||||||
|
|
||||||
self._application.globalContainerStackChanged.connect(self._updateJobName)
|
self._application.globalContainerStackChanged.connect(self._updateJobName)
|
||||||
|
self._application.globalContainerStackChanged.connect(self.setToZeroPrintInformation)
|
||||||
self._application.fileLoaded.connect(self.setBaseName)
|
self._application.fileLoaded.connect(self.setBaseName)
|
||||||
self._application.workspaceLoaded.connect(self.setProjectName)
|
self._application.workspaceLoaded.connect(self.setProjectName)
|
||||||
self._multi_build_plate_model.activeBuildPlateChanged.connect(self._onActiveBuildPlateChanged)
|
self._multi_build_plate_model.activeBuildPlateChanged.connect(self._onActiveBuildPlateChanged)
|
||||||
@ -211,7 +212,12 @@ class PrintInformation(QObject):
|
|||||||
material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings"))
|
material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings"))
|
||||||
|
|
||||||
extruder_stacks = global_stack.extruders
|
extruder_stacks = global_stack.extruders
|
||||||
for index, amount in enumerate(self._material_amounts):
|
#for index, amount in enumerate(self._material_amounts):
|
||||||
|
for extruder_key in global_stack.extruders.keys():
|
||||||
|
index = int(extruder_key)
|
||||||
|
if index >= len(self._material_amounts): # Right now the _material_amounts is a list, where the index is the extruder number
|
||||||
|
continue
|
||||||
|
amount = self._material_amounts[index]
|
||||||
## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some
|
## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some
|
||||||
# list comprehension filtering to solve this for us.
|
# list comprehension filtering to solve this for us.
|
||||||
extruder_stack = extruder_stacks[str(index)]
|
extruder_stack = extruder_stacks[str(index)]
|
||||||
@ -375,7 +381,9 @@ class PrintInformation(QObject):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
# Simulate message with zero time duration
|
# Simulate message with zero time duration
|
||||||
def setToZeroPrintInformation(self, build_plate):
|
def setToZeroPrintInformation(self, build_plate = None):
|
||||||
|
if build_plate is None:
|
||||||
|
build_plate = self._active_build_plate
|
||||||
|
|
||||||
# Construct the 0-time message
|
# Construct the 0-time message
|
||||||
temp_message = {}
|
temp_message = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user