Uranium
Application Framework
|
A class representing a time duration. More...
Inherits QObject.
Public Member Functions | |
__init__ (self, duration=None, parent=None) | |
Create a duration object. | |
days (self) | |
hours (self) | |
minutes (self) | |
seconds (self) | |
valid (self) | |
isTotalDurationZero (self) | |
setDuration (self, duration) | |
Set the duration in seconds. | |
getDisplayString (self, display_format=DurationFormat.Format.Short) | |
Get a string representation of this object that can be used to display in interfaces. | |
totalSeconds (self) | |
Static Public Attributes | |
durationChanged = pyqtSignal() | |
Protected Attributes | |
_days | |
_hours | |
_minutes | |
_seconds | |
A class representing a time duration.
This is primarily used as a value type to QML so we can report things like "How long will this print take" without needing a bunch of logic in the QML.
UM.Qt.Duration.Duration.__init__ | ( | self, | |
duration = None , |
|||
parent = None |
|||
) |
Create a duration object.
duration | The duration in seconds. If this is None (the default), an invalid Duration object will be created. |
parent | The QObject parent. |
UM.Qt.Duration.Duration.getDisplayString | ( | self, | |
display_format = DurationFormat.Format.Short |
|||
) |
Get a string representation of this object that can be used to display in interfaces.
This is not called toString() primarily because that conflicts with JavaScript"s toString()
UM.Qt.Duration.Duration.setDuration | ( | self, | |
duration | |||
) |
Set the duration in seconds.
This will convert the given amount of seconds into an amount of days, hours, minutes and seconds. Note that this is mostly a workaround for issues with PyQt, as a value type this class should not really have a setter.