def pause(self): """Pause the repeat. Pausing allows the repeat to be resumed. """ # Log the pause message listeners_tick_repeat_logger.log_debug('TickRepeat.pause') # Is the repeat running? if self._status is not TickRepeatStatus.RUNNING: # Log the status listeners_tick_repeat_logger.log_debug( 'TickRepeat.pause - !TickRepeatStatus.RUNNING') # No need to pause return # Log pausing the repeat listeners_tick_repeat_logger.log_debug( 'TickRepeat.pause - TickRepeatStatus.RUNNING - Pausing TickRepeat') # Set the status to paused self._status = TickRepeatStatus.PAUSED # Set the remaining time in the current loop self._loop_time = self._delay.exec_time - time.time() # Cancel the delay tick_delays.cancel_delay(self._delay)
def stop(self): """Stop the repeat loop.""" # Log the stop message listeners_tick_repeat_logger.log_debug('TickRepeat.stop') # Is the repeat running? if self._status is not TickRepeatStatus.RUNNING: # Log the status listeners_tick_repeat_logger.log_debug( 'TickRepeat.stop - !TickRepeatStatus.RUNNING') # No need to stop it return # Log stopping the repeat listeners_tick_repeat_logger.log_debug( 'TickRepeat.stop - TickRepeatStatus.RUNNING - Stopping TickRepeat') # Set the status to stopped self._status = TickRepeatStatus.STOPPED # Cancel the delay tick_delays.cancel_delay(self._delay)