remove yellow and green-buttons from ChannelSelection
[enigma2.git] / RecordTimer.py
index e26bda6..62fa637 100644 (file)
@@ -103,6 +103,13 @@ class RecordTimer(timer.Timer):
                        self.loadTimer()
                except:
                        print "unable to load timers from file!"
+                       
+       def isRecording(self):
+               isRunning = False
+               for timer in self.timer_list:
+                       if timer.isRunning():
+                               isRunning = True
+               return isRunning
        
        def loadTimer(self):
                # TODO: PATH!
@@ -148,22 +155,29 @@ class RecordTimer(timer.Timer):
 
        def removeEntry(self, entry):
                print "[Timer] Remove " + str(entry)
+
                if entry.state == timer.TimerEntry.StateRunning:
+                       print "remove running timer."
                        entry.end = time.time()
                        self.timeChanged(entry)
                elif entry.state != timer.TimerEntry.StateEnded:
                        entry.activate(timer.TimerEntry.EventAbort)
-                       self.timer_list.remove(entry)
+                       try: # FIXME: is needed, because after loading the timers, every timer (even already ended ones)
+                                # have the state EventWaiting..
+                               self.timer_list.remove(entry)
+                       except:
+                               pass
+                               
                        self.calcNextActivation()
                        print "timer did not yet start - removing"
                else:
                        print "timer did already end - doing nothing."
                
+               print "state: ", entry.state
+               print "in processed: ", entry in self.processed_timers
+               print "in running: ", entry in self.timer_list
                # now the timer should be in the processed_timers list. remove it from there.
-               try:
-                       self.processed_timers.remove(entry)
-               except:
-                       pass
+               self.processed_timers.remove(entry)
 
        def shutdown(self):
                self.saveTimer()