mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
adding option of opening model as UCP or normal project file
CURA-11403
This commit is contained in:
parent
c817f11c02
commit
f3c49e494e
6 changed files with 187 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
|||
# Copyright (c) 2023 UltiMaker
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import zipfile
|
||||
from typing import List, cast
|
||||
|
||||
from PyQt6.QtCore import QObject, QUrl, pyqtSignal, pyqtProperty
|
||||
|
@ -33,6 +33,7 @@ from cura.Operations.SetBuildPlateNumberOperation import SetBuildPlateNumberOper
|
|||
from UM.Logger import Logger
|
||||
from UM.Scene.SceneNode import SceneNode
|
||||
|
||||
USER_SETTINGS_PATH = "Cura/user-settings.json"
|
||||
|
||||
class CuraActions(QObject):
|
||||
def __init__(self, parent: QObject = None) -> None:
|
||||
|
@ -195,6 +196,13 @@ class CuraActions(QObject):
|
|||
operation.addOperation(SetObjectExtruderOperation(node, extruder_id))
|
||||
operation.push()
|
||||
|
||||
@pyqtSlot(str, result = bool)
|
||||
def isProjectUcp(self, file_url) -> bool:
|
||||
file_name = QUrl(file_url).toLocalFile()
|
||||
archive = zipfile.ZipFile(file_name, "r")
|
||||
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
|
||||
return USER_SETTINGS_PATH in cura_file_names
|
||||
|
||||
@pyqtSlot(int)
|
||||
def setBuildPlateForSelection(self, build_plate_nr: int) -> None:
|
||||
Logger.log("d", "Setting build plate number... %d" % build_plate_nr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue