From cb98c409838187237a0ae1155b31c0bcc0fb6e21 Mon Sep 17 00:00:00 2001 From: James Cameron Date: Mon, 16 May 2011 05:33:25 +0000 Subject: 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 --- 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] -- cgit v0.9.1