Merge branch 'CURA-9031_add_slice_id_to_griffin_gcode_header'

This commit is contained in:
Ghostkeeper 2022-07-29 16:02:39 +02:00
commit 9bb3b1a375
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A
5 changed files with 13 additions and 0 deletions

View File

@ -38,6 +38,8 @@ class PrintInformation(QObject):
self.initializeCuraMessagePrintTimeProperties() self.initializeCuraMessagePrintTimeProperties()
self.slice_uuid: Optional[str] = None
# Indexed by build plate number # Indexed by build plate number
self._material_lengths = {} # type: Dict[int, List[float]] self._material_lengths = {} # type: Dict[int, List[float]]
self._material_weights = {} # type: Dict[int, List[float]] self._material_weights = {} # type: Dict[int, List[float]]

View File

@ -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. 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 { message SlicingFinished {
} }

View File

@ -124,6 +124,7 @@ class CuraEngineBackend(QObject, Backend):
self._message_handlers["cura.proto.Progress"] = self._onProgressMessage self._message_handlers["cura.proto.Progress"] = self._onProgressMessage
self._message_handlers["cura.proto.GCodeLayer"] = self._onGCodeLayerMessage self._message_handlers["cura.proto.GCodeLayer"] = self._onGCodeLayerMessage
self._message_handlers["cura.proto.GCodePrefix"] = self._onGCodePrefixMessage 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.PrintTimeMaterialEstimates"] = self._onPrintTimeMaterialEstimates
self._message_handlers["cura.proto.SlicingFinished"] = self._onSlicingFinishedMessage 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. 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. 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: def _createSocket(self, protocol_file: str = None) -> None:
"""Creates a new socket connection.""" """Creates a new socket connection."""

View File

@ -133,6 +133,7 @@ class SliceInfo(QObject, Extension):
data["is_logged_in"] = self._application.getCuraAPI().account.isLoggedIn data["is_logged_in"] = self._application.getCuraAPI().account.isLoggedIn
data["organization_id"] = org_id if org_id else None data["organization_id"] = org_id if org_id else None
data["subscriptions"] = user_profile.get("subscriptions", []) if user_profile else [] 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") active_mode = self._application.getPreferences().getValue("cura/active_mode")
if active_mode == 0: if active_mode == 0:

View File

@ -9,6 +9,7 @@
<b>Using Custom Settings:</b> No<br/> <b>Using Custom Settings:</b> No<br/>
<b>Is Logged In:</b> Yes<br/> <b>Is Logged In:</b> Yes<br/>
<b>Organization ID (if any):</b> ABCDefGHIjKlMNOpQrSTUvYxWZ0-1234567890abcDE=<br/> <b>Organization ID (if any):</b> ABCDefGHIjKlMNOpQrSTUvYxWZ0-1234567890abcDE=<br/>
<b>Slice ID:</b> aBcDeF01-2345-6789-aBcD-eF0123456789<br/>
<b>Subscriptions (if any):</b> <b>Subscriptions (if any):</b>
<ul> <ul>
<li><b>Level:</b> 10, <b>Type:</b> Enterprise, <b>Plan:</b> Basic</li> <li><b>Level:</b> 10, <b>Type:</b> Enterprise, <b>Plan:</b> Basic</li>