+
+ def AddTimer(self, owner, interval, repeat):
+ """Add a new timer.
+
+ The receiver must support a "OnTimer(self, timer_id)" function.
+
+ @type owner: instance
+ @param owner: Receiver
+ @type interval: int or float
+ @param interval: Timer interval in seconds
+ @type repeat: bool
+ @param repeat: Whether this is a repeating timer or one-off
+
+ """
+ # TODO: Implement repeating timers
+ assert not repeat, "Repeating timers are not yet supported"
+
+ # Get new ID
+ self._timer_id_last += 1
+
+ timer_id = self._timer_id_last
+
+ self._timer_add.append(Timer(owner, timer_id, time.time(),
+ float(interval), repeat))
+
+ return timer_id
+
+ def RemoveTimer(self, timer_id):
+ """Removes a timer.
+
+ @type timer_id: int
+ @param timer_id: Timer ID
+
+ """
+ self._timer_remove.append(timer_id)