mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-13 05:18:04 +08:00
Merge branch '3.1'
This commit is contained in:
commit
f3da1a25fc
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin
|
|||||||
plugins/cura-big-flame-graph
|
plugins/cura-big-flame-graph
|
||||||
plugins/cura-siemensnx-plugin
|
plugins/cura-siemensnx-plugin
|
||||||
plugins/CuraVariSlicePlugin
|
plugins/CuraVariSlicePlugin
|
||||||
|
plugins/CuraLiveScriptingPlugin
|
||||||
|
|
||||||
#Build stuff
|
#Build stuff
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
|
@ -70,6 +70,7 @@ class PrintInformation(QObject):
|
|||||||
|
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
||||||
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
||||||
|
Application.getInstance().workspaceLoaded.connect(self.setProjectName)
|
||||||
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
||||||
|
|
||||||
self._active_material_container = None
|
self._active_material_container = None
|
||||||
@ -283,7 +284,11 @@ class PrintInformation(QObject):
|
|||||||
return self._base_name
|
return self._base_name
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setBaseName(self, base_name):
|
def setProjectName(self, name):
|
||||||
|
self.setBaseName(name, is_project_file = True)
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def setBaseName(self, base_name, is_project_file = False):
|
||||||
# Ensure that we don't use entire path but only filename
|
# Ensure that we don't use entire path but only filename
|
||||||
name = os.path.basename(base_name)
|
name = os.path.basename(base_name)
|
||||||
|
|
||||||
@ -291,15 +296,17 @@ class PrintInformation(QObject):
|
|||||||
# extension. This cuts the extension off if necessary.
|
# extension. This cuts the extension off if necessary.
|
||||||
name = os.path.splitext(name)[0]
|
name = os.path.splitext(name)[0]
|
||||||
|
|
||||||
|
# if this is a profile file, always update the job name
|
||||||
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
|
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
|
||||||
is_empty = name == ""
|
is_empty = name == ""
|
||||||
if is_empty or (self._base_name == "" and self._base_name != name):
|
if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)):
|
||||||
# remove ".curaproject" suffix from (imported) the file name
|
# remove ".curaproject" suffix from (imported) the file name
|
||||||
if name.endswith(".curaproject"):
|
if name.endswith(".curaproject"):
|
||||||
name = name[:name.rfind(".curaproject")]
|
name = name[:name.rfind(".curaproject")]
|
||||||
self._base_name = name
|
self._base_name = name
|
||||||
self._updateJobName()
|
self._updateJobName()
|
||||||
|
|
||||||
|
|
||||||
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
||||||
# Called each time the global stack is switched
|
# Called each time the global stack is switched
|
||||||
def _setAbbreviatedMachineName(self):
|
def _setAbbreviatedMachineName(self):
|
||||||
|
@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
extruder_stack = None
|
extruder_stack = None
|
||||||
|
|
||||||
# if extruders are defined in the machine definition use those instead
|
# if extruders are defined in the machine definition use those instead
|
||||||
if machine.extruders and len(machine.extruders) > 0:
|
if machine.extruders and "0" in machine.extruders:
|
||||||
new_extruder_id = machine.extruders["0"].getId()
|
new_extruder_id = machine.extruders["0"].getId()
|
||||||
extruder_stack = machine.extruders["0"]
|
extruder_stack = machine.extruders["0"]
|
||||||
|
|
||||||
@ -449,7 +449,6 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
extruder_stack.setVariantById(variant_id)
|
extruder_stack.setVariantById(variant_id)
|
||||||
extruder_stack.setMaterialById("default")
|
extruder_stack.setMaterialById("default")
|
||||||
extruder_stack.setQualityById("default")
|
extruder_stack.setQualityById("default")
|
||||||
quality_changes_id = "default"
|
|
||||||
if machine.qualityChanges.getId() != "empty_quality_changes":
|
if machine.qualityChanges.getId() != "empty_quality_changes":
|
||||||
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
|
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
|
||||||
if extruder_quality_changes_container:
|
if extruder_quality_changes_container:
|
||||||
@ -458,6 +457,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
|||||||
|
|
||||||
self.addContainer(extruder_stack)
|
self.addContainer(extruder_stack)
|
||||||
|
|
||||||
|
return extruder_stack
|
||||||
|
|
||||||
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
|
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
|
||||||
# The stacks are now responsible for setting the next stack on deserialize. However,
|
# The stacks are now responsible for setting the next stack on deserialize. However,
|
||||||
# due to problems with loading order, some stacks may not have the proper next stack
|
# due to problems with loading order, some stacks may not have the proper next stack
|
||||||
|
@ -621,9 +621,16 @@ class MachineManager(QObject):
|
|||||||
def activeQualityId(self) -> str:
|
def activeQualityId(self) -> str:
|
||||||
if self._active_container_stack:
|
if self._active_container_stack:
|
||||||
quality = self._active_container_stack.quality
|
quality = self._active_container_stack.quality
|
||||||
|
if isinstance(quality, type(self._empty_quality_container)):
|
||||||
|
return ""
|
||||||
quality_changes = self._active_container_stack.qualityChanges
|
quality_changes = self._active_container_stack.qualityChanges
|
||||||
if quality and quality_changes and isinstance(quality_changes, type(self._empty_quality_changes_container)) and not isinstance(quality, type(self._empty_quality_container)):
|
if quality and quality_changes:
|
||||||
|
if isinstance(quality_changes, type(self._empty_quality_changes_container)):
|
||||||
|
# It's a built-in profile
|
||||||
return quality.getId()
|
return quality.getId()
|
||||||
|
else:
|
||||||
|
# Custom profile
|
||||||
|
return quality_changes.getId()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@pyqtProperty(str, notify=activeQualityChanged)
|
@pyqtProperty(str, notify=activeQualityChanged)
|
||||||
|
@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
|
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
|
||||||
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
||||||
if not extruder_stacks:
|
if not extruder_stacks:
|
||||||
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
|
extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user