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

def __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...
 
def getOutputDevice (self, device_id)
 Get an output device by ID. More...
 
def addOutputDevice (self, device)
 Add and register an output device. More...
 
def removeOutputDevice (self, device_id)
 Remove a registered device by ID. More...
 
def getActiveDevice (self)
 Get the active device. More...
 
def setActiveDevice (self, device_id)
 Set the active device. More...
 
def resetActiveDevice (self)
 Reset the active device to the default device. More...
 
def addOutputDevicePlugin (self, plugin)
 Add an OutputDevicePlugin instance. More...
 
def removeOutputDevicePlugin (self, plugin_id)
 Remove an OutputDevicePlugin by ID. More...
 
def getOutputDevicePlugin (self, 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...
 
 outputDevicesChanged = Signal()
 Emitted whenever an output device is added or removed. More...
 
 activeDeviceChanged = Signal()
 Emitted whenever the active device changes. More...
 

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()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addOutputDevice (   self,
  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()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addOutputDevicePlugin (   self,
  plugin 
)

Add an OutputDevicePlugin instance.

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

◆ getActiveDevice()

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

Get the active device.

◆ getOutputDevice()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevice (   self,
  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()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevicePlugin (   self,
  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()

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

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()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.removeOutputDevicePlugin (   self,
  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.

◆ resetActiveDevice()

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

Reset the active device to the default device.

◆ setActiveDevice()

def UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.setActiveDevice (   self,
  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

◆ activeDeviceChanged

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

Emitted whenever the active device changes.

◆ outputDevicesChanged

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

Emitted whenever an output device is added or removed.

◆ 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: