From: Stefan Pluecken Date: Wed, 25 Jan 2006 00:17:26 +0000 (+0000) Subject: added ability to diable timers (yellow button in the timer list) X-Git-Tag: 2.6.0~4298 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/6f09a61cf36eb3918574a74588bbeec6a829b084 added ability to diable timers (yellow button in the timer list) FIXME: we need transparency for pixmaps in an eListboxPythonMultiContent --- diff --git a/data/redx.png b/data/redx.png new file mode 100644 index 00000000..e2fcfac6 Binary files /dev/null and b/data/redx.png differ diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py index 8bb6a0d9..2750c7a7 100644 --- a/lib/python/Components/TimerList.py +++ b/lib/python/Components/TimerList.py @@ -4,8 +4,9 @@ from GUIComponent import * from Tools.FuzzyDate import FuzzyTime import time -from enigma import eListboxPythonMultiContent, eListbox, gFont +from enigma import eListboxPythonMultiContent, eListbox, gFont, loadPNG from timer import TimerEntry +from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE RT_HALIGN_LEFT = 0 RT_HALIGN_RIGHT = 1 @@ -58,6 +59,10 @@ def TimerEntryComponent(timer, processed): state = "done!" res.append((eListboxPythonMultiContent.TYPE_TEXT, 320, 50, 240, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, state)) + + if timer.disabled: + png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/redx.png")) + res.append((eListboxPythonMultiContent.TYPE_PIXMAP, 490, 5, 40, 40, png)) return res diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 99939bd8..263af69f 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -26,16 +26,50 @@ class TimerEditList(Screen): self["key_yellow"] = Button("") self["key_blue"] = Button(_("Cleanup")) - self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "TimerEditActions"], + self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ShortcutActions", "TimerEditActions"], { "ok": self.openEdit, "cancel": self.leave, "red": self.removeTimer, "green": self.addCurrentTimer, "blue": self.cleanupQuestion, - "log": self.showLog - }) + "yellow": self.toggleDisabledState, + "log": self.showLog, + "left": self.left, + "right": self.right, + "up": self.up, + "down": self.down + }, -1) self.session.nav.RecordTimer.on_state_change.append(self.onStateChange) + self.onShown.append(self.updateState) + + def up(self): + self["timerlist"].instance.moveSelection(self["timerlist"].instance.moveUp) + self.updateState() + + def down(self): + self["timerlist"].instance.moveSelection(self["timerlist"].instance.moveDown) + self.updateState() + + def left(self): + self["timerlist"].instance.moveSelection(self["timerlist"].instance.pageUp) + self.updateState() + + def right(self): + self["timerlist"].instance.moveSelection(self["timerlist"].instance.pageDown) + self.updateState() + + def toggleDisabledState(self): + self["timerlist"].getCurrent()[0].disabled = not self["timerlist"].getCurrent()[0].disabled + self.updateState() + self.refill() + + def updateState(self): + if self["timerlist"].getCurrent()[0].disabled: + self["key_yellow"].setText(_("disable")) + else: + self["key_yellow"].setText(_("enable")) + self["key_yellow"].instance.invalidate() def fillTimerList(self): del self.list[:] diff --git a/timer.py b/timer.py index 5500c34a..48ba7696 100644 --- a/timer.py +++ b/timer.py @@ -16,6 +16,8 @@ class TimerEntry: self.resetRepeated() self.backoff = 0 + self.disabled = False + def resetRepeated(self): self.repeated = int(0) @@ -120,7 +122,7 @@ class Timer: # when the timer has not yet started, and is already passed, # don't go trough waiting/running/end-states, but sort it # right into the processedTimers. - if entry.shouldSkip() or entry.state == TimerEntry.StateEnded: + if entry.shouldSkip() or entry.state == TimerEntry.StateEnded or (entry.state == TimerEntry.StateWaiting and entry.disabled): print "already passed, skipping" bisect.insort(self.processed_timers, entry) entry.state = TimerEntry.StateEnded