From a712e7517a650580080728520c88f40cc5507211 Mon Sep 17 00:00:00 2001 From: "j.spijker@ultimaker.com" Date: Wed, 27 Jul 2022 18:12:25 +0200 Subject: [PATCH 1/4] Add the received slice_uuid to the print information Contributes to CURA-9031 --- cura/UI/PrintInformation.py | 10 ++++++++++ plugins/CuraEngineBackend/Cura.proto | 4 ++++ plugins/CuraEngineBackend/CuraEngineBackend.py | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index e18fc38247..ce2a0cfed1 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -38,6 +38,8 @@ class PrintInformation(QObject): self.initializeCuraMessagePrintTimeProperties() + self._slice_uuid: Optional[str] = None + # Indexed by build plate number self._material_lengths = {} # type: Dict[int, List[float]] self._material_weights = {} # type: Dict[int, List[float]] @@ -132,6 +134,14 @@ class PrintInformation(QObject): self._updateJobName() self.preSlicedChanged.emit() + @property + def slice_uuid(self) -> Optional[str]: + return self._slice_uuid + + @slice_uuid.setter + def slice_uuid(self, value: Optional[str]) -> None: + self._slice_uuid = value + @pyqtProperty(QObject, notify = currentPrintTimeChanged) def currentPrintTime(self) -> Duration: return self._current_print_time[self._active_build_plate] diff --git a/plugins/CuraEngineBackend/Cura.proto b/plugins/CuraEngineBackend/Cura.proto index 2eabe62366..b420a6ecc2 100644 --- a/plugins/CuraEngineBackend/Cura.proto +++ b/plugins/CuraEngineBackend/Cura.proto @@ -139,5 +139,9 @@ message GCodePrefix { bytes data = 2; //Header string to be prepended before the rest of the g-code sent from the engine. } +message SliceUUID { + string slice_uuid = 1; //The UUID of the slice. +} + message SlicingFinished { } diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 18088a99c6..db27f8a6a3 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -124,6 +124,7 @@ class CuraEngineBackend(QObject, Backend): self._message_handlers["cura.proto.Progress"] = self._onProgressMessage self._message_handlers["cura.proto.GCodeLayer"] = self._onGCodeLayerMessage self._message_handlers["cura.proto.GCodePrefix"] = self._onGCodePrefixMessage + self._message_handlers["cura.proto.SliceUUID"] = self._onSliceUUIDMessage self._message_handlers["cura.proto.PrintTimeMaterialEstimates"] = self._onPrintTimeMaterialEstimates self._message_handlers["cura.proto.SlicingFinished"] = self._onSlicingFinishedMessage @@ -812,6 +813,10 @@ class CuraEngineBackend(QObject, Backend): except KeyError: # Can occur if the g-code has been cleared while a slice message is still arriving from the other end. pass # Throw the message away. + def _onSliceUUIDMessage(self, message: Arcus.PythonMessage) -> None: + application = CuraApplication.getInstance() + application.getPrintInformation().slice_uuid = message.slice_uuid + def _createSocket(self, protocol_file: str = None) -> None: """Creates a new socket connection.""" From a88e31eddd559b4790458d25c504e701df41818c Mon Sep 17 00:00:00 2001 From: "j.spijker@ultimaker.com" Date: Wed, 27 Jul 2022 18:13:09 +0200 Subject: [PATCH 2/4] Add the slice_uuid to the slice info data Contributes to CURA-9031 --- plugins/SliceInfoPlugin/SliceInfo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 0bf76f8423..0c9a2e35f4 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -133,6 +133,7 @@ class SliceInfo(QObject, Extension): data["is_logged_in"] = self._application.getCuraAPI().account.isLoggedIn data["organization_id"] = org_id if org_id else None data["subscriptions"] = user_profile.get("subscriptions", []) if user_profile else [] + data["slice_uuid"] = print_information.slice_uuid active_mode = self._application.getPreferences().getValue("cura/active_mode") if active_mode == 0: From d9e3e4d395b84a90c9cbf6d75c7723032cb84e1c Mon Sep 17 00:00:00 2001 From: "j.spijker@ultimaker.com" Date: Fri, 29 Jul 2022 12:13:12 +0200 Subject: [PATCH 3/4] Made slice_uuid a public field Contributes to CURA-9031 --- cura/UI/PrintInformation.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cura/UI/PrintInformation.py b/cura/UI/PrintInformation.py index ce2a0cfed1..2b8e13b09f 100644 --- a/cura/UI/PrintInformation.py +++ b/cura/UI/PrintInformation.py @@ -38,7 +38,7 @@ class PrintInformation(QObject): self.initializeCuraMessagePrintTimeProperties() - self._slice_uuid: Optional[str] = None + self.slice_uuid: Optional[str] = None # Indexed by build plate number self._material_lengths = {} # type: Dict[int, List[float]] @@ -134,14 +134,6 @@ class PrintInformation(QObject): self._updateJobName() self.preSlicedChanged.emit() - @property - def slice_uuid(self) -> Optional[str]: - return self._slice_uuid - - @slice_uuid.setter - def slice_uuid(self, value: Optional[str]) -> None: - self._slice_uuid = value - @pyqtProperty(QObject, notify = currentPrintTimeChanged) def currentPrintTime(self) -> Duration: return self._current_print_time[self._active_build_plate] From a0f640586ccba13ecc2f45d9ddb0f21c2ab10073 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Jul 2022 15:57:10 +0200 Subject: [PATCH 4/4] Add slice ID to example data Contributes to issue CURA-9031. --- plugins/SliceInfoPlugin/example_data.html | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/SliceInfoPlugin/example_data.html b/plugins/SliceInfoPlugin/example_data.html index 85a9f554ff..75cc48b55c 100644 --- a/plugins/SliceInfoPlugin/example_data.html +++ b/plugins/SliceInfoPlugin/example_data.html @@ -9,6 +9,7 @@ Using Custom Settings: No
Is Logged In: Yes
Organization ID (if any): ABCDefGHIjKlMNOpQrSTUvYxWZ0-1234567890abcDE=
+ Slice ID: aBcDeF01-2345-6789-aBcD-eF0123456789
Subscriptions (if any):
  • Level: 10, Type: Enterprise, Plan: Basic