TimerEdit: update timer after the action and add warning message again
authorDima73 <Dima-73@inbox.lv>
Sun, 15 Nov 2015 21:17:52 +0000 (23:17 +0200)
committerDima73 <Dima-73@inbox.lv>
Sun, 15 Nov 2015 21:17:52 +0000 (23:17 +0200)
lib/python/Screens/TimerEdit.py

index 37f97d5..e7b8edb 100644 (file)
@@ -346,6 +346,8 @@ class TimerEditList(Screen):
                self.refill()
                self.updateState()
 
+confirmConflict = True
+
 class TimerSanityConflict(Screen):
        def __init__(self, session, timer):
                Screen.__init__(self, session)
@@ -396,26 +398,42 @@ class TimerSanityConflict(Screen):
 
        def editTimerCallBack(self, answer=None):
                if answer and len(answer) > 1 and answer[0] is True:
+                       self.session.nav.RecordTimer.timeChanged(answer[1])
                        self.leave_ok()
 
        def toggleTimer(self):
                selected_timer = self["timerlist"].getCurrent()
                if selected_timer and self["key_yellow"].getText() != " ":
                        selected_timer.disabled = not selected_timer.disabled
+                       self.session.nav.RecordTimer.timeChanged(selected_timer)
                        self.leave_ok()
 
        def ignoreConflict(self):
                        selected_timer = self["timerlist"].getCurrent()
                        if selected_timer and selected_timer.conflict_detection:
-                               selected_timer.conflict_detection = False
-                               selected_timer.disabled = False
-                               self.leave_ok()
+                               if confirmConflict:
+                                       list = [(_("yes"), True), (_("no"), False), (_("yes") + " " + _("and never ask again this session again"), "never")]
+                                       self.session.openWithCallback(self.ignoreConflictConfirm, MessageBox, _("Warning!\nThis is an option for advanced users.\nReally disable timer conflict detection?"), list=list)
+                               else:
+                                       self.ignoreConflictConfirm(True)
+
+       def ignoreConflictConfirm(self, answer):
+               selected_timer = self["timerlist"].getCurrent()
+               if answer and selected_timer and selected_timer.conflict_detection:
+                       if answer == "never":
+                               global confirmConflict
+                               confirmConflict = False
+                       selected_timer.conflict_detection = False
+                       selected_timer.disabled = False
+                       self.session.nav.RecordTimer.timeChanged(selected_timer)
+                       self.leave_ok()
 
        def leave_ok(self):
                if self.isResolvedConflict():
                        self.close((True, self.timer[0]))
                else:
                        self.timer[0].disabled = True
+                       self.session.nav.RecordTimer.timeChanged(self.timer[0])
                        self.updateState()
                        self.session.open(MessageBox, _("Conflict not resolved!"), MessageBox.TYPE_ERROR, timeout=3)