Fix conflict timers (step 6)
authorDima73 <Dima-73@inbox.lv>
Wed, 12 Aug 2015 16:21:56 +0000 (19:21 +0300)
committerDima73 <Dima-73@inbox.lv>
Wed, 12 Aug 2015 16:21:56 +0000 (19:21 +0300)
step 6:
-new code for repeat timer recording if set option "Don't stop current
event but disable coming events"

lib/python/Components/TimerList.py
lib/python/Screens/MovieSelection.py
lib/python/Screens/TimerEdit.py

index 07718f3..62fdc16 100644 (file)
@@ -48,7 +48,7 @@ class TimerList(HTMLComponent, GUIComponent, object):
                else:
                        text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60))
                icon = None
-               if not processed and not timer.disabled:
+               if not processed and (not timer.disabled or (timer.repeated and timer.isRunning() and not timer.justplay)):
                        if timer.state == TimerEntry.StateWaiting:
                                state = _("waiting")
                                icon = self.iconWait
index a7b5f41..51db000 100644 (file)
@@ -1733,8 +1733,9 @@ class MovieSelection(Screen, HelpableScreen, SelectionEventInfo, InfoBarBase, Pr
        def stopTimer(self, timer):
                if timer.isRunning():
                        if timer.repeated:
-                               timer.enable()
-                               timer.processRepeated(findRunningEvent = False)
+                               if not timer.disabled:
+                                       timer.enable()
+                               timer.processRepeated(findRunningEvent=False)
                                self.session.nav.RecordTimer.doActivate(timer)
                        else:
                                timer.afterEvent = RecordTimer.AFTEREVENT.NONE
index a617890..2879244 100644 (file)
@@ -92,6 +92,8 @@ class TimerEditList(Screen):
                cur=self["timerlist"].getCurrent()
                if cur:
                        t = cur
+                       if t.disabled and t.repeated and t.isRunning() and not t.justplay:
+                               return
                        if t.disabled:
                                print "try to ENABLE timer"
                                t.enable()
@@ -122,14 +124,18 @@ class TimerEditList(Screen):
                        self.updateState()
 
        def runningEventCallback(self, t, result):
-               if result is not None:
+               if result is not None and t.isRunning():
+                       findNextRunningEvent = True
                        if result[1] == "stoponlycurrent" or result[1] == "stopall":
+                               findNextRunningEvent = False
                                t.enable()
                                t.processRepeated(findRunningEvent = False)
                                self.session.nav.RecordTimer.doActivate(t)
                        if result[1] == "stoponlycoming" or result[1] == "stopall":
+                               findNextRunningEvent = True
                                t.disable()
                        self.session.nav.RecordTimer.timeChanged(t)
+                       t.findRunningEvent = findNextRunningEvent
                        self.refill()
                        self.updateState()
 
@@ -147,14 +153,19 @@ class TimerEditList(Screen):
                                self.key_red_choice = self.DELETE
 
                        if cur.disabled and (self.key_yellow_choice != self.ENABLE):
-                               self["actions"].actions.update({"yellow":self.toggleDisabledState})
-                               self["key_yellow"].setText(_("Enable"))
-                               self.key_yellow_choice = self.ENABLE
+                               if cur.isRunning() and cur.repeated and not cur.justplay:
+                                       self.removeAction("yellow")
+                                       self["key_yellow"].setText(" ")
+                                       self.key_yellow_choice = self.EMPTY
+                               else:
+                                       self["actions"].actions.update({"yellow":self.toggleDisabledState})
+                                       self["key_yellow"].setText(_("Enable"))
+                                       self.key_yellow_choice = self.ENABLE
                        elif cur.isRunning() and not cur.repeated and (self.key_yellow_choice != self.EMPTY):
                                self.removeAction("yellow")
                                self["key_yellow"].setText(" ")
                                self.key_yellow_choice = self.EMPTY
-                       elif ((not cur.isRunning())or cur.repeated ) and (not cur.disabled) and (self.key_yellow_choice != self.DISABLE):
+                       elif (not cur.isRunning() or cur.repeated) and not cur.disabled and (self.key_yellow_choice != self.DISABLE):
                                self["actions"].actions.update({"yellow":self.toggleDisabledState})
                                self["key_yellow"].setText(_("Disable"))
                                self.key_yellow_choice = self.DISABLE