def stop(cls): """Stop a timer.""" # DO NOT call TimeDisplay.stop_time() again; it will double the time cls._set_mode_save() TimeDisplay.reset_time() if cls.stop_callback: cls.stop_callback()
def stop(cls): """Stop a timer.""" # stop_time() already called from prompt_stop() cls._set_mode_save() TimeDisplay.reset_time() for callback in cls.stop_callback: callback()
def reset(cls): """Discard a stopped timer's time instead of saving it.""" cls._set_mode_stopped() TimeDisplay.reset_time(erase=True) TimeDisplay.show_default() Notes.clear() for callback in cls.reset_callback: callback()
def save(cls): """Save a stopped timer's time to the log.""" cls._set_mode_stopped() notes = Notes.get_text() timestamp = TimeDisplay.get_timestamp() TimeLog.add_to_log(timestamp, *TimeDisplay.get_time(), notes) LogView.refresh() Notes.clear() TimeDisplay.stop_time() TimeDisplay.reset_time() if cls.save_callback: cls.save_callback()