X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b..e1072f2a25d38e636110e8df73042e0c801f3cd5:/lib/python/Screens/EpgSelection.py diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py index e7388fc2..f8edba11 100644 --- a/lib/python/Screens/EpgSelection.py +++ b/lib/python/Screens/EpgSelection.py @@ -6,6 +6,9 @@ from Components.Label import Label from Components.EpgList import EPGList, EPG_TYPE_SINGLE, EPG_TYPE_SIMILAR, EPG_TYPE_MULTI from Components.ActionMap import ActionMap from Components.TimerSanityCheck import TimerSanityCheck +from Components.UsageConfig import preferredTimerPath +from Components.Sources.ServiceEvent import ServiceEvent +from Components.Sources.Event import Event from Screens.TimerEdit import TimerSanityConflict from Screens.EventView import EventViewSimple from Screens.MessageBox import MessageBox @@ -25,12 +28,16 @@ class EPGSelection(Screen): ZAP = 1 - def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None): + def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None, serviceChangeCB=None): Screen.__init__(self, session) self.bouquetChangeCB = bouquetChangeCB + self.serviceChangeCB = serviceChangeCB self.ask_time = -1 #now self["key_red"] = Button("") self.closeRecursive = False + self.saved_title = None + self["Service"] = ServiceEvent() + self["Event"] = Event() if isinstance(service, str) and eventid != None: self.type = EPG_TYPE_SIMILAR self["key_yellow"] = Button() @@ -68,7 +75,7 @@ class EPGSelection(Screen): self["key_green"] = Button(_("Add timer")) self.key_green_choice = self.ADD_TIMER self.key_red_choice = self.EMPTY - self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = self.session.nav.RecordTimer) + self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = session.nav.RecordTimer) self["actions"] = ActionMap(["EPGSelectActions", "OkCancelActions"], { @@ -80,11 +87,12 @@ class EPGSelection(Screen): "info": self.infoKeyPressed, "red": self.zapTo, "input_date_time": self.enterDateTime, - "nextBouquet": self.nextBouquet, - "prevBouquet": self.prevBouquet + "nextBouquet": self.nextBouquet, # just used in multi epg yet + "prevBouquet": self.prevBouquet, # just used in multi epg yet + "nextService": self.nextService, # just used in single epg yet + "prevService": self.prevService, # just used in single epg yet }) self["actions"].csel = self - self.onLayoutFinish.append(self.onCreate) def nextBouquet(self): @@ -95,6 +103,14 @@ class EPGSelection(Screen): if self.bouquetChangeCB: self.bouquetChangeCB(-1, self) + def nextService(self): + if self.serviceChangeCB: + self.serviceChangeCB(1, self) + + def prevService(self): + if self.serviceChangeCB: + self.serviceChangeCB(-1, self) + def enterDateTime(self): if self.type == EPG_TYPE_MULTI: global mepg_config_initialized @@ -129,6 +145,10 @@ class EPGSelection(Screen): self.services = services self.onCreate() + def setService(self, service): + self.currentService = service + self.onCreate() + #just used in multipeg def onCreate(self): l = self["list"] @@ -137,7 +157,13 @@ class EPGSelection(Screen): l.fillMultiEPG(self.services, self.ask_time) l.moveToService(self.session.nav.getCurrentlyPlayingServiceReference()) elif self.type == EPG_TYPE_SINGLE: - l.fillSingleEPG(self.currentService) + service = self.currentService + self["Service"].newService(service.ref) + if self.saved_title is None: + self.saved_title = self.instance.getTitle() + title = self.saved_title + ' - ' + service.getServiceName() + self.instance.setTitle(title) + l.fillSingleEPG(service) else: l.fillSimilarList(self.currentService, self.eventid) @@ -210,7 +236,7 @@ class EPGSelection(Screen): self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName()) break else: - newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, *parseEvent(event)) + newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(event)) self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry) def finishedAdd(self, answer): @@ -286,6 +312,7 @@ class EPGSelection(Screen): self.key_red_choice = self.EMPTY return event = cur[0] + self["Event"].newEvent(event) if self.type == EPG_TYPE_MULTI: count = self["list"].getCurrentChangeCount() if self.ask_time != -1: @@ -308,8 +335,12 @@ class EPGSelection(Screen): else: datestr = '%s %d.%d.'%(_("Today"), begTime[2], begTime[1]) self["date"].setText(datestr) + if cur[1] is None: + self["Service"].newService(None) + else: + self["Service"].newService(cur[1].ref) - if cur[1] is None or cur[1].getServiceName() == "": + if cur[1] is None or cur[1].getServiceName() == "": if self.key_green_choice != self.EMPTY: self["key_green"].setText("") self.key_green_choice = self.EMPTY