Uranium
Application Framework
Loading...
Searching...
No Matches
UM.OutputDevice.OutputDeviceManager.OutputDeviceManager Class Reference

Public Member Functions

None __init__ (self)
ValuesView["OutputDevice"] getOutputDevices (self)
ValuesView["ProjectOutputDevice"] getProjectOutputDevices (self)
KeysView[str] getOutputDeviceIds (self)
Optional["OutputDevice"] getOutputDevice (self, str device_id)
None start (self)
None stop (self)
None startDiscovery (self)
None refreshConnections (self)
None connectWriteSignalsToDevice (self, "OutputDevice" device)
None disconnectWriteSignalsFromDevice (self, "OutputDevice" device)
None addOutputDevice (self, "OutputDevice" device)
bool removeOutputDevice (self, str device_id)
None addProjectOutputDevice (self, "ProjectOutputDevice" device)
bool removeProjectOutputDevice (self, str device_id)
 getActiveDevice (self)
None setActiveDevice (self, str device_id)
None resetActiveDevice (self)
None addOutputDevicePlugin (self, "OutputDevicePlugin" plugin)
None removeOutputDevicePlugin (self, str plugin_id)
Dict[str, "OutputDevicePlugin"] getAllOutputDevicePlugins (self)
Optional["OutputDevicePlugin"] getOutputDevicePlugin (self, str plugin_id)

Public Attributes

 addOutputDevicePlugin

Static Public Attributes

 writeStarted = Signal()
 writeProgress = Signal()
 writeFinished = Signal()
 writeError = Signal()
 writeSuccess = Signal()
 manualDeviceAdded = Signal()
 manualDeviceRemoved = Signal()
 outputDevicesChanged = Signal()
 projectOutputDevicesChanged = Signal()
 activeDeviceChanged = Signal()

Protected Member Functions

Optional["OutputDevice"] _findHighestPriorityDevice (self)

Protected Attributes

dict _output_devices = {}
dict _project_output_devices = {}
dict _plugins = {}
Optional["OutputDevice"] _active_device = None
bool _active_device_override = False
bool _write_in_progress = False
bool _is_running = False

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

◆ _findHighestPriorityDevice()

Optional["OutputDevice"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager._findHighestPriorityDevice ( self)
protected
private:

◆ addOutputDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addOutputDevice ( self,
"OutputDevice" device )
Add and register an output device.

:param :type{OutputDevice} 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.

:param :type{OutputDevicePlugin} The plugin to add.

:note This does nothing if the plugin was already added.

◆ addProjectOutputDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.addProjectOutputDevice ( self,
"ProjectOutputDevice" device )
Add and register a project output device.

:param device: The output device to add.

:note Does nothing if a device with the same ID as the passed device was already added.

◆ connectWriteSignalsToDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.connectWriteSignalsToDevice ( self,
"OutputDevice" device )
Connects all the necessary write signals of the device to the write signals of the manager
:param device: The output device

◆ disconnectWriteSignalsFromDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.disconnectWriteSignalsFromDevice ( self,
"OutputDevice" device )
Disconnects all the necessary write signals of the device from the write signals of the manager
:param device: The output device

◆ getActiveDevice()

UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getActiveDevice ( self)
Get the active device.

◆ getOutputDevice()

Optional["OutputDevice"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevice ( self,
str device_id )
Get an output device by ID.

:param device_id: The ID of the device to retrieve.
:return: :type{OutputDevice} The output device corresponding to the ID or None if not found.

◆ getOutputDeviceIds()

KeysView[str] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDeviceIds ( self)
Get a list of all IDs of registered output devices.

:return: :type{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

:param plugin_id: The ID of the plugin to retrieve

:return: The plugin corresponding to the specified ID or None if it was not found.

◆ getOutputDevices()

ValuesView["OutputDevice"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getOutputDevices ( self)
Get a list of all registered output devices.

:return: :type{list} A list of all registered output devices.

◆ getProjectOutputDevices()

ValuesView["ProjectOutputDevice"] UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.getProjectOutputDevices ( self)
Get a list of all registered output devices.

:return: :type{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

:param device_id: The ID of the device to remove.

:note This does nothing if the device_id does not correspond to a registered device.
:return: Whether the device was successfully removed or not.

◆ removeOutputDevicePlugin()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.removeOutputDevicePlugin ( self,
str plugin_id )
Remove an OutputDevicePlugin by ID.

:param plugin_id: The ID of the plugin to remove.

:note This does nothing if the specified plugin_id was not found.

◆ removeProjectOutputDevice()

bool UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.removeProjectOutputDevice ( self,
str device_id )
Remove a registered project output device by ID

:param device_id: The ID of the device to remove.

:note This does nothing if the device_id does not correspond to a registered device.
:return: Whether the device was successfully removed or not.

◆ resetActiveDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.resetActiveDevice ( self)
Reset the active device to the default device.

◆ setActiveDevice()

None UM.OutputDevice.OutputDeviceManager.OutputDeviceManager.setActiveDevice ( self,
str device_id )
Set the active device.

:param device_id: The ID of the device to set as active device.

:note This does nothing if the device_id does not correspond to a registered device.
:note This will override the default active device selection behaviour.

The documentation for this class was generated from the following file:
  • UM/OutputDevice/OutputDeviceManager.py