Uranium
Application Framework
UM.OutputDevice.OutputDeviceManager.OutputDeviceManager Class Reference

Manages all available output devices and the plugin objects used to create them. More...

Public Member Functions

None __init__ (self)
 
def getOutputDevices (self)
 Get a list of all registered output devices. More...
 
def getOutputDeviceIds (self)
 Get a list of all IDs of registered output devices. More...
 
Optional["OutputDevice"] getOutputDevice (self, str device_id)
 Get an output device by ID. More...
 
def start (self)
 
def stop (self)
 
None startDiscovery (self)
 
None refreshConnections (self)
 
None addOutputDevice (self, "OutputDevice" device)
 Add and register an output device. More...
 
bool removeOutputDevice (self, str device_id)
 Remove a registered device by ID. More...
 
def getActiveDevice (self)
 Get the active device.
 
None setActiveDevice (self, str device_id)
 Set the active device. More...
 
None resetActiveDevice (self)
 Reset the active device to the default device.
 
None addOutputDevicePlugin (self, "OutputDevicePlugin" plugin)
 Add an OutputDevicePlugin instance. More...
 
None removeOutputDevicePlugin (self, str plugin_id)
 Remove an OutputDevicePlugin by ID. More...
 
Dict[str, "OutputDevicePlugin"] getAllOutputDevicePlugins (self)
 
Optional["OutputDevicePlugin"] getOutputDevicePlugin (self, str plugin_id)
 Get an OutputDevicePlugin by plugin ID. More...
 

Static Public Attributes

 writeStarted = Signal()
 Emitted whenever a registered device emits writeStarted. More...
 
 writeProgress = Signal()
 Emitted whenever a registered device emits writeProgress. More...
 
 writeFinished = Signal()
 Emitted whenever a registered device emits writeFinished. More...
 
 writeError = Signal()
 Emitted whenever a registered device emits writeError. More...
 
 writeSuccess = Signal()
 Emitted whenever a registered device emits writeSuccess. More...
 
 manualDeviceAdded = Signal()
 Emitted whenever a device has been added manually.
 
 manualDeviceRemoved = Signal()
 Emitted whenever a device has been removed manually.
 
 outputDevicesChanged = Signal()
 Emitted whenever an output device is added or removed.
 
 activeDeviceChanged = Signal()
 Emitted whenever the active device changes.
 

Detailed Description

Manages all available output devices and the plugin objects used to create them.

This class is intended as the main entry point for anything relating to file saving. For the most basic usage, call getActiveDevice() to get an output device, then call OutputDevice::requestWrite() on the returned object.

Active Device

The active device by default is determined based on the priority of individual OutputDevice instances when there is more than one OutputDevice available. When adding a device, the active device will be updated with the highest priority device. Should there be two devices with the same priority the active device will be the first device encountered with that priority.

Calling setActiveDevice() will override this behaviour and instead force the active device to the specified device. This active device will not change when a new device is added or removed, but it will revert back to the default behaviour if the active device is removed. Call resetActiveDevice() to reset the active device to the default behaviour based on priority.

OutputDevicePlugin and OutputDevice creation/removal

Each instance of an OutputDevicePlugin is meant as an OutputDevice creation object. Subclasses of OutputDevicePlugin are meant to perform device lookup and listening for events like device hot-plugging. When a new device has been detected, the plugin class should create an instance of an OutputDevice subclass and add it to this manager class using addOutputDevice(). Similarly, if a device has been removed the OutputDevicePlugin is expected to call removeOutputDevice() to remove the proper device.

Member Function Documentation

◆ addOutputDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addOutputDevice (   self,
"OutputDevice"  device 
)

Add and register an output device.

Parameters
<em>OutputDevice</em>The output device to add.
Note
Does nothing if a device with the same ID as the passed device was already added.

◆ addOutputDevicePlugin()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addOutputDevicePlugin (   self,
"OutputDevicePlugin"  plugin 
)

Add an OutputDevicePlugin instance.

Parameters
<em>OutputDevicePlugin</em>The plugin to add.
Note
This does nothing if the plugin was already added.

◆ getOutputDevice()

Optional["OutputDevice"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevice (   self,
str  device_id 
)

Get an output device by ID.

Parameters
device_idThe ID of the device to retrieve.
Returns
OutputDevice The output device corresponding to the ID or None if not found.

◆ getOutputDeviceIds()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDeviceIds (   self)

Get a list of all IDs of registered output devices.

Returns
list A list of all registered output device ids.

◆ getOutputDevicePlugin()

Optional["OutputDevicePlugin"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevicePlugin (   self,
str  plugin_id 
)

Get an OutputDevicePlugin by plugin ID.

Parameters
plugin_idThe ID of the plugin to retrieve
Returns
The plugin corresponding to the specified ID or None if it was not found.

◆ getOutputDevices()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevices (   self)

Get a list of all registered output devices.

Returns
list A list of all registered output devices.

◆ removeOutputDevice()

bool UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.removeOutputDevice (   self,
str  device_id 
)

Remove a registered device by ID.

Parameters
device_idThe ID of the device to remove.
Note
This does nothing if the device_id does not correspond to a registered device.
Returns
Whether the device was successfully removed or not.

◆ removeOutputDevicePlugin()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.removeOutputDevicePlugin (   self,
str  plugin_id 
)

Remove an OutputDevicePlugin by ID.

Parameters
plugin_idThe ID of the plugin to remove.
Note
This does nothing if the specified plugin_id was not found.

◆ setActiveDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.setActiveDevice (   self,
str  device_id 
)

Set the active device.

Parameters
device_idThe ID of the device to set as active device.
Note
This does nothing if the device_id does not correspond to a registered device.
This will override the default active device selection behaviour.

Member Data Documentation

◆ writeError

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.writeError = Signal()
static

Emitted whenever a registered device emits writeError.

See also
OutputDevice::writeError

◆ writeFinished

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.writeFinished = Signal()
static

Emitted whenever a registered device emits writeFinished.

See also
OutputDevice::writeFinished

◆ writeProgress

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.writeProgress = Signal()
static

Emitted whenever a registered device emits writeProgress.

See also
OutputDevice::writeProgress

◆ writeStarted

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.writeStarted = Signal()
static

Emitted whenever a registered device emits writeStarted.

See also
OutputDevice::writeStarted

◆ writeSuccess

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.writeSuccess = Signal()
static

Emitted whenever a registered device emits writeSuccess.

See also
OutputDevice::writeSuccess

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