mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-13 02: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-siemensnx-plugin
|
||||
plugins/CuraVariSlicePlugin
|
||||
plugins/CuraLiveScriptingPlugin
|
||||
|
||||
#Build stuff
|
||||
CMakeCache.txt
|
||||
|
@ -70,6 +70,7 @@ class PrintInformation(QObject):
|
||||
|
||||
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
|
||||
Application.getInstance().fileLoaded.connect(self.setBaseName)
|
||||
Application.getInstance().workspaceLoaded.connect(self.setProjectName)
|
||||
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
|
||||
|
||||
self._active_material_container = None
|
||||
@ -283,7 +284,11 @@ class PrintInformation(QObject):
|
||||
return self._base_name
|
||||
|
||||
@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
|
||||
name = os.path.basename(base_name)
|
||||
|
||||
@ -291,15 +296,17 @@ class PrintInformation(QObject):
|
||||
# extension. This cuts the extension off if necessary.
|
||||
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
|
||||
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
|
||||
if name.endswith(".curaproject"):
|
||||
name = name[:name.rfind(".curaproject")]
|
||||
self._base_name = name
|
||||
self._updateJobName()
|
||||
|
||||
|
||||
## Created an acronymn-like abbreviated machine name from the currently active machine name
|
||||
# Called each time the global stack is switched
|
||||
def _setAbbreviatedMachineName(self):
|
||||
|
@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
extruder_stack = None
|
||||
|
||||
# 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()
|
||||
extruder_stack = machine.extruders["0"]
|
||||
|
||||
@ -449,7 +449,6 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
extruder_stack.setVariantById(variant_id)
|
||||
extruder_stack.setMaterialById("default")
|
||||
extruder_stack.setQualityById("default")
|
||||
quality_changes_id = "default"
|
||||
if machine.qualityChanges.getId() != "empty_quality_changes":
|
||||
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
|
||||
if extruder_quality_changes_container:
|
||||
@ -458,6 +457,8 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||
|
||||
self.addContainer(extruder_stack)
|
||||
|
||||
return extruder_stack
|
||||
|
||||
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
|
||||
# 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
|
||||
|
@ -621,9 +621,16 @@ class MachineManager(QObject):
|
||||
def activeQualityId(self) -> str:
|
||||
if self._active_container_stack:
|
||||
quality = self._active_container_stack.quality
|
||||
if isinstance(quality, type(self._empty_quality_container)):
|
||||
return ""
|
||||
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()
|
||||
else:
|
||||
# Custom profile
|
||||
return quality_changes.getId()
|
||||
return ""
|
||||
|
||||
@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
|
||||
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
|
||||
if not extruder_stacks:
|
||||
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
|
||||
extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
|
||||
|
||||
except:
|
||||
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user