Uranium
Application Framework
Loading...
Searching...
No Matches
UM.OutputDevice.OutputDevice.OutputDevice Class Reference
Inheritance diagram for UM.OutputDevice.OutputDevice.OutputDevice:
UM.OutputDevice.ProjectOutputDevice.ProjectOutputDevice

Public Member Functions

None __init__ (self, str device_id, **str kwargs)
str getId (self)
str getName (self)
None setName (self, str name)
str getShortDescription (self)
None setShortDescription (self, str description)
str getDescription (self)
None setDescription (self, str description)
str getIconName (self)
None setIconName (self, str name)
int getPriority (self)
None setPriority (self, int priority)
None requestWrite (self, List[SceneNode] nodes, Optional[str] file_name=None, bool limit_mimetypes=False, Optional[FileHandler] file_handler=None, bool filter_by_machine=False, **str kwargs)

Static Public Attributes

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

Protected Attributes

 _id = device_id
str _name = "Unknown Device"
str _short_description = "Unknown Device"
str _description = "Do something with an unknown device"
str _icon_name = "generic_device"
int _priority = 0

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

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

str 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.

◆ getId()

str UM.OutputDevice.OutputDevice.OutputDevice.getId ( self)
Get the device id

◆ getName()

str UM.OutputDevice.OutputDevice.OutputDevice.getName ( self)
Get a human-readable name for this device.

◆ getPriority()

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

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

None UM.OutputDevice.OutputDevice.OutputDevice.requestWrite ( self,
List[SceneNode] nodes,
Optional[str] file_name = None,
bool limit_mimetypes = False,
Optional[FileHandler] file_handler = None,
bool filter_by_machine = False,
**str 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.

:param nodes: A collection of scene nodes that should be written to the
device.
:param file_name: A suggestion for the file name to write
to. Can be freely ignored if providing a file name makes no sense.
:param limit_mimetypes: Limit output to these mime types.
:param file_handler: The filehandler to use to write the file with.
:param kwargs: Keyword arguments.
:exception OutputDeviceError.WriteRequestFailedError

◆ setDescription()

None UM.OutputDevice.OutputDevice.OutputDevice.setDescription ( self,
str description )
Set the full description for this device.

:param description: The description of this device.

◆ setIconName()

None UM.OutputDevice.OutputDevice.OutputDevice.setIconName ( self,
str name )
Set the name of an icon to identify this device.

:param name: The name of the icon to use.

◆ setName()

None UM.OutputDevice.OutputDevice.OutputDevice.setName ( self,
str name )
Set the human-readable name of this device.

:param name: The new name of this device.

◆ setPriority()

None UM.OutputDevice.OutputDevice.OutputDevice.setPriority ( self,
int priority )
Set the priority of this device.

:param priority: The priority to use.

◆ setShortDescription()

None UM.OutputDevice.OutputDevice.OutputDevice.setShortDescription ( self,
str description )
Set the short description for this device.

:param description: The new short description to set.

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