X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/613447d89ad124aa6fb52627dd7c98085cdd8d31..c10c4f53c44e2c97068b163e23804d706a974bd3:/lib/python/Screens/TimerEdit.py diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index aae345db..caaf8c95 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -95,10 +95,11 @@ class TimerEditList(Screen): else: if t.isRunning(): if t.repeated: - list = [] - list.append((_("Stop current event but not coming events"), "stoponlycurrent")) - list.append((_("Stop current event and disable coming events"), "stopall")) - list.append((_("Don't stop current event but disable coming events"), "stoponlycoming")) + list = ( + (_("Stop current event but not coming events"), "stoponlycurrent"), + (_("Stop current event and disable coming events"), "stopall"), + (_("Don't stop current event but disable coming events"), "stoponlycoming") + ) self.session.openWithCallback(boundFunction(self.runningEventCallback, t), ChoiceBox, title=_("Repeating event currently recording... What do you want to do?"), list = list) else: t.disable() @@ -170,14 +171,11 @@ class TimerEditList(Screen): self.key_blue_choice = self.EMPTY def fillTimerList(self): - del self.list[:] - - for timer in self.session.nav.RecordTimer.timer_list: - self.list.append((timer, False)) - - for timer in self.session.nav.RecordTimer.processed_timers: - self.list.append((timer, True)) - self.list.sort(cmp = lambda x, y: x[0].begin < y[0].begin) + list = self.list + del list[:] + list.extend([(timer, False) for timer in self.session.nav.RecordTimer.timer_list]) + list.extend([(timer, True) for timer in self.session.nav.RecordTimer.processed_timers]) + list.sort(cmp = lambda x, y: x[0].begin < y[0].begin) def showLog(self): cur=self["timerlist"].getCurrent() @@ -199,9 +197,11 @@ class TimerEditList(Screen): self.updateState() def removeTimerQuestion(self): - if not self["timerlist"].getCurrent(): + cur = self["timerlist"].getCurrent() + if not cur: return - self.session.openWithCallback(self.removeTimer, MessageBox, _("Really delete this timer?")) + + self.session.openWithCallback(self.removeTimer, MessageBox, _("Do you really want to delete %s?") % (cur.name)) def removeTimer(self, result): if not result: @@ -212,18 +212,6 @@ class TimerEditList(Screen): timer = cur timer.afterEvent = AFTEREVENT.NONE self.session.nav.RecordTimer.removeEntry(timer) - if not timer.dontSave: - for timer in self.session.nav.RecordTimer.timer_list: - if timer.dontSave and timer.autoincrease: - timer.end = timer.begin + (3600 * 24 * 356 * 1) - self.session.nav.RecordTimer.timeChanged(timer) - timersanitycheck = TimerSanityCheck(self.session.nav.RecordTimer.timer_list,timer) - if not timersanitycheck.check(): - tsc_list = timersanitycheck.getSimulTimerList() - if len(tsc_list) > 1: - timer.end = tsc_list[1].begin - 30 - self.session.nav.RecordTimer.timeChanged(timer) - self.refill() self.updateState() @@ -259,6 +247,7 @@ class TimerEditList(Screen): def addTimer(self, timer): self.session.openWithCallback(self.finishedAdd, TimerEntry, timer) + def finishedEdit(self, answer): print "finished edit" @@ -267,19 +256,25 @@ class TimerEditList(Screen): print "Edited timer" entry = answer[1] timersanitycheck = TimerSanityCheck(self.session.nav.RecordTimer.timer_list, entry) + success = False if not timersanitycheck.check(): simulTimerList = timersanitycheck.getSimulTimerList() - if (len(simulTimerList) == 2) and (simulTimerList[1].dontSave) and (simulTimerList[1].autoincrease): - simulTimerList[1].end = entry.begin - 30 - self.session.nav.RecordTimer.timeChanged(simulTimerList[1]) - self.session.nav.RecordTimer.timeChanged(entry) - else: - print "Sanity check failed" - self.session.openWithCallback(self.finishedEdit, TimerSanityConflict, timersanitycheck.getSimulTimerList()) + if simulTimerList is not None: + for x in simulTimerList: + if x.setAutoincreaseEnd(entry): + self.session.nav.RecordTimer.timeChanged(x) + if not timersanitycheck.check(): + simulTimerList = timersanitycheck.getSimulTimerList() + if simulTimerList is not None: + self.session.openWithCallback(self.finishedEdit, TimerSanityConflict, timersanitycheck.getSimulTimerList()) + else: + success = True else: + success = True + if success: print "Sanity check passed" - if not timersanitycheck.doubleCheck(): - self.session.nav.RecordTimer.timeChanged(entry) + self.session.nav.RecordTimer.timeChanged(entry) + self.fillTimerList() self.updateState() else: @@ -291,11 +286,11 @@ class TimerEditList(Screen): entry = answer[1] simulTimerList = self.session.nav.RecordTimer.record(entry) if simulTimerList is not None: - if (len(simulTimerList) == 2) and (simulTimerList[1].dontSave) and (simulTimerList[1].autoincrease): - simulTimerList[1].end = entry.begin - 30 - self.session.nav.RecordTimer.timeChanged(simulTimerList[1]) - self.session.nav.RecordTimer.record(entry) - else: + for x in simulTimerList: + if x.setAutoincreaseEnd(entry): + self.session.nav.RecordTimer.timeChanged(x) + simulTimerList = self.session.nav.RecordTimer.record(entry) + if simulTimerList is not None: self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList) self.fillTimerList() self.updateState() @@ -333,6 +328,8 @@ class TimerSanityConflict(Screen): self.list.append((_("Conflicting timer") + " " + str(count), x)) self.list2.append((timer[count], False)) count += 1 + if count == 1: + self.list.append((_("Channel not in services list"))) self["list"] = MenuList(self.list) self["timer2"] = TimerList(self.list2) @@ -409,7 +406,7 @@ class TimerSanityConflict(Screen): self["actions"].actions.update({"green":self.toggleTimer1}) self["key_green"].setText(_("Enable")) self.key_green_choice = self.ENABLE - elif self.timer[0].isRunning() and not timer[0].repeated and self.key_green_choice != self.EMPTY: + elif self.timer[0].isRunning() and not self.timer[0].repeated and self.key_green_choice != self.EMPTY: self.removeAction("green") self["key_green"].setText(" ") self.key_green_choice = self.EMPTY @@ -429,7 +426,7 @@ class TimerSanityConflict(Screen): self["actions"].actions.update({"blue":self.toggleTimer2}) self["key_blue"].setText(_("Enable")) self.key_blue_choice = self.ENABLE - elif self.timer[x].isRunning() and not timer[x].repeated and self.key_blue_choice != self.EMPTY: + elif self.timer[x].isRunning() and not self.timer[x].repeated and self.key_blue_choice != self.EMPTY: self.removeAction("blue") self["key_blue"].setText(" ") self.key_blue_choice = self.EMPTY