2021-09-13 16:50:23 +00:00
|
|
|
|
class Wait():
|
|
|
|
|
""" The wait class allows the user to execute programmed actions after a desired delay without blocking other processor activity.
|
|
|
|
|
|
|
|
|
|
In addition to being used as a one-shot (decorator), Wait can be named and reusable.
|
2021-09-21 15:27:39 +00:00
|
|
|
|
|
|
|
|
|
---
|
2021-09-13 16:50:23 +00:00
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
- Time (float) - Expiration time of the wait in seconds
|
|
|
|
|
- Function (function) - Code to execute when Time expires
|
2021-09-21 15:27:39 +00:00
|
|
|
|
|
|
|
|
|
---
|
2021-09-13 16:50:23 +00:00
|
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
- Function - Returns (function) - Code to execute when Time expires.
|
|
|
|
|
- Time - Returns (float) - Expiration time of the wait in seconds with 10ms precision.
|
|
|
|
|
"""
|
|
|
|
|
Time: float = 0.0
|
|
|
|
|
Function: callable = None
|
|
|
|
|
|
|
|
|
|
def __init__(self, Time: float, Function: callable=None) -> None:
|
|
|
|
|
""" File class constructor.
|
|
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
- Time (float) - Expiration time of the wait in seconds
|
|
|
|
|
- Function (function) - Code to execute when Time expires
|
|
|
|
|
"""
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
def Add(self, Time: float) -> None:
|
|
|
|
|
""" Add time to current timer. """
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def Cancel(self) -> None:
|
|
|
|
|
""" Stop wait Function from executing when the timer expires. """
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def Change(self) -> None:
|
|
|
|
|
""" Set a new Time value for current and future timers in this instance. """
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def Restart(self) -> None:
|
|
|
|
|
""" Restarts the timer – executes the Function in Time seconds. If the a timer is active, cancels that timer before starting the new timer.
|
|
|
|
|
"""
|
|
|
|
|
pass
|