[gnome-clocks] Store the remaining duration when pausing a timer
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Store the remaining duration when pausing a timer
- Date: Mon, 10 Sep 2012 17:37:03 +0000 (UTC)
commit 93bd43115d365e3de725a6dfbeef03de28d8328e
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Sep 10 19:35:21 2012 +0200
Store the remaining duration when pausing a timer
gnomeclocks/timer.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gnomeclocks/timer.py b/gnomeclocks/timer.py
index 74ef584..89e4bff 100644
--- a/gnomeclocks/timer.py
+++ b/gnomeclocks/timer.py
@@ -195,7 +195,8 @@ class Timer(Clock):
if self.state == Timer.State.STOPPED and self.timeout_id == 0:
h, m, s = self.welcome_screen.get_values()
self.timer_screen.set_time(h, m, s)
- self.deadline = time.time() + (h * 60 * 60) + (m * 60) + s
+ self.duration = (h * 60 * 60) + (m * 60) + s
+ self.deadline = time.time() + self.duration
self.state = Timer.State.RUNNING
self._add_timeout()
self.show_timer_screen()
@@ -206,10 +207,12 @@ class Timer(Clock):
self.show_welcome_screen(True)
def pause(self):
+ self.duration = self.deadline - time.time()
self.state = Timer.State.PAUSED
self._remove_timeout()
def cont(self):
+ self.deadline = time.time() + self.duration
self.state = Timer.State.RUNNING
self._add_timeout()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]