mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Rename to Universal Cura Project
CURA-11561
This commit is contained in:
parent
2ae9908334
commit
63c1eb8990
@ -48,13 +48,13 @@ class ThreeMFReader(MeshReader):
|
|||||||
)
|
)
|
||||||
MimeTypeDatabase.addMimeType(
|
MimeTypeDatabase.addMimeType(
|
||||||
MimeType(
|
MimeType(
|
||||||
name="application/x-pcb",
|
name="application/x-ucp",
|
||||||
comment="PCB",
|
comment="UCP",
|
||||||
suffixes=["pcb"]
|
suffixes=["ucp"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
self._supported_extensions = [".3mf", ".pcb"]
|
self._supported_extensions = [".3mf", ".ucp"]
|
||||||
self._root = None
|
self._root = None
|
||||||
self._base_name = ""
|
self._base_name = ""
|
||||||
self._unit = None
|
self._unit = None
|
||||||
|
@ -113,7 +113,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self._supported_extensions = [".3mf", ".pcb"]
|
self._supported_extensions = [".3mf", ".ucp"]
|
||||||
self._dialog = WorkspaceDialog()
|
self._dialog = WorkspaceDialog()
|
||||||
self._3mf_mesh_reader = None
|
self._3mf_mesh_reader = None
|
||||||
self._container_registry = ContainerRegistry.getInstance()
|
self._container_registry = ContainerRegistry.getInstance()
|
||||||
@ -234,14 +234,14 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
self._resolve_strategies = {k: None for k in resolve_strategy_keys}
|
self._resolve_strategies = {k: None for k in resolve_strategy_keys}
|
||||||
containers_found_dict = {k: False for k in resolve_strategy_keys}
|
containers_found_dict = {k: False for k in resolve_strategy_keys}
|
||||||
|
|
||||||
# Check whether the file is a PCB, which changes some import options
|
# Check whether the file is a UCP, which changes some import options
|
||||||
is_pcb = file_name.endswith('.pcb')
|
is_ucp = file_name.endswith('.ucp')
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read definition containers
|
# Read definition containers
|
||||||
#
|
#
|
||||||
machine_definition_id = None
|
machine_definition_id = None
|
||||||
updatable_machines = None if is_pcb else []
|
updatable_machines = None if is_ucp else []
|
||||||
machine_definition_container_count = 0
|
machine_definition_container_count = 0
|
||||||
extruder_definition_container_count = 0
|
extruder_definition_container_count = 0
|
||||||
definition_container_files = [name for name in cura_file_names if name.endswith(self._definition_container_suffix)]
|
definition_container_files = [name for name in cura_file_names if name.endswith(self._definition_container_suffix)]
|
||||||
@ -608,7 +608,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
|
|
||||||
# Load the user specifically exported settings
|
# Load the user specifically exported settings
|
||||||
self._dialog.exportedSettingModel.clear()
|
self._dialog.exportedSettingModel.clear()
|
||||||
if is_pcb:
|
if is_ucp:
|
||||||
try:
|
try:
|
||||||
self._user_settings = json.loads(archive.open("Cura/user-settings.json").read().decode("utf-8"))
|
self._user_settings = json.loads(archive.open("Cura/user-settings.json").read().decode("utf-8"))
|
||||||
any_extruder_stack = ExtruderManager.getInstance().getExtruderStack(0)
|
any_extruder_stack = ExtruderManager.getInstance().getExtruderStack(0)
|
||||||
@ -625,8 +625,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
"Extruder {0}", extruder_nr + 1),
|
"Extruder {0}", extruder_nr + 1),
|
||||||
settings)
|
settings)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
# If there is no user settings file, it's not a PCB, so notify user of failure.
|
# If there is no user settings file, it's not a UCP, so notify user of failure.
|
||||||
Logger.log("w", "File %s is not a valid PCB.", file_name)
|
Logger.log("w", "File %s is not a valid UCP.", file_name)
|
||||||
message = Message(
|
message = Message(
|
||||||
i18n_catalog.i18nc("@info:error Don't translate the XML tags <filename> or <message>!",
|
i18n_catalog.i18nc("@info:error Don't translate the XML tags <filename> or <message>!",
|
||||||
"Project file <filename>{0}</filename> is corrupt: <message>{1}</message>.",
|
"Project file <filename>{0}</filename> is corrupt: <message>{1}</message>.",
|
||||||
@ -656,8 +656,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
self._dialog.setVariantType(variant_type_name)
|
self._dialog.setVariantType(variant_type_name)
|
||||||
self._dialog.setHasObjectsOnPlate(Application.getInstance().platformActivity)
|
self._dialog.setHasObjectsOnPlate(Application.getInstance().platformActivity)
|
||||||
self._dialog.setMissingPackagesMetadata(missing_package_metadata)
|
self._dialog.setMissingPackagesMetadata(missing_package_metadata)
|
||||||
self._dialog.setHasVisibleSelectSameProfileChanged(is_pcb)
|
self._dialog.setHasVisibleSelectSameProfileChanged(is_ucp)
|
||||||
self._dialog.setAllowCreatemachine(not is_pcb)
|
self._dialog.setAllowCreatemachine(not is_ucp)
|
||||||
self._dialog.show()
|
self._dialog.show()
|
||||||
|
|
||||||
|
|
||||||
@ -699,7 +699,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
|||||||
if self._dialog.getResult() == {}:
|
if self._dialog.getResult() == {}:
|
||||||
return WorkspaceReader.PreReadResult.cancelled
|
return WorkspaceReader.PreReadResult.cancelled
|
||||||
|
|
||||||
self._load_profile = not is_pcb or (self._dialog.selectSameProfileChecked and self._dialog.isCompatibleMachine)
|
self._load_profile = not is_ucp or (self._dialog.selectSameProfileChecked and self._dialog.isCompatibleMachine)
|
||||||
|
|
||||||
self._resolve_strategies = self._dialog.getResult()
|
self._resolve_strategies = self._dialog.getResult()
|
||||||
#
|
#
|
||||||
|
@ -27,8 +27,8 @@ def getMetaData() -> Dict:
|
|||||||
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extension": "pcb",
|
"extension": "ucp",
|
||||||
"description": catalog.i18nc("@item:inlistbox", "PCB File")
|
"description": catalog.i18nc("@item:inlistbox", "UCP File")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
metaData["workspace_reader"] = [
|
metaData["workspace_reader"] = [
|
||||||
@ -37,8 +37,8 @@ def getMetaData() -> Dict:
|
|||||||
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
"description": catalog.i18nc("@item:inlistbox", "3MF File")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extension": "pcb",
|
"extension": "ucp",
|
||||||
"description": catalog.i18nc("@item:inlistbox", "PCB File")
|
"description": catalog.i18nc("@item:inlistbox", "UCP File")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "3MF Reader",
|
"name": "3MF Reader",
|
||||||
"author": "Ultimaker B.V.",
|
"author": "Ultimaker B.V.",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"description": "Provides support for reading 3MF and PCB files.",
|
"description": "Provides support for reading 3MF and UCP files.",
|
||||||
"api": 8,
|
"api": 8,
|
||||||
"i18n-catalog": "cura"
|
"i18n-catalog": "cura"
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ from UM.Workspace.WorkspaceWriter import WorkspaceWriter
|
|||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
from .PCBDialog import PCBDialog
|
from .UCPDialog import UCPDialog
|
||||||
from .ThreeMFWriter import ThreeMFWriter
|
from .ThreeMFWriter import ThreeMFWriter
|
||||||
from .SettingsExportModel import SettingsExportModel
|
from .SettingsExportModel import SettingsExportModel
|
||||||
from .SettingsExportGroup import SettingsExportGroup
|
from .SettingsExportGroup import SettingsExportGroup
|
||||||
@ -35,19 +35,19 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
|||||||
self._config_dialog = None
|
self._config_dialog = None
|
||||||
|
|
||||||
def _preWrite(self):
|
def _preWrite(self):
|
||||||
is_pcb = False
|
is_ucp = False
|
||||||
if hasattr(self._stream, 'name'):
|
if hasattr(self._stream, 'name'):
|
||||||
# This only works with local file, but we don't want remote PCB files yet
|
# This only works with local file, but we don't want remote UCP files yet
|
||||||
is_pcb = self._stream.name.endswith('.pcb')
|
is_ucp = self._stream.name.endswith('.ucp')
|
||||||
|
|
||||||
if is_pcb:
|
if is_ucp:
|
||||||
self._config_dialog = PCBDialog()
|
self._config_dialog = UCPDialog()
|
||||||
self._config_dialog.finished.connect(self._onPCBConfigFinished)
|
self._config_dialog.finished.connect(self._onUCPConfigFinished)
|
||||||
self._config_dialog.show()
|
self._config_dialog.show()
|
||||||
else:
|
else:
|
||||||
self._doWrite()
|
self._doWrite()
|
||||||
|
|
||||||
def _onPCBConfigFinished(self, accepted: bool):
|
def _onUCPConfigFinished(self, accepted: bool):
|
||||||
if accepted:
|
if accepted:
|
||||||
self._export_model = self._config_dialog.getModel()
|
self._export_model = self._config_dialog.getModel()
|
||||||
self._doWrite()
|
self._doWrite()
|
||||||
|
@ -14,14 +14,14 @@ from .SettingsExportModel import SettingsExportModel
|
|||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
|
||||||
class PCBDialog(QObject):
|
class UCPDialog(QObject):
|
||||||
finished = pyqtSignal(bool)
|
finished = pyqtSignal(bool)
|
||||||
|
|
||||||
def __init__(self, parent = None) -> None:
|
def __init__(self, parent = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
plugin_path = os.path.dirname(__file__)
|
plugin_path = os.path.dirname(__file__)
|
||||||
dialog_path = os.path.join(plugin_path, 'PCBDialog.qml')
|
dialog_path = os.path.join(plugin_path, 'UCPDialog.qml')
|
||||||
self._model = SettingsExportModel()
|
self._model = SettingsExportModel()
|
||||||
self._view = CuraApplication.getInstance().createQmlComponent(dialog_path,
|
self._view = CuraApplication.getInstance().createQmlComponent(dialog_path,
|
||||||
{"manager": self,
|
{"manager": self,
|
@ -12,7 +12,7 @@ import Cura 1.1 as Cura
|
|||||||
UM.Dialog
|
UM.Dialog
|
||||||
{
|
{
|
||||||
id: exportDialog
|
id: exportDialog
|
||||||
title: catalog.i18nc("@title:window", "Export pre-configured build batch")
|
title: catalog.i18nc("@title:window", "Export Universal Cura Project")
|
||||||
|
|
||||||
margin: UM.Theme.getSize("default_margin").width
|
margin: UM.Theme.getSize("default_margin").width
|
||||||
minimumWidth: UM.Theme.getSize("modal_window_minimum").width
|
minimumWidth: UM.Theme.getSize("modal_window_minimum").width
|
||||||
@ -39,14 +39,14 @@ UM.Dialog
|
|||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: titleLabel
|
id: titleLabel
|
||||||
text: catalog.i18nc("@action:title", "Summary - Pre-configured build batch")
|
text: catalog.i18nc("@action:title", "Summary - Universal Cura Project")
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: descriptionLabel
|
id: descriptionLabel
|
||||||
text: catalog.i18nc("@action:description", "When exporting a build batch, all the models present on the build plate will be included with their current position, orientation and scale. You can also select which per-extruder or per-model settings should be included to ensure a proper printing of the batch, even on different printers.")
|
text: catalog.i18nc("@action:description", "When exporting a Universal Cura Project, all the models present on the build plate will be included with their current position, orientation and scale. You can also select which per-extruder or per-model settings should be included to ensure a proper printing of the batch, even on different printers.")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
Layout.maximumWidth: headerColumn.width
|
Layout.maximumWidth: headerColumn.width
|
@ -34,9 +34,9 @@ def getMetaData():
|
|||||||
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
|
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extension": "pcb",
|
"extension": "ucp",
|
||||||
"description": i18n_catalog.i18nc("@item:inlistbox", "PCB file"),
|
"description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
|
||||||
"mime_type": "application/x-pcb",
|
"mime_type": "application/x-ucp",
|
||||||
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
|
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -50,9 +50,9 @@ def getMetaData():
|
|||||||
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
|
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extension": "pcb",
|
"extension": "ucp",
|
||||||
"description": i18n_catalog.i18nc("@item:inlistbox", "Pre-Configured Batch file"),
|
"description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
|
||||||
"mime_type": "application/x-pcb",
|
"mime_type": "application/x-ucp",
|
||||||
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
|
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "3MF Writer",
|
"name": "3MF Writer",
|
||||||
"author": "Ultimaker B.V.",
|
"author": "Ultimaker B.V.",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"description": "Provides support for writing 3MF and PCB files.",
|
"description": "Provides support for writing 3MF and UCP files.",
|
||||||
"api": 8,
|
"api": 8,
|
||||||
"i18n-catalog": "cura"
|
"i18n-catalog": "cura"
|
||||||
}
|
}
|
||||||
|
@ -72,15 +72,15 @@ Cura.Menu
|
|||||||
|
|
||||||
Cura.MenuItem
|
Cura.MenuItem
|
||||||
{
|
{
|
||||||
id: savePCBMenu
|
id: saveUCPMenu
|
||||||
text: catalog.i18nc("@title:menu menubar:file", "&Save PCB Project...")
|
text: catalog.i18nc("@title:menu menubar:file", "&Save Universal Cura Project...")
|
||||||
enabled: UM.WorkspaceFileHandler.enabled
|
enabled: UM.WorkspaceFileHandler.enabled
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
var args = { "filter_by_machine": false,
|
var args = { "filter_by_machine": false,
|
||||||
"file_type": "workspace",
|
"file_type": "workspace",
|
||||||
"preferred_mimetypes": "application/x-pcb",
|
"preferred_mimetypes": "application/x-ucp",
|
||||||
"limit_mimetypes": "application/x-pcb"};
|
"limit_mimetypes": "application/x-ucp"};
|
||||||
UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
|
UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user