mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Let 3mf workspace reader read from files per plugin
CURA-6627
This commit is contained in:
parent
46050f9618
commit
712cebcdd2
1 changed files with 13 additions and 5 deletions
|
@ -737,12 +737,20 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
|
|
||||||
def _loadMetadata(self, file_name) -> Dict[str, Dict[str, Any]]:
|
def _loadMetadata(self, file_name) -> Dict[str, Dict[str, Any]]:
|
||||||
archive = zipfile.ZipFile(file_name, "r")
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
|
|
||||||
|
metadata_files = [name for name in archive.namelist() if name.endswith("plugin_metadata.json")]
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
result = dict()
|
||||||
|
|
||||||
|
for metadata_file in metadata_files:
|
||||||
try:
|
try:
|
||||||
return json.loads(archive.open("Cura/plugin_metadata.json").read().decode("utf-8"))
|
plugin_id = metadata_file.split("/")[0]
|
||||||
except KeyError:
|
result[plugin_id] = json.loads(archive.open("Cura/plugin_metadata.json").read().decode("utf-8"))
|
||||||
# The plugin_metadata.json file doesn't exist
|
except Exception:
|
||||||
return dict()
|
Logger.logException("w", "Unable to retrieve metadata for %s", metadata_file)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def _processQualityChanges(self, global_stack):
|
def _processQualityChanges(self, global_stack):
|
||||||
if self._machine_info.quality_changes_info is None:
|
if self._machine_info.quality_changes_info is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue