Add documentation

I need a bit of documentation for myself to understand this process.

Contributes to issue CURA-1278.
This commit is contained in:
Ghostkeeper 2016-05-23 13:02:46 +02:00
parent f68a9ae90f
commit bace52fccf

View file

@ -29,6 +29,10 @@ catalog = i18nCatalog("cura")
class CuraEngineBackend(Backend): class CuraEngineBackend(Backend):
## Starts the back-end plug-in.
#
# This registers all the signal listeners and prepares for communication
# with the back-end in general.
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@ -50,19 +54,15 @@ class CuraEngineBackend(Backend):
self._onActiveViewChanged() self._onActiveViewChanged()
self._stored_layer_data = [] self._stored_layer_data = []
# When there are current settings and machine instance is changed, there is no profile changed event. We should #When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired.
# pretend there is though. #This timer will group them up, and only slice for the last setting changed signal.
#Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveProfileChanged) #TODO: Properly group propertyChanged signals by whether they are triggered by the same user interaction.
#self._profile = None
#Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged)
#self._onActiveProfileChanged()
self._change_timer = QTimer() self._change_timer = QTimer()
self._change_timer.setInterval(500) self._change_timer.setInterval(500)
self._change_timer.setSingleShot(True) self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self.slice) self._change_timer.timeout.connect(self.slice)
#Listeners for receiving messages from the back-end.
self._message_handlers["cura.proto.Layer"] = self._onLayerMessage self._message_handlers["cura.proto.Layer"] = self._onLayerMessage
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
@ -70,29 +70,31 @@ class CuraEngineBackend(Backend):
self._message_handlers["cura.proto.ObjectPrintTime"] = self._onObjectPrintTimeMessage self._message_handlers["cura.proto.ObjectPrintTime"] = self._onObjectPrintTimeMessage
self._message_handlers["cura.proto.SlicingFinished"] = self._onSlicingFinishedMessage self._message_handlers["cura.proto.SlicingFinished"] = self._onSlicingFinishedMessage
self._slicing = False self._slicing = False #Are we currently slicing?
self._restart = False self._restart = False #Back-end is currently restarting?
self._enabled = True self._enabled = True #Should we be slicing? Slicing might be paused when, for instance, the user is dragging the mesh around.
self._always_restart = True self._always_restart = True #Always restart the engine when starting a new slice. Don't keep the process running. TODO: Fix engine statelessness.
self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers. self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers.
self._message = None self._message = None #Pop-up message that shows the slicing progress bar (or an error message).
self.backendQuit.connect(self._onBackendQuit) self.backendQuit.connect(self._onBackendQuit)
self.backendConnected.connect(self._onBackendConnected) self.backendConnected.connect(self._onBackendConnected)
#When a tool operation is in progress, don't slice. So we need to listen for tool operations.
Application.getInstance().getController().toolOperationStarted.connect(self._onToolOperationStarted) Application.getInstance().getController().toolOperationStarted.connect(self._onToolOperationStarted)
Application.getInstance().getController().toolOperationStopped.connect(self._onToolOperationStopped) Application.getInstance().getController().toolOperationStopped.connect(self._onToolOperationStopped)
#Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onInstanceChanged) ## Called when closing the application.
#
# This function should terminate the engine process.
def close(self): def close(self):
# Terminate CuraEngine if it is still running at this point # Terminate CuraEngine if it is still running at this point
self._terminate() self._terminate()
super().close() super().close()
## Get the command that is used to call the engine. ## Get the command that is used to call the engine.
# This is usefull for debugging and used to actually start the engine # This is useful for debugging and used to actually start the engine.
# \return list of commands and args / parameters. # \return list of commands and args / parameters.
def getEngineCommand(self): def getEngineCommand(self):
active_machine = Application.getInstance().getMachineManager().getActiveMachineInstance() active_machine = Application.getInstance().getMachineManager().getActiveMachineInstance()
@ -112,7 +114,7 @@ class CuraEngineBackend(Backend):
## Emitted when the slicing process starts. ## Emitted when the slicing process starts.
slicingStarted = Signal() slicingStarted = Signal()
## Emitted whne the slicing process is aborted forcefully. ## Emitted when the slicing process is aborted forcefully.
slicingCancelled = Signal() slicingCancelled = Signal()
## Perform a slice of the scene. ## Perform a slice of the scene.