X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/9bfa0ff587586c3bfe761200ca9fd890081024d4..0f1d2fd66b8a00440370f2c55aecb7819a4fa35a:/lib/python/Screens/EpgSelection.py diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py index c8db81b3..5613c8b1 100644 --- a/lib/python/Screens/EpgSelection.py +++ b/lib/python/Screens/EpgSelection.py @@ -18,11 +18,18 @@ from time import localtime import xml.dom.minidom class EPGSelection(Screen): - def __init__(self, session, service, zapFunc=None): + def __init__(self, session, service, zapFunc=None, eventid=None): Screen.__init__(self, session) self["key_red"] = Button("") self.closeRecursive = False - if isinstance(service, eServiceReference): + if isinstance(service, str) and eventid != None: + self.type = EPG_TYPE_SIMILAR + self["key_yellow"] = Button() + self["key_blue"] = Button() + self["key_red"] = Button() + self.currentService=service + self.eventid = eventid + elif isinstance(service, eServiceReference) or isinstance(service, str): self.type = EPG_TYPE_SINGLE self["key_yellow"] = Button() self["key_blue"] = Button() @@ -46,11 +53,11 @@ class EPGSelection(Screen): self.zapFunc = zapFunc self["key_green"] = Button(_("Add timer")) - self["list"] = EPGList(self.type, self.onSelectionChanged) + self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = self.session.nav.RecordTimer) class ChannelActionMap(ActionMap): def action(self, contexts, action): - ActionMap.action(self, contexts, action) + return ActionMap.action(self, contexts, action) self["actions"] = ChannelActionMap(["EPGSelectActions", "OkCancelActions"], { @@ -67,10 +74,10 @@ class EPGSelection(Screen): self.onLayoutFinish.append(self.onCreate) def closeScreen(self): - self.close(self.closeRecursive or self.type == EPG_TYPE_SINGLE) + self.close(self.closeRecursive) def infoKeyPressed(self): - if self.type == EPG_TYPE_MULTI: + if self.type == EPG_TYPE_MULTI or self.type == EPG_TYPE_SIMILAR: cur = self["list"].getCurrent() event = cur[0] service = cur[1] @@ -78,7 +85,13 @@ class EPGSelection(Screen): event = self["list"].getCurrent() service = self.currentService if event is not None: - self.session.open(EventViewSimple, event, service, self.eventViewCallback) + if self.type != EPG_TYPE_SIMILAR: + self.session.open(EventViewSimple, event, service, self.eventViewCallback, self.openSimilarList) + else: + self.session.open(EventViewSimple, event, service, self.eventViewCallback) + + def openSimilarList(self, eventid, refstr): + self.session.open(EPGSelection, refstr, None, eventid) #just used in multipeg def onCreate(self): @@ -86,10 +99,13 @@ class EPGSelection(Screen): if self.type == EPG_TYPE_MULTI: l.recalcEntrySize() l.fillMultiEPG(self.services) - else: + elif self.type == EPG_TYPE_SINGLE: if SINGLE_CPP == 0: l.recalcEntrySize() l.fillSingleEPG(self.currentService) + else: + l.recalcEntrySize() + l.fillSimilarList(self.currentService, self.eventid) def eventViewCallback(self, setEvent, setService, val): l = self["list"] @@ -105,8 +121,8 @@ class EPGSelection(Screen): if self.type == EPG_TYPE_MULTI and cur[0] is None and cur[1].ref != old[1].ref: self.eventViewCallback(setEvent, setService, val) else: - setEvent(cur[0]) setService(cur[1]) + setEvent(cur[0]) def zapTo(self): # just used in multiepg if self.zapFunc != None: @@ -115,10 +131,10 @@ class EPGSelection(Screen): self.zapFunc(ref.ref) def eventSelected(self): - if self.type == EPG_TYPE_SINGLE: - self.infoKeyPressed() - else: # EPG_TYPE_MULTI + if self.type == EPG_TYPE_MULTI: self.zapTo() + else: + self.infoKeyPressed() def yellowButtonPressed(self): if self.type == EPG_TYPE_MULTI: @@ -155,25 +171,25 @@ class EPGSelection(Screen): def applyButtonState(self, state): if state == 1: - self["now_button_sel"].showWidget() - self["now_button"].hideWidget() + self["now_button_sel"].show() + self["now_button"].hide() else: - self["now_button"].showWidget() - self["now_button_sel"].hideWidget() + self["now_button"].show() + self["now_button_sel"].hide() if state == 2: - self["next_button_sel"].showWidget() - self["next_button"].hideWidget() + self["next_button_sel"].show() + self["next_button"].hide() else: - self["next_button"].showWidget() - self["next_button_sel"].hideWidget() + self["next_button"].show() + self["next_button_sel"].hide() if state == 3: - self["more_button_sel"].showWidget() - self["more_button"].hideWidget() + self["more_button_sel"].show() + self["more_button"].hide() else: - self["more_button"].showWidget() - self["more_button_sel"].hideWidget() + self["more_button"].show() + self["more_button_sel"].hide() def onSelectionChanged(self): if self.type == EPG_TYPE_MULTI: