import time
import codecs
#from time import datetime
-from Tools import Directories
+from Tools import Directories, Notifications
import timer
import xml.dom.minidom
+from Screens.MessageBox import MessageBox
import NavigationInstance
from Tools.XMLTools import elementsWithTag
if self.record_service == None:
print "timer record failed."
else:
- self.record_service.prepare(self.Filename + ".ts")
+ if self.record_service.prepare(self.Filename + ".ts"):
+ # error.
+ Notifications.AddNotificationWithCallback(self.failureCB, MessageBox, _("A timer failed to record!\nReason: unknown."))
+
f = open(self.Filename + ".ts.meta", "w")
f.write(str(self.service_ref) + "\n")
f.write(self.epg_data + "\n")
del f
-
elif self.record_service == None:
if event != self.EventAbort:
print "timer record start failed, can't finish recording."
self.record_service = None
print "Timer successfully ended"
+ def failureCB(self, answer):
+ if answer == True:
+ print "kill user to record"
+ else:
+ print "user killed record"
def createTimer(xml):
begin = int(xml.getAttribute("begin"))
entry.repeated = False
+ entry.repeated = False
+
if entry.state == timer.TimerEntry.StateRunning:
print "remove running timer."
entry.end = time.time()
from Components.ActionMap import ActionMap
from Components.ServicePosition import ServicePosition
+from Tools.Notifications import AddNotificationWithCallback
+
from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \
InfoBarPowerKey, InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, \
InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \
- InfoBarAudioSelection, InfoBarAdditionalInfo
+ InfoBarAudioSelection, InfoBarAdditionalInfo, InfoBarNotifications
from Screens.HelpMenu import HelpableScreen, HelpMenu
class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey,
InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG,
InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection,
- HelpableScreen, InfoBarAdditionalInfo):
+ HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications):
def __init__(self, session):
Screen.__init__(self, session)
InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \
InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, \
- InfoBarAdditionalInfo:
+ InfoBarAdditionalInfo, InfoBarNotifications:
x.__init__(self)
self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")]))
class MoviePlayer(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \
InfoBarMenu, \
- InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen):
+ InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications):
def __init__(self, session, service):
Screen.__init__(self, session)
"leavePlayer": self.leavePlayer
})
- for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection:
+ for x in HelpableScreen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, InfoBarMenu, InfoBarServiceName, InfoBarPVR, InfoBarAudioSelection, InfoBarNotifications:
x.__init__(self)
self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
from Screens.Standby import Standby
from Screens.EventView import EventView
+from Tools import Notifications
+
#from enigma import eTimer, eDVBVolumecontrol, quitMainloop
from enigma import *
self["ButtonRedText"] = Label(_("Record"))
self["ButtonGreen"] = Pixmap()
self["ButtonYellow"] = Pixmap()
- self["ButtonBlue"] = Pixmap()
\ No newline at end of file
+ self["ButtonBlue"] = Pixmap()
+
+class InfoBarNotifications:
+ def __init__(self):
+ self.onExecBegin.append(self.checkNotifications)
+ Notifications.notificationAdded.append(self.checkNotificationsIfExecing)
+
+ def checkNotificationsIfExecing(self):
+ if self.execing:
+ self.checkNotifications()
+
+ def checkNotifications(self):
+ if len(Notifications.notifications):
+ n = Notifications.notifications[0]
+ Notifications.notifications = Notifications.notifications[1:]
+ print "open",n
+ cb = n[0]
+ if cb is not None:
+ self.session.openWithCallback(cb, *n[1:])
+ else:
+ self.session.open(*n[1:])
self.onExecBegin = [ ]
self.onShown = [ ]
+ self.execing = False
+
# in order to support screens *without* a help,
# we need the list in every screen. how ironic.
self.helpList = [ ]
def execBegin(self):
+ self.active_components = [ ]
for x in self.onExecBegin:
x()
+ if self.session.currentDialog != self:
+ return
+
# assert self.session == None, "a screen can only exec one per time"
# self.session = session
+
for (name, val) in self.items():
val.execBegin()
+ if self.session.currentDialog != self:
+ return
+ self.active_components.append(val)
+ self.execing = True
+
for x in self.onShown:
x()
def execEnd(self):
- for (name, val) in self.items():
+# for (name, val) in self.items():
+ for val in self.active_components:
val.execEnd()
# assert self.session != None, "execEnd on non-execing screen!"
# self.session = None
+ self.execing = False
# never call this directly - it will be called from the session!
def doClose(self):
installdir = $(LIBDIR)/enigma2/python/Tools
install_DATA = \
- FuzzyDate.py XMLTools.py Directories.py NumericalTextInput.py KeyBindings.py BoundFunction.py ISO639.py __init__.py
+ FuzzyDate.py XMLTools.py Directories.py NumericalTextInput.py KeyBindings.py BoundFunction.py ISO639.py Notifications.py __init__.py
--- /dev/null
+
+notifications = [ ]
+
+notificationAdded = [ ]
+
+def AddNotification(screen, *args):
+ AddNotificationWithCallback(None, screen, *args)
+
+def AddNotificationWithCallback(fnc, screen, *args):
+ notifications.append((fnc, screen) + args)
+ for x in notificationAdded:
+ x()
+
-all = ["FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py", "BoundFunction.py", "ISO639.py"]
+all = ["FuzzyDate.py", "XMLTools.py", "Directories.py", "KeyBindings.py", "BoundFunction.py", "ISO639.py", "Notifications"]