diff options
author | James Cameron <quozl@laptop.org> | 2011-05-16 05:33:25 (GMT) |
---|---|---|
committer | James Cameron <quozl@laptop.org> | 2011-05-16 05:40:50 (GMT) |
commit | cb98c409838187237a0ae1155b31c0bcc0fb6e21 (patch) | |
tree | 5c59a1a9b8c921a74311a7cf30894b1ef731b186 /stopwatch.py | |
parent | 62f2daa0f5c83f1df140cb61978a70ab9bb2f04e (diff) |
disable idle suspend on opening journal entry with running timer
Prior patch left a corner case, where only stopwatches started with a
start button in the current instance of the activity would disable
idle suspend. This patch extends that to stopwatches started as a
result of opening a journal entry.
dev.laptop.org #10787
Diffstat (limited to 'stopwatch.py')
-rw-r--r-- | stopwatch.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/stopwatch.py b/stopwatch.py index d24f0e3..ddb4c3c 100644 --- a/stopwatch.py +++ b/stopwatch.py @@ -123,7 +123,10 @@ class WatchModel(): timeval = event_time - timeval return self._set_state((timeval, s)) - + + def is_running(self): + return self._state[1] == WatchModel.STATE_RUNNING + def _set_state(self, q): self._logger.debug("_set_state") if self._state != q: @@ -442,6 +445,8 @@ class GUIView(): def set_state(self,states): for i in xrange(GUIView.NUM_WATCHES): self._watches[i].reset(states[i][0], states[i][1]) + if self._watches[i].is_running(): + suspend.inhibit() def get_marks(self): return [list(m) for m in self._markers] |