X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/cd4777936e5463145f70e875d46cc6fb0dcb79d2..77a115baa70d23d342a1b54aa5cedd57bc5d6282:/lib/python/Screens/ChannelSelection.py diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 3a093dee..c7c1b968 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -264,7 +264,6 @@ class ChannelSelectionEdit: def startMarkedEdit(self): self.mutableList = self.getMutableList() # add all services from the current list to internal marked set in listboxservicecontent - self.bouquetRoot = self.getRoot() self.clearMarks() # this clears the internal marked set in the listboxservicecontent self.saved_title = self.instance.getTitle() pos = self.saved_title.find(')') @@ -274,7 +273,6 @@ class ChannelSelectionEdit: else: new_title += ' ' + _("[favourite edit]") self.instance.setTitle(new_title) - print new_title self.bouquet_mark_edit = True self.__marked = self.servicelist.getRootServices() for x in self.__marked: @@ -301,7 +299,6 @@ class ChannelSelectionEdit: self.__marked = [] self.clearMarks() self.bouquet_mark_edit = False - self.bouquetRoot = None self.mutableList = None self.instance.setTitle(self.saved_title) self.saved_title = None @@ -647,9 +644,12 @@ class ChannelSelectionBase(Screen): service.setName(service_name) # why we need this cast? except: if orbpos > 1800: # west - service.setName("%s (%3.1f" + _("W") + ")" %(str, (0 - (orbpos - 3600)) / 10.0)) + orbpos = 3600 - orbpos + h = _("W") else: - service.setName("%s (%3.1f" + _("E") + ")" % (str, orbpos / 10.0)) + h = _("E") + n = ("%s (%d.%d" + h + ")") % (service_name, orbpos / 10, orbpos % 10) + service.setName(n) self.servicelist.addService(service) self.servicelist.finishFill() if prev is not None: @@ -749,6 +749,8 @@ class ChannelSelectionBase(Screen): return bouquets return None +HISTORYSIZE = 20 + class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG): def __init__(self, session): ChannelSelectionBase.__init__(self,session) @@ -773,13 +775,16 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.lastChannelRootTimer.timeout.get().append(self.__onCreate) self.lastChannelRootTimer.start(100,True) + self.history = [ ] + self.history_pos = 0 + def __onCreate(self): self.setTvMode() self.restoreRoot() lastservice=eServiceReference(config.tv.lastservice.value) if lastservice.valid(): self.setCurrentSelection(lastservice) - self.session.nav.playService(lastservice) + self.zap() def __onShown(self): self.recallBouquetMode() @@ -804,9 +809,47 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect #called from infoBar and channelSelected def zap(self): ref = self.session.nav.getCurrentlyPlayingServiceReference() - if ref is None or ref != self.getCurrentSelection(): - self.session.nav.playService(self.getCurrentSelection()) + nref = self.getCurrentSelection() + if ref is None or ref != nref: + self.session.nav.playService(nref) + self.saveRoot() + self.saveChannel() + tmp=self.servicePath[:] + tmp.append(nref) + try: + del self.history[self.history_pos+1:] + except: + pass + self.history.append(tmp) + hlen = len(self.history) + if hlen > HISTORYSIZE: + del self.history[0] + hlen -= 1 + self.history_pos = hlen-1 + + def historyBack(self): + hlen = len(self.history) + if hlen > 1 and self.history_pos > 0: + self.history_pos -= 1 + self.setHistoryPath() + + def historyNext(self): + hlen = len(self.history) + if hlen > 1 and self.history_pos < (hlen-1): + self.history_pos += 1 + self.setHistoryPath() + + def setHistoryPath(self): + path = self.history[self.history_pos][:] + ref = path.pop() + self.servicePath = path self.saveRoot() + plen = len(path) + root = path[plen-1] + if self.getRoot() != root: + self.setRoot(root) + self.session.nav.playService(ref) + self.setCurrentSelection(ref) self.saveChannel() def saveRoot(self): @@ -842,7 +885,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect if pathstr is not None and pathstr.find(refstr) == 0: self.restoreRoot() lastservice=eServiceReference(config.tv.lastservice.value) - if lastservice is not None: + if lastservice.valid(): self.setCurrentSelection(lastservice) return True return False @@ -946,7 +989,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS if pathstr is not None and pathstr.find(refstr) == 0: self.restoreRoot() lastservice=eServiceReference(config.radio.lastservice.value) - if lastservice is not None: + if lastservice.valid(): self.setCurrentSelection(lastservice) return True return False