From: Andreas Monzner Date: Sun, 25 Jun 2006 20:04:21 +0000 (+0000) Subject: add enigma1 like radio mode (on/off switchable in usage setup) X-Git-Tag: 2.6.0~3276 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/d5abd2f599da721cf673d6a9caee06eb4ed402c2 add enigma1 like radio mode (on/off switchable in usage setup) --- diff --git a/data/keymap.xml b/data/keymap.xml index 97529668..41b7dda0 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -150,6 +150,7 @@ + diff --git a/data/setup.xml b/data/setup.xml index f4fea25d..41ecdcf0 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -22,11 +22,12 @@ config.usage.showdish config.usage.multibouquet config.usage.quickzap_bouquet_change + config.usage.e1like_radio_mode config.network.dhcp config.network.ip - config.network.netmask + config.network.netmask config.network.gateway config.network.dns diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 58051ccf..e10a7491 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -7,3 +7,4 @@ def InitUsageConfig(): config.usage.showdish = configElement("config.usage.showdish", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) ) config.usage.multibouquet = configElement("config.usage.multibouquet", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) ) config.usage.quickzap_bouquet_change = configElement("config.usage.quickzap_bouquet_change", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) ) + config.usage.e1like_radio_mode = configElement("config.usage.e1like_radio_mode", configSelection, 1, (("yes", _("yes")), ("no", _("no"))) ) diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index df1bd6c0..0870232e 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -837,9 +837,14 @@ class ChannelSelectionBase(Screen): HISTORYSIZE = 20 #config for lastservice -config.tv = ConfigSubsection(); -config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0); -config.tv.lastroot = configElement("config.tv.lastroot", configText, "", 0); +config.tv = ConfigSubsection() +config.tv.lastservice = configElement("config.tv.lastservice", configText, "", 0) +config.tv.lastroot = configElement("config.tv.lastroot", configText, "", 0) +config.radio = ConfigSubsection() +config.radio.lastservice = configElement("config.radio.lastservice", configText, "", 0) +config.radio.lastroot = configElement("config.radio.lastroot", configText, "", 0) +config.servicelist = ConfigSubsection() +config.servicelist.lastmode = configElement("config.servicelist.lastmode", configText, "tv", 0) class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelectionEPG): def __init__(self, session): @@ -847,26 +852,66 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect ChannelSelectionEdit.__init__(self) ChannelSelectionEPG.__init__(self) - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"], { "cancel": self.cancel, "ok": self.channelSelected, + "keyRadio": self.setModeRadio, + "keyTV": self.setModeTv, }) + self.onShown.append(self.__onShown) self.lastChannelRootTimer = eTimer() self.lastChannelRootTimer.timeout.get().append(self.__onCreate) self.lastChannelRootTimer.start(100,True) - self.history = [ ] + self.history_tv = [ ] + self.history_radio = [ ] + self.history = self.history_tv self.history_pos = 0 - def __onCreate(self): - self.setTvMode() + self.lastservice = config.tv.lastservice + self.lastroot = config.tv.lastroot + self.revertMode = None + + def setMode(self): self.restoreRoot() - lastservice=eServiceReference(config.tv.lastservice.value) + lastservice=eServiceReference(self.lastservice.value) if lastservice.valid(): self.setCurrentSelection(lastservice) + + def setModeTv(self): + if self.revertMode is None and config.servicelist.lastmode.value == "radio": + self.revertMode = MODE_RADIO + self.history = self.history_tv + self.lastservice = config.tv.lastservice + self.lastroot = config.tv.lastroot + config.servicelist.lastmode.value = "tv" + self.setTvMode() + self.setMode() + + def setModeRadio(self): + if self.revertMode is None and config.servicelist.lastmode.value == "tv": + self.revertMode = MODE_TV + if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes": + self.history = self.history_radio + self.lastservice = config.radio.lastservice + self.lastroot = config.radio.lastroot + config.servicelist.lastmode.value = "radio" + self.setRadioMode() + self.setMode() + + def __onCreate(self): + if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes": + if config.servicelist.lastmode.value == "tv": + self.setModeTv() + else: + self.setModeRadio() + else: + self.setModeTv() + lastservice=eServiceReference(self.lastservice.value) + if lastservice.valid(): self.zap() def __onShown(self): @@ -891,12 +936,14 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect #called from infoBar and channelSelected def zap(self): + self.revertMode=None ref = self.session.nav.getCurrentlyPlayingServiceReference() nref = self.getCurrentSelection() if ref is None or ref != nref: self.session.nav.playService(nref) self.saveRoot() self.saveChannel() + config.servicelist.lastmode.save() self.addToHistory(nref) def addToHistory(self, ref): @@ -942,34 +989,34 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect def saveRoot(self): path = '' - for i in self.servicePathTV: + for i in self.servicePath: path += i.toString() path += ';' - if len(path) and path != config.tv.lastroot.value: - config.tv.lastroot.value = path - config.tv.lastroot.save() + if len(path) and path != self.lastroot.value: + self.lastroot.value = path + self.lastroot.save() def restoreRoot(self): self.clearPath() re = compile('.+?;') - tmp = re.findall(config.tv.lastroot.value) + tmp = re.findall(self.lastroot.value) cnt = 0 for i in tmp: - self.servicePathTV.append(eServiceReference(i[:len(i)-1])) + self.servicePath.append(eServiceReference(i[:len(i)-1])) cnt += 1 if cnt: - path = self.servicePathTV.pop() + path = self.servicePath.pop() self.enterPath(path) else: self.showFavourites() self.saveRoot() def preEnterPath(self, refstr): - if len(self.servicePathTV) and self.servicePathTV[0] != eServiceReference(refstr): - pathstr = config.tv.lastroot.value + if len(self.servicePath) and self.servicePath[0] != eServiceReference(refstr): + pathstr = self.lastroot.value if pathstr is not None and pathstr.find(refstr) == 0: self.restoreRoot() - lastservice=eServiceReference(config.tv.lastservice.value) + lastservice=eServiceReference(self.lastservice.value) if lastservice.valid(): self.setCurrentSelection(lastservice) return True @@ -981,9 +1028,9 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect refstr = ref.toString() else: refstr = "" - if refstr != config.tv.lastservice.value: - config.tv.lastservice.value = refstr - config.tv.lastservice.save() + if refstr != self.lastservice.value: + self.lastservice.value = refstr + self.lastservice.save() def recallPrevService(self): hlen = len(self.history) @@ -999,11 +1046,17 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.setHistoryPath() def cancel(self): + if self.revertMode is None: + self.restoreRoot() + lastservice=eServiceReference(self.lastservice.value) + if lastservice.valid() and self.getCurrentSelection() != lastservice: + self.setCurrentSelection(lastservice) + elif self.revertMode == MODE_TV: + self.setModeTv() + elif self.revertMode == MODE_RADIO: + self.setModeRadio() + self.revertMode = None self.close(None) - self.restoreRoot() - lastservice=eServiceReference(config.tv.lastservice.value) - if lastservice.valid() and self.getCurrentSelection() != lastservice: - self.setCurrentSelection(lastservice) from Screens.InfoBarGenerics import InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 5669a77a..56721176 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -9,6 +9,7 @@ from ServiceReference import ServiceReference from Components.Clock import Clock from Components.ActionMap import ActionMap, HelpableActionMap from Components.ServicePosition import ServicePosition, ServicePositionGauge +from Components.config import currentConfigSelectionElement, config from Tools.Notifications import AddNotificationWithCallback @@ -43,7 +44,8 @@ class InfoBar(InfoBarShowHide, self["actions"] = HelpableActionMap(self, "InfobarActions", { "showMovies": (self.showMovies, _("Play recorded movies...")), - "showRadio": (self.showRadio, _("Show the radio player...")) + "showRadio": (self.showRadio, _("Show the radio player...")), + "showTv": (self.showTv, _("Show the tv player...")), }) for x in HelpableScreen, \ @@ -61,8 +63,14 @@ class InfoBar(InfoBarShowHide, self["CurrentTime"] = Clock() # ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING) + def showTv(self): + self.showTvChannelList(True) + def showRadio(self): - self.session.open(ChannelSelectionRadio) + if currentConfigSelectionElement(config.usage.e1like_radio_mode) == "yes": + self.showRadioChannelList(True) + else: + self.session.open(ChannelSelectionRadio) def showMovies(self): self.session.openWithCallback(self.movieSelected, MovieSelection) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 36f1d90c..be092c6d 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -262,6 +262,18 @@ class InfoBarChannelSelection: "openServiceList": (self.openServiceList, _("open service list")), }) + def showTvChannelList(self, zap=False): + self.servicelist.setModeTv() + if zap: + self.servicelist.zap() + self.session.execDialog(self.servicelist) + + def showRadioChannelList(self, zap=False): + self.servicelist.setModeRadio() + if zap: + self.servicelist.zap() + self.session.execDialog(self.servicelist) + def firstRun(self): self.onShown.remove(self.firstRun) config.misc.initialchannelselection.value = 0