Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorj.spijker@ultimaker.com <jelle spijker>2022-02-28 12:41:24 +0300
committerJelle Spijker <spijker.jelle@gmail.com>2022-02-28 12:41:24 +0300
commit47588393e8acc71a1ce8d5244070232f3ca0ca7e (patch)
treeb43632bb9fb90c27e39b567a0eb2d9193e9b2af7 /plugins/CuraEngineBackend
parent7511ac843e1397dd2016399fdcc796d1de0636cd (diff)
Use Arcus as namespace
Because we had to rename our Python bindings module from Arcus to pyArcus we also changed our import downstream (Cura and Uranium). But in order to limit the changes on our existing code we decided during the review that we should just import pyArcus as Arcus. Contributes to CURA-7924
Diffstat (limited to 'plugins/CuraEngineBackend')
-rwxr-xr-xplugins/CuraEngineBackend/CuraEngineBackend.py34
-rw-r--r--plugins/CuraEngineBackend/StartSliceJob.py14
2 files changed, 24 insertions, 24 deletions
diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py
index 8cfc4cff34..d7ed5fac21 100755
--- a/plugins/CuraEngineBackend/CuraEngineBackend.py
+++ b/plugins/CuraEngineBackend/CuraEngineBackend.py
@@ -1,5 +1,5 @@
-# Copyright (c) 2021 Ultimaker B.V.
-# Cura is released under the terms of the LGPLv3 or higher.
+# Copyright (c) 2021-2022 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
import argparse #To run the engine in debug mode if the front-end is in debug mode.
from collections import defaultdict
@@ -31,7 +31,7 @@ from cura.Utils.Threading import call_on_qt_thread
from .ProcessSlicedLayersJob import ProcessSlicedLayersJob
from .StartSliceJob import StartSliceJob, StartJobResult
-import pyArcus
+import pyArcus as Arcus
if TYPE_CHECKING:
from cura.Machines.Models.MultiBuildPlateModel import MultiBuildPlateModel
@@ -102,8 +102,8 @@ class CuraEngineBackend(QObject, Backend):
self._layer_view_active = False #type: bool
self._onActiveViewChanged()
- self._stored_layer_data = [] # type: List[pyArcus.PythonMessage]
- self._stored_optimized_layer_data = {} # type: Dict[int, List[pyArcus.PythonMessage]] # key is build plate number, then arrays are stored until they go to the ProcessSlicesLayersJob
+ self._stored_layer_data = [] # type: List[Arcus.PythonMessage]
+ self._stored_optimized_layer_data = {} # type: Dict[int, List[Arcus.PythonMessage]] # key is build plate number, then arrays are stored until they go to the ProcessSlicesLayersJob
self._scene = application.getController().getScene() #type: Scene
self._scene.sceneChanged.connect(self._onSceneChanged)
@@ -607,7 +607,7 @@ class CuraEngineBackend(QObject, Backend):
self._invokeSlice()
- def _onSocketError(self, error: pyArcus.Error) -> None:
+ def _onSocketError(self, error: Arcus.Error) -> None:
"""Called when an error occurs in the socket connection towards the engine.
:param error: The exception that occurred.
@@ -617,18 +617,18 @@ class CuraEngineBackend(QObject, Backend):
return
super()._onSocketError(error)
- if error.getErrorCode() == pyArcus.ErrorCode.Debug:
+ if error.getErrorCode() == Arcus.ErrorCode.Debug:
return
self._terminate()
self._createSocket()
- if error.getErrorCode() not in [pyArcus.ErrorCode.BindFailedError, pyArcus.ErrorCode.ConnectionResetError, pyArcus.ErrorCode.Debug]:
+ if error.getErrorCode() not in [Arcus.ErrorCode.BindFailedError, Arcus.ErrorCode.ConnectionResetError, Arcus.ErrorCode.Debug]:
Logger.log("w", "A socket error caused the connection to be reset")
# _terminate()' function sets the job status to 'cancel', after reconnecting to another Port the job status
# needs to be updated. Otherwise backendState is "Unable To Slice"
- if error.getErrorCode() == pyArcus.ErrorCode.BindFailedError and self._start_slice_job is not None:
+ if error.getErrorCode() == Arcus.ErrorCode.BindFailedError and self._start_slice_job is not None:
self._start_slice_job.setIsCancelled(False)
# Check if there's any slicable object in the scene.
@@ -695,7 +695,7 @@ class CuraEngineBackend(QObject, Backend):
self.needsSlicing()
self._onChanged()
- def _onLayerMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onLayerMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when a sliced layer data message is received from the engine.
:param message: The protobuf message containing sliced layer data.
@@ -703,7 +703,7 @@ class CuraEngineBackend(QObject, Backend):
self._stored_layer_data.append(message)
- def _onOptimizedLayerMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onOptimizedLayerMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when an optimized sliced layer data message is received from the engine.
:param message: The protobuf message containing sliced layer data.
@@ -714,7 +714,7 @@ class CuraEngineBackend(QObject, Backend):
self._stored_optimized_layer_data[self._start_slice_job_build_plate] = []
self._stored_optimized_layer_data[self._start_slice_job_build_plate].append(message)
- def _onProgressMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onProgressMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when a progress message is received from the engine.
:param message: The protobuf message containing the slicing progress.
@@ -736,7 +736,7 @@ class CuraEngineBackend(QObject, Backend):
else:
self._change_timer.start()
- def _onSlicingFinishedMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onSlicingFinishedMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when the engine sends a message that slicing is finished.
:param message: The protobuf message signalling that slicing is finished.
@@ -784,7 +784,7 @@ class CuraEngineBackend(QObject, Backend):
self.enableTimer() # manually enable timer to be able to invoke slice, also when in manual slice mode
self._invokeSlice()
- def _onGCodeLayerMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onGCodeLayerMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when a g-code message is received from the engine.
:param message: The protobuf message containing g-code, encoded as UTF-8.
@@ -795,7 +795,7 @@ 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 _onGCodePrefixMessage(self, message: pyArcus.PythonMessage) -> None:
+ def _onGCodePrefixMessage(self, message: Arcus.PythonMessage) -> None:
"""Called when a g-code prefix message is received from the engine.
:param message: The protobuf message containing the g-code prefix,
@@ -841,7 +841,7 @@ class CuraEngineBackend(QObject, Backend):
else:
self._change_timer.start()
- def _onPrintTimeMaterialEstimates(self, message: pyArcus.PythonMessage) -> None:
+ def _onPrintTimeMaterialEstimates(self, message: Arcus.PythonMessage) -> None:
"""Called when a print time message is received from the engine.
:param message: The protobuf message containing the print time per feature and
@@ -855,7 +855,7 @@ class CuraEngineBackend(QObject, Backend):
times = self._parseMessagePrintTimes(message)
self.printDurationMessage.emit(self._start_slice_job_build_plate, times, material_amounts)
- def _parseMessagePrintTimes(self, message: pyArcus.PythonMessage) -> Dict[str, float]:
+ def _parseMessagePrintTimes(self, message: Arcus.PythonMessage) -> Dict[str, float]:
"""Called for parsing message to retrieve estimated time per feature
:param message: The protobuf message containing the print time per feature
diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py
index 4a83fcbc30..4c38c16f28 100644
--- a/plugins/CuraEngineBackend/StartSliceJob.py
+++ b/plugins/CuraEngineBackend/StartSliceJob.py
@@ -1,5 +1,5 @@
-# Copyright (c) 2021 Ultimaker B.V.
-# Cura is released under the terms of the LGPLv3 or higher.
+# Copyright (c) 2021-2022 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
import numpy
from string import Formatter
@@ -7,7 +7,7 @@ from enum import IntEnum
import time
from typing import Any, cast, Dict, List, Optional, Set
import re
-import pyArcus #For typing.
+import pyArcus as Arcus # For typing.
from PyQt6.QtCore import QCoreApplication
from UM.Job import Job
@@ -90,17 +90,17 @@ class GcodeStartEndFormatter(Formatter):
class StartSliceJob(Job):
"""Job class that builds up the message of scene data to send to CuraEngine."""
- def __init__(self, slice_message: pyArcus.PythonMessage) -> None:
+ def __init__(self, slice_message: Arcus.PythonMessage) -> None:
super().__init__()
self._scene = CuraApplication.getInstance().getController().getScene() #type: Scene
- self._slice_message = slice_message #type: pyArcus.PythonMessage
+ self._slice_message: Arcus.PythonMessage = slice_message
self._is_cancelled = False #type: bool
self._build_plate_number = None #type: Optional[int]
self._all_extruders_settings = None #type: Optional[Dict[str, Any]] # cache for all setting values from all stacks (global & extruder) for the current machine
- def getSliceMessage(self) -> pyArcus.PythonMessage:
+ def getSliceMessage(self) -> Arcus.PythonMessage:
return self._slice_message
def setBuildPlate(self, build_plate_number: int) -> None:
@@ -502,7 +502,7 @@ class StartSliceJob(Job):
setting_extruder.extruder = extruder_position
Job.yieldThread()
- def _handlePerObjectSettings(self, node: CuraSceneNode, message: pyArcus.PythonMessage):
+ def _handlePerObjectSettings(self, node: CuraSceneNode, message: Arcus.PythonMessage):
"""Check if a node has per object settings and ensure that they are set correctly in the message
:param node: Node to check.