mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 22:56:01 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
4c29a952eb
@ -1518,12 +1518,11 @@ class CuraApplication(QtApplication):
|
|||||||
"""
|
"""
|
||||||
Checks if the given file URL is a valid project file.
|
Checks if the given file URL is a valid project file.
|
||||||
"""
|
"""
|
||||||
|
file_path = QUrl(file_url).toLocalFile()
|
||||||
|
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
|
||||||
|
if workspace_reader is None:
|
||||||
|
return False # non-project files won't get a reader
|
||||||
try:
|
try:
|
||||||
file_path = QUrl(file_url).toLocalFile()
|
|
||||||
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
|
|
||||||
if workspace_reader is None:
|
|
||||||
return False # non-project files won't get a reader
|
|
||||||
|
|
||||||
result = workspace_reader.preRead(file_path, show_dialog=False)
|
result = workspace_reader.preRead(file_path, show_dialog=False)
|
||||||
return result == WorkspaceReader.PreReadResult.accepted
|
return result == WorkspaceReader.PreReadResult.accepted
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -49,6 +49,9 @@ class ExtruderManager(QObject):
|
|||||||
## Notify when the user switches the currently active extruder.
|
## Notify when the user switches the currently active extruder.
|
||||||
activeExtruderChanged = pyqtSignal()
|
activeExtruderChanged = pyqtSignal()
|
||||||
|
|
||||||
|
## The signal notifies subscribers if extruders are added
|
||||||
|
extrudersAdded = pyqtSignal()
|
||||||
|
|
||||||
## Gets the unique identifier of the currently active extruder stack.
|
## Gets the unique identifier of the currently active extruder stack.
|
||||||
#
|
#
|
||||||
# The currently active extruder stack is the stack that is currently being
|
# The currently active extruder stack is the stack that is currently being
|
||||||
@ -406,6 +409,7 @@ class ExtruderManager(QObject):
|
|||||||
|
|
||||||
if extruders_changed:
|
if extruders_changed:
|
||||||
self.extrudersChanged.emit(global_stack_id)
|
self.extrudersChanged.emit(global_stack_id)
|
||||||
|
self.extrudersAdded.emit()
|
||||||
self.setActiveExtruderIndex(0)
|
self.setActiveExtruderIndex(0)
|
||||||
|
|
||||||
## Get all extruder values for a certain setting.
|
## Get all extruder values for a certain setting.
|
||||||
|
@ -81,8 +81,10 @@ class ThreeMFReader(MeshReader):
|
|||||||
self._object_count += 1
|
self._object_count += 1
|
||||||
node_name = "Object %s" % self._object_count
|
node_name = "Object %s" % self._object_count
|
||||||
|
|
||||||
|
active_build_plate = Application.getInstance().getBuildPlateModel().activeBuildPlate
|
||||||
|
|
||||||
um_node = CuraSceneNode()
|
um_node = CuraSceneNode()
|
||||||
um_node.addDecorator(BuildPlateDecorator(0))
|
um_node.addDecorator(BuildPlateDecorator(active_build_plate))
|
||||||
um_node.setName(node_name)
|
um_node.setName(node_name)
|
||||||
transformation = self._createMatrixFromTransformationString(savitar_node.getTransformation())
|
transformation = self._createMatrixFromTransformationString(savitar_node.getTransformation())
|
||||||
um_node.setTransformation(transformation)
|
um_node.setTransformation(transformation)
|
||||||
|
@ -168,11 +168,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
Logger.log("w", "Unknown definition container type %s for %s",
|
Logger.log("w", "Unknown definition container type %s for %s",
|
||||||
definition_container_type, each_definition_container_file)
|
definition_container_type, each_definition_container_file)
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
# sanity check
|
|
||||||
if machine_definition_container_count != 1:
|
if machine_definition_container_count != 1:
|
||||||
msg = "Expecting one machine definition container but got %s" % machine_definition_container_count
|
return WorkspaceReader.PreReadResult.failed #Not a workspace file but ordinary 3MF.
|
||||||
Logger.log("e", msg)
|
|
||||||
raise RuntimeError(msg)
|
|
||||||
|
|
||||||
material_labels = []
|
material_labels = []
|
||||||
material_conflict = False
|
material_conflict = False
|
||||||
@ -271,7 +269,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
# if the global stack is found, we check if there are conflicts in the extruder stacks
|
# if the global stack is found, we check if there are conflicts in the extruder stacks
|
||||||
if containers_found_dict["machine"] and not machine_conflict:
|
if containers_found_dict["machine"] and not machine_conflict:
|
||||||
for extruder_stack_file in extruder_stack_files:
|
for extruder_stack_file in extruder_stack_files:
|
||||||
container_id = self._stripFileToId(extruder_stack_file)
|
|
||||||
serialized = archive.open(extruder_stack_file).read().decode("utf-8")
|
serialized = archive.open(extruder_stack_file).read().decode("utf-8")
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
@ -303,7 +300,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
break
|
break
|
||||||
|
|
||||||
num_visible_settings = 0
|
num_visible_settings = 0
|
||||||
has_visible_settings_string = False
|
|
||||||
try:
|
try:
|
||||||
temp_preferences = Preferences()
|
temp_preferences = Preferences()
|
||||||
serialized = archive.open("Cura/preferences.cfg").read().decode("utf-8")
|
serialized = archive.open("Cura/preferences.cfg").read().decode("utf-8")
|
||||||
|
@ -88,6 +88,7 @@ class CuraEngineBackend(QObject, Backend):
|
|||||||
#
|
#
|
||||||
self._global_container_stack = None
|
self._global_container_stack = None
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
|
||||||
|
Application.getInstance().getExtruderManager().extrudersAdded.connect(self._onGlobalStackChanged)
|
||||||
self._onGlobalStackChanged()
|
self._onGlobalStackChanged()
|
||||||
|
|
||||||
Application.getInstance().stacksValidationFinished.connect(self._onStackErrorCheckFinished)
|
Application.getInstance().stacksValidationFinished.connect(self._onStackErrorCheckFinished)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user