add timeroverlap detection made by adenin (thanks for the great work!)
[enigma2.git] / lib / python / Screens / EventView.py
index 1bb3d0b16adb184d78f5a71dcbc719f5c9f030a6..5d50d9bcb5aa60d85978bfe821edb32a8f3a5c11 100644 (file)
@@ -1,12 +1,15 @@
 from Screen import Screen
 from Screen import Screen
+from Screens.TimerEdit import TimerSanityConflict
 from Components.ActionMap import ActionMap
 from Components.Button import Button
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
 from Components.ActionMap import ActionMap
 from Components.Button import Button
 from Components.Label import Label
 from Components.ScrollLabel import ScrollLabel
+from Components.TimerList import TimerList
 from enigma import eEPGCache, eTimer, eServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent
 from TimerEntry import TimerEntry
 from time import localtime
 from enigma import eEPGCache, eTimer, eServiceReference
 from RecordTimer import RecordTimerEntry, parseEvent
 from TimerEntry import TimerEntry
 from time import localtime
+from Components.config import config
 
 class EventViewBase:
        def __init__(self, Event, Ref, callback=None, similarEPGCB=None):
 
 class EventViewBase:
        def __init__(self, Event, Ref, callback=None, similarEPGCB=None):
@@ -59,13 +62,25 @@ class EventViewBase:
        def timerAdd(self):
                if not self.isRecording:
                        newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, *parseEvent(self.event))
        def timerAdd(self):
                if not self.isRecording:
                        newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, *parseEvent(self.event))
-                       self.session.openWithCallback(self.timerEditFinished, TimerEntry, newEntry)
-
-       def timerEditFinished(self, answer):
-               if (answer[0]):
-                       self.session.nav.RecordTimer.record(answer[1])
+                       self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
+
+       def finishedAdd(self, answer):
+               print "finished add"
+               if answer[0]:
+                       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:
+                                       self.session.openWithCallback(self.finishSanityCorrection, TimerSanityConflict, simulTimerList)
                else:
                else:
-                       print "Timeredit aborted"
+                       print "Timeredit aborted"               
+
+       def finishSanityCorrection(self, answer):
+               self.finishedAdd(answer)
 
        def setService(self, service):
                self.currentService=service
 
        def setService(self, service):
                self.currentService=service