def loadTimer(self):
try:
doc = xml.etree.cElementTree.parse(self.Filename)
except SyntaxError:
from Tools.Notifications import AddPopup
from Screens.MessageBox import MessageBox
AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
print "timers.xml failed to load!"
try:
import os
os.rename(self.Filename, self.Filename + "_old")
except (IOError, OSError):
print "renaming broken timer failed"
return
except IOError:
print "timers.xml not found!"
return
root = doc.getroot()
checkit = False
timer_text = ""
for timer in root.findall("timer"):
newTimer = createTimer(timer)
conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True)
if conflict_list:
checkit = True
if newTimer in conflict_list:
timer_text += _("\nTimer '%s' disabled!") % newTimer.name
if checkit:
from Tools.Notifications import AddPopup
from Screens.MessageBox import MessageBox
AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
评论列表
文章目录