X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/36940d42cf3cc58b40a5a6f5fe86bad50ff48ad7..5c544307eedb70b2d5e2e5f2fd05480d4ea26478:/lib/python/Screens/ChannelSelection.py diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 03182ab8..f273daa7 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -217,8 +217,8 @@ class ChannelSelectionBase(Screen): self.service_types = self.service_types_tv - #self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet') - self.bouquet_root = eServiceReference('%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types)) + self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "bouquets.tv" ORDER BY bouquet') + #self.bouquet_root = eServiceReference('%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(self.service_types)) self["key_red"] = Button("All") self["key_green"] = Button("Satellites") @@ -232,12 +232,6 @@ class ChannelSelectionBase(Screen): self.numericalTextInput = NumericalTextInput() - self.lastService = None - - self.lastServiceTimer = eTimer() - self.lastServiceTimer.timeout.get().append(self.lastService) - self.lastServiceTimer.start(100) - def getBouquetNumOffset(self, bouquet): if self.bouquet_root.getPath().find('FROM BOUQUET "bouquets.') == -1: #FIXME HACK return 0 @@ -329,12 +323,6 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit): config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0); config.tv.lastroot = configElement("config.tv.lastroot", configText, "", 0); - #if config.tv.lastroot.value == "": - #allways defaults to fav - #self.servicelist.setRoot(eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet')) - self.showFavourites() - self.session.nav.playService(eServiceReference(config.tv.lastservice.value)) - class ChannelActionMap(NumberActionMap): def action(self, contexts, action): if not self.csel.enterBouquet(action): @@ -366,15 +354,32 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit): self["actions"].csel = self self.onShown.append(self.onShow) +# self.onLayoutFinish.append(self.onCreate) + self.lastChannelRootTimer = eTimer() + self.lastChannelRootTimer.timeout.get().append(self.onCreate) + self.lastChannelRootTimer.start(100,True) + + def onCreate(self): + lastroot=eServiceReference(config.tv.lastroot.value) + if lastroot.valid(): + self.setRoot(lastroot) + else: + self.showFavourites() + self.saveRoot(self.getRoot()) + lastservice=eServiceReference(config.tv.lastservice.value) + if lastservice.valid(): + self.session.nav.playService(lastservice) + self.servicelist.setCurrent(lastservice) + def onShow(self): ref = self.session.nav.getCurrentlyPlayingServiceReference() - if ref.valid() and ref.getPath() == "": + if ref is not None and ref.valid() and ref.getPath() == "": self.servicelist.setPlayableIgnoreService(ref) else: self.servicelist.setPlayableIgnoreService(eServiceReference()) def showEPGList(self): - ref=self.servicelist.getCurrent() + ref=self.getCurrentSelection() ptr=eEPGCache.getInstance() if ptr.startTimeQuery(ref) != -1: self.session.open(EPGSelection, ref) @@ -382,7 +387,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit): print 'no epg for service', ref.toString() def channelSelected(self): - ref = self.servicelist.getCurrent() + ref = self.getCurrentSelection() if self.movemode: self.toggleMoveMarked() elif (ref.flags & 7) == 7: @@ -396,11 +401,11 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit): def setRoot(self, root): if not self.movemode: self.setRootBase(root) - self.saveRoot(root) #called from infoBar and channelSelected def zap(self): - self.session.nav.playService(self.servicelist.getCurrent()) + self.session.nav.playService(self.getCurrentSelection()) + self.saveRoot(self.getRoot()) self.saveChannel() def saveRoot(self, root): @@ -417,11 +422,14 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit): config.tv.lastservice.value = refstr config.tv.lastservice.save() - def lastService(self): - self.lastServiceTimer.stop() - #zap to last running tv service - #self.setRoot(eServiceReference(config.tv.lastroot.value)) - self.session.nav.playService(eServiceReference(config.tv.lastservice.value)) + def cancel(self): + self.close(None) + lastroot=eServiceReference(config.tv.lastroot.value) + lastservice=eServiceReference(config.tv.lastservice.value) + if lastroot.valid() and self.getRoot() != lastroot: + self.setRoot(lastroot) + if lastservice.valid() and self.getCurrentSelection() != lastservice: + self.servicelist.setCurrent(lastservice) class SimpleChannelSelection(ChannelSelectionBase): def __init__(self, session, title): @@ -460,7 +468,7 @@ class SimpleChannelSelection(ChannelSelectionBase): self.session.currentDialog.instance.setTitle(self.title) def channelSelected(self): # just return selected service - ref = self.servicelist.getCurrent() + ref = self.getCurrentSelection() self.close(ref) def setRoot(self, root):