Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Backend.Backend.Backend Class Reference
Inheritance diagram for UM.Backend.Backend.Backend:
UM.PluginObject.PluginObject

Public Member Functions

None __init__ (self)
 
None setState (self, BackendState new_state)
 
None startEngine (self)
 
None close (self)
 
List[bytes] getLog (self)
 
List[str] getEngineCommand (self)
 
- Public Member Functions inherited from UM.PluginObject.PluginObject
None __init__ (self, *args, **kwags)
 
str getId (self)
 
None setPluginId (self, str plugin_id)
 
None setMetaData (self, Dict[str, Any] metadata)
 
Dict[str, Any] getMetaData (self)
 
str getPluginId (self)
 
None setVersion (self, str version)
 
str getVersion (self)
 

Static Public Attributes

 processingProgress = Signal()
 
 backendStateChange = Signal()
 
 backendConnected = Signal()
 
 backendQuit = Signal()
 
 backendDone = Signal()
 

Protected Member Functions

None _beginThreads (self)
 
None _ensureOldProcessIsTerminated (self)
 
None _flushBackendLog (self)
 
None _backendLog (self, bytes line)
 
Optional[subprocess.Popen] _runEngineProcess (self, List[str] command_list)
 
 _storeOutputToLogThread (self, handle)
 
None _storeStderrToLogThread (self, TextIO handle)
 
None _onSocketStateChanged (self, Arcus.SocketState state)
 
None _logSocketState (self, Arcus.SocketState state)
 
None _onMessageReceived (self)
 
None _onSocketError (self, Arcus.ErrorCode error)
 
None _cleanupExistingSocket (self)
 
None _createSocket (self, Optional[str] protocol_file=None)
 

Static Protected Member Functions

str _decodeLine (bytes line)
 

Protected Attributes

dict _message_handlers = {}
 
 _socket = None
 
int _port = 49674
 
Optional[subprocess.Popen] _process = None
 
list _backend_log = []
 
 _backend_log_max_lines = None
 
BackendState _backend_state = BackendState.NotStarted
 
 _createSocket
 
 _onSocketStateChanged = SignalSocket()
 
 _onMessageReceived
 
 _onSocketError
 
- Protected Attributes inherited from UM.PluginObject.PluginObject
 _plugin_id = None
 
 _version = None
 
dict _metadata = {}
 
 _name = None
 

Detailed Description

Base class for any backend communication (separate piece of software).
It makes use of the Socket class from libArcus for the actual communication bits.
The message_handlers dict should be filled with string (full name of proto message), function pairs.

Member Function Documentation

◆ _createSocket()

None UM.Backend.Backend.Backend._createSocket ( self,
Optional[str] protocol_file = None )
protected
Create a socket for communication with an external backend.

:param protocol_file: Optional. The path to the protocol file. Default is None.
:return: None

◆ _logSocketState()

None UM.Backend.Backend.Backend._logSocketState ( self,
Arcus.SocketState state )
protected
Debug function created to provide more info for CURA-2127

◆ _onMessageReceived()

None UM.Backend.Backend.Backend._onMessageReceived ( self)
protected
Protected message handler

◆ _onSocketError()

None UM.Backend.Backend.Backend._onSocketError ( self,
Arcus.ErrorCode error )
protected
Private socket error handler

◆ _onSocketStateChanged()

None UM.Backend.Backend.Backend._onSocketStateChanged ( self,
Arcus.SocketState state )
protected
Private socket state changed handler.

◆ _runEngineProcess()

Optional[subprocess.Popen] UM.Backend.Backend.Backend._runEngineProcess ( self,
List[str] command_list )
protected
Start the (external) backend process.
:param command_list:
:return:

◆ _storeStderrToLogThread()

None UM.Backend.Backend.Backend._storeStderrToLogThread ( self,
TextIO handle )
protected
Stores the standard error output from the backend process to the log.

:param handle: The handle to the standard error output stream.
:type handle: file-like object

:return: None

◆ getEngineCommand()

List[str] UM.Backend.Backend.Backend.getEngineCommand ( self)
Get the command used to start the backend executable 

◆ getLog()

List[bytes] UM.Backend.Backend.Backend.getLog ( self)
Returns the backend log.

:return: A list of bytes representing the backend log.

◆ startEngine()

None UM.Backend.Backend.Backend.startEngine ( self)
Start the backend / engine.
Runs the engine, this is only called when the socket is fully opened & ready to accept connections

The documentation for this class was generated from the following file: