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

Base class for output devices. More...

Public Member Functions

def __init__ (self, device_id, **kwargs)
 
def getId (self)
 Get the device id.
 
def getName (self)
 Get a human-readable name for this device. More...
 
def setName (self, name)
 Set the human-readable name of this device. More...
 
def getShortDescription (self)
 Get a short description for this device. More...
 
def setShortDescription (self, description)
 Set the short description for this device. More...
 
def getDescription (self)
 Get a full description for this device. More...
 
def setDescription (self, description)
 Set the full description for this device. More...
 
def getIconName (self)
 Get the name of an icon that can be used to identify this device. More...
 
def setIconName (self, name)
 Set the name of an icon to identify this device. More...
 
def getPriority (self)
 The priority of this device. More...
 
def setPriority (self, priority)
 Set the priority of this device. More...
 
def requestWrite (self, nodes, file_name=None, limit_mimetypes=False, file_handler=None, **kwargs)
 Request performing a write operation on this device. More...
 

Static Public Attributes

 metaDataChanged = Signal()
 
 writeStarted = Signal()
 
 writeProgress = Signal()
 
 writeFinished = Signal()
 
 writeError = Signal()
 
 writeSuccess = Signal()
 

Detailed Description

Base class for output devices.

This class provides a base class for output devices. An output device can be anything we want to output to, like a local file, an USB connected printer but also an HTTP web service.

Each subclass must implement requestWrite(). requestWrite() is expected to raise errors from OutputDeviceError when certain conditions occur, like insufficient permissions. For the rest, output device subclasses are completely free to implement writing however they want, though you should emit writeStarted and related signals whenever certain events happen related to the write process.

For example, when implementing a web service as output device, it would be completely acceptable to show a login dialog when calling requestWrite() if there are no saved login credentials.

Member Function Documentation

◆ getDescription()

def UM.OutputDevice.OutputDevice.OutputDevice.getDescription (   self)

Get a full description for this device.

The full description describes what would happen when writing to this device. For example, "Save to Removable Drive /media/sdcard", "Upload to YouMagine with account User".

◆ getIconName()

def UM.OutputDevice.OutputDevice.OutputDevice.getIconName (   self)

Get the name of an icon that can be used to identify this device.

This icon should be available in the theme.

◆ getName()

def UM.OutputDevice.OutputDevice.OutputDevice.getName (   self)

Get a human-readable name for this device.

◆ getPriority()

def UM.OutputDevice.OutputDevice.OutputDevice.getPriority (   self)

The priority of this device.

Priority indicates which device is most likely to be used as the default device to write to. It should be a number and higher numbers indicate that the device should be preferred over devices with lower numbers.

◆ getShortDescription()

def UM.OutputDevice.OutputDevice.OutputDevice.getShortDescription (   self)

Get a short description for this device.

The short description can be used as a button label or similar and should thus be only a few words at most. For example, "Save to File", "Print with USB".

◆ requestWrite()

def UM.OutputDevice.OutputDevice.OutputDevice.requestWrite (   self,
  nodes,
  file_name = None,
  limit_mimetypes = False,
  file_handler = None,
**  kwargs 
)

Request performing a write operation on this device.

This method should be implemented by subclasses. It should write the given SceneNode forest to a destination relevant for the device. It is recommended to perform the actual writing asynchronously and rely on the write signals to properly indicate state.

Parameters
nodesA collection of scene nodes that should be written to the device.
file_namestring A suggestion for the file name to write to. Can be freely ignored if providing a file name makes no sense.
limit_mimetypeLimit output to these mime types.
file_handlerThe filehandler to use to write the file with.
kwargsKeyword arguments.
Exceptions
OutputDeviceError.WriteRequestFailedError

◆ setDescription()

def UM.OutputDevice.OutputDevice.OutputDevice.setDescription (   self,
  description 
)

Set the full description for this device.

Parameters
descriptionThe description of this device.

◆ setIconName()

def UM.OutputDevice.OutputDevice.OutputDevice.setIconName (   self,
  name 
)

Set the name of an icon to identify this device.

Parameters
nameThe name of the icon to use.

◆ setName()

def UM.OutputDevice.OutputDevice.OutputDevice.setName (   self,
  name 
)

Set the human-readable name of this device.

Parameters
nameThe new name of this device.

◆ setPriority()

def UM.OutputDevice.OutputDevice.OutputDevice.setPriority (   self,
  priority 
)

Set the priority of this device.

Parameters
priorityint The priority to use.

◆ setShortDescription()

def UM.OutputDevice.OutputDevice.OutputDevice.setShortDescription (   self,
  description 
)

Set the short description for this device.

Parameters
descriptionThe new short description to set.

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