mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
removing update existing/ create new in case of UCP
also, making sure post processing scripts are not loaded. CURA-11403
This commit is contained in:
parent
b119a010ca
commit
8ef7b65710
3 changed files with 47 additions and 36 deletions
|
@ -117,7 +117,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
self._supported_extensions = [".3mf"]
|
||||
self._dialog = WorkspaceDialog()
|
||||
self._3mf_mesh_reader = None
|
||||
self._is_ucp = False
|
||||
self._is_ucp = None
|
||||
self._container_registry = ContainerRegistry.getInstance()
|
||||
|
||||
# suffixes registered with the MimeTypes don't start with a dot '.'
|
||||
|
@ -208,6 +208,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
raise FileNotFoundError("No global stack file found!")
|
||||
|
||||
return global_stack_file_list[0], extruder_stack_file_list
|
||||
def _isProjectUcp(self, file_name) -> bool:
|
||||
if self._is_ucp == None:
|
||||
archive = zipfile.ZipFile(file_name, "r")
|
||||
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
|
||||
self._is_ucp =True if USER_SETTINGS_PATH in cura_file_names else False
|
||||
|
||||
def getIsProjectUcp(self) -> bool:
|
||||
return self._is_ucp
|
||||
|
||||
|
||||
def preRead(self, file_name, show_dialog=True, *args, **kwargs):
|
||||
"""Read some info so we can make decisions
|
||||
|
@ -217,7 +226,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
we don't want to show a dialog.
|
||||
"""
|
||||
self._clearState()
|
||||
|
||||
self._isProjectUcp(file_name)
|
||||
self._3mf_mesh_reader = Application.getInstance().getMeshFileHandler().getReaderForFile(file_name)
|
||||
if self._3mf_mesh_reader and self._3mf_mesh_reader.preRead(file_name) == WorkspaceReader.PreReadResult.accepted:
|
||||
pass
|
||||
|
@ -933,7 +942,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
base_file_name = os.path.basename(file_name)
|
||||
self.setWorkspaceName(base_file_name)
|
||||
|
||||
self._is_ucp = False
|
||||
self._is_ucp = None
|
||||
return nodes, self._loadMetadata(file_name)
|
||||
|
||||
@staticmethod
|
||||
|
@ -1312,6 +1321,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||
machine_manager.setActiveMachine(global_stack.getId())
|
||||
|
||||
# Set metadata fields that are missing from the global stack
|
||||
if not self._is_ucp:
|
||||
for key, value in self._machine_info.metadata_dict.items():
|
||||
if key not in global_stack.getMetaData() and key not in _ignored_machine_network_metadata:
|
||||
global_stack.setMetaDataEntry(key, value)
|
||||
|
|
|
@ -253,7 +253,7 @@ UM.Dialog
|
|||
id: qualityChangesResolveComboBox
|
||||
model: resolveStrategiesModel
|
||||
textRole: "label"
|
||||
visible: manager.qualityChangesConflict
|
||||
visible: manager.qualityChangesConflict && !manager.isUcp
|
||||
contentLeftPadding: UM.Theme.getSize("default_margin").width + UM.Theme.getSize("narrow_margin").width
|
||||
textFont: UM.Theme.getFont("medium")
|
||||
|
||||
|
@ -307,7 +307,7 @@ UM.Dialog
|
|||
id: materialResolveComboBox
|
||||
model: resolveStrategiesModel
|
||||
textRole: "label"
|
||||
visible: manager.materialConflict
|
||||
visible: manager.materialConflict && !manager.isUcp
|
||||
contentLeftPadding: UM.Theme.getSize("default_margin").width + UM.Theme.getSize("narrow_margin").width
|
||||
textFont: UM.Theme.getFont("medium")
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ Item
|
|||
{
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: comboboxLabel.verticalCenter
|
||||
|
||||
color: UM.Theme.getColor("small_button_text")
|
||||
icon: UM.Theme.getIcon("Information")
|
||||
text: comboboxTooltipText
|
||||
visible: comboboxTooltipText != ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue