From: ghost Date: Thu, 17 Mar 2011 17:46:32 +0000 (+0100) Subject: make new multi epg bouquet handling optional via usage config "Multi-EPG bouquet... X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=005321304bec7f71e748db3173d411f5684642e2 make new multi epg bouquet handling optional via usage config "Multi-EPG bouquet selection (Yes/No)" option default is the old behaviour refs bug #453 --- diff --git a/data/setup.xml b/data/setup.xml index 9425afd..93549fa 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -28,6 +28,7 @@ config.usage.load_length_of_movies_in_moviellist config.usage.showdish config.usage.multibouquet + config.usage.multiepg_ask_bouquet config.usage.quickzap_bouquet_change config.usage.e1like_radio_mode config.usage.on_long_powerpress diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index 6082710..90f11fe 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -9,6 +9,8 @@ def InitUsageConfig(): config.usage = ConfigSubsection(); config.usage.showdish = ConfigYesNo(default = True) config.usage.multibouquet = ConfigYesNo(default = False) + config.usage.multiepg_ask_bouquet = ConfigYesNo(default = False) + config.usage.quickzap_bouquet_change = ConfigYesNo(default = False) config.usage.e1like_radio_mode = ConfigYesNo(default = False) config.usage.infobar_timeout = ConfigSelection(default = "5", choices = [ diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py index aed561b..3635272 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py @@ -1,8 +1,9 @@ from Plugins.Plugin import PluginDescriptor from GraphMultiEpg import GraphMultiEPG -from Screens.ChannelSelection import SilentBouquetSelector +from Screens.ChannelSelection import BouquetSelector, SilentBouquetSelector from enigma import eServiceCenter, eServiceReference from ServiceReference import ServiceReference +from Components.config import config Session = None Servicelist = None @@ -73,23 +74,46 @@ def changeBouquetCB(direction, epg): epg_bouquet = bouquet epg.setServices(services) +def openAskBouquet(Session, bouquets, cnt): + if cnt > 1: # show bouquet list + global bouquetSel + bouquetSel = Session.openWithCallback(closed, BouquetSelector, bouquets, openBouquetEPG, enableWrapAround=True) + dlg_stack.append(bouquetSel) + elif cnt == 1: + if not openBouquetEPG(bouquets[0][1]): + cleanup() + +def openSilent(Servicelist, bouquets, cnt): + root = Servicelist.getRoot() + if cnt > 1: # create bouquet list + global bouquetSel + current = 0 + rootstr = root.toCompareString() + for bouquet in bouquets: + if bouquet[1].toCompareString() == rootstr: + break + current += 1 + if current >= cnt: + current = 0 + bouquetSel = SilentBouquetSelector(bouquets, True, current) + if cnt >= 1: # open current bouquet + if not openBouquetEPG(root): + cleanup() + def main(session, servicelist, **kwargs): global Session Session = session global Servicelist Servicelist = servicelist bouquets = Servicelist.getBouquetList() - root = Servicelist.getRoot() if bouquets is None: cnt = 0 else: cnt = len(bouquets) - if cnt > 1: # create bouquet list - global bouquetSel - bouquetSel = SilentBouquetSelector(bouquets, True, Servicelist.getBouquetNumOffset(root)) - if cnt >= 1: # open current bouquet - if not openBouquetEPG(root): - cleanup() + if config.usage.multiepg_ask_bouquet.value: + openAskBouquet(session, bouquets, cnt) + else: + openSilent(servicelist, bouquets, cnt) def Plugins(**kwargs): name = _("Graphical Multi EPG") diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 108610e..5404a4e 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -555,11 +555,35 @@ class InfoBarEPG: def openMultiServiceEPG(self, withCallback=True): bouquets = self.servicelist.getBouquetList() - root = self.servicelist.getRoot() if bouquets is None: cnt = 0 else: cnt = len(bouquets) + if config.usage.multiepg_ask_bouquet.value: + self.openMultiServiceEPGAskBouquet(bouquets, cnt, withCallback) + else: + self.openMultiServiceEPGSilent(bouquets, cnt, withCallback) + + def openMultiServiceEPGAskBouquet(self, bouquets, cnt, withCallback): + if cnt > 1: # show bouquet list + if withCallback: + self.bouquetSel = self.session.openWithCallback(self.closed, BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True) + self.dlg_stack.append(self.bouquetSel) + else: + self.bouquetSel = self.session.open(BouquetSelector, bouquets, self.openBouquetEPG, enableWrapAround=True) + elif cnt == 1: + self.openBouquetEPG(bouquets[0][1], withCallback) + + def openMultiServiceEPGSilent(self, bouquets, cnt, withCallback): + root = self.servicelist.getRoot() + rootstr = root.toCompareString() + current = 0 + for bouquet in bouquets: + if bouquet[1].toCompareString() == rootstr: + break + current += 1 + if current >= cnt: + current = 0 if cnt > 1: # create bouquet list for bouq+/- self.bouquetSel = SilentBouquetSelector(bouquets, True, self.servicelist.getBouquetNumOffset(root)) if cnt >= 1: