From 2d5b15f3ca1f7f92f949906d0199f9266d845e31 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sun, 15 Jan 2006 21:38:30 +0000 Subject: [PATCH] update timerlist when timerstate changes --- lib/python/Screens/TimerEdit.py | 8 ++++++++ timer.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 6df05c6f..ff2a017f 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -33,6 +33,7 @@ class TimerEditList(Screen): "red": self.removeTimer, "green": self.addCurrentTimer }) + self.session.nav.RecordTimer.on_state_change.append(self.onStateChange) def fillTimerList(self): del self.list[:] @@ -50,6 +51,9 @@ class TimerEditList(Screen): def removeTimer(self): # FIXME doesn't work... self.session.nav.RecordTimer.removeEntry(self["timerlist"].getCurrent()[0]) + self.refill() + + def refill(self): self.fillTimerList() self["timerlist"].invalidate() @@ -94,4 +98,8 @@ class TimerEditList(Screen): def leave(self): self.session.nav.RecordTimer.saveTimer() + self.session.nav.RecordTimer.on_state_change.remove(self.onStateChange) self.close() + + def onStateChange(self, entry): + self.refill() diff --git a/timer.py b/timer.py index 7123a84a..9fa0ab2a 100644 --- a/timer.py +++ b/timer.py @@ -53,6 +53,9 @@ class TimerEntry: print time.strftime("%c", time.localtime(self.end)) self.begin += 86400 self.end += 86400 + + self.timeChanged() + def __lt__(self, o): return self.getNextActivation() < o.getNextActivation() @@ -102,9 +105,11 @@ class Timer: self.lastActivation = time.time() self.calcNextActivation() + self.on_state_change = [ ] def stateChanged(self, entry): - pass + for f in self.on_state_change: + f(entry) def addTimerEntry(self, entry, noRecalc=0): entry.processRepeated() -- 2.30.2