parted.timer module
Timer interface to “PedTimer” in parted
- author:
Adolfo Gómez, dkmaster at dkmon dot com
- class parted.timer.Timer(timer: cffi.FFI.CData | None = None)[source]
Bases:
objectTimer interface to “PedTimer” in parted
- property frac: float
Fraction of the timer elapsed
- static new(callback: Callable[[Timer], None] | None = None) Timer[source]
Creates a new timer
- Parameters:
callback (Optional[Callable[['Timer'], None]], optional) – Callback to invoke when the timer is triggered. Defaults to None.
- Returns:
New timer
- Return type:
Note
This is a wrapper for
ped_timer_new, that returns a python Timer object
- static new_nested(parent: Timer, nest_frac: float = 0, callback: Callable[[Timer], None] | None = None) Timer[source]
Creates a new nested timer
- property now: int
Current time of the timer
- property obj: cffi.FFI.CData
Wrapped
PedTimer*object
- property predicted_end: int
Predicted end time of the timer
- process_event()[source]
Processes the timer event
Note
This method is invoked by the timer callback when the timer is triggered. By default, it just calls the callback, if any. You can override this method to do something else, but maybe easier to just set a callback
- property start: int
Start time of the timer
- property state_name: str | None
Returns the name of the current state of the timer