From 7f8ef60cd4d75bb4a453403747614700b290fab8 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 25 Feb 2010 13:44:03 +0100 Subject: lib/python/Screens/ChannelSelection.py: [PATCH 1/3] implement a non-visual bouquet selector for bouq +/- keys --- lib/python/Screens/ChannelSelection.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 4ca6fa39..33afb3f3 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -66,6 +66,24 @@ class BouquetSelector(Screen): def cancelClick(self): self.close(False) +class SilentBouquetSelector: + def __init__(self, bouquets, enableWrapAround=False, current=0): + self.bouquets = [b[1] for b in bouquets] + self.pos = current + self.count = len(bouquets) + self.enableWrapAround = enableWrapAround + + def up(self): + if self.pos > 0 or self.enableWrapAround: + self.pos = (self.pos - 1) % self.count + + def down(self): + if self.pos < (self.count - 1) or self.enableWrapAround: + self.pos = (self.pos + 1) % self.count + + def getCurrent(self): + return self.bouquets[self.pos] + # csel.bouquet_mark_edit values OFF = 0 EDIT_BOUQUET = 1 -- cgit v1.2.3 From 36a87ee437c42a5755400821ff2f39077be9bef3 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 25 Feb 2010 13:44:59 +0100 Subject: lib/python/Screens/InfoBarGenerics.py: [PATCH 2/3] use non-visual bouquet selector in multiepg --- lib/python/Screens/InfoBarGenerics.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index ca9ba550..108610e3 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1,4 +1,4 @@ -from ChannelSelection import ChannelSelection, BouquetSelector +from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector from Components.ActionMap import ActionMap, HelpableActionMap from Components.ActionMap import NumberActionMap @@ -555,18 +555,15 @@ 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 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) + if cnt > 1: # create bouquet list for bouq+/- + self.bouquetSel = SilentBouquetSelector(bouquets, True, self.servicelist.getBouquetNumOffset(root)) + if cnt >= 1: + self.openBouquetEPG(root, withCallback) def changeServiceCB(self, direction, epg): if self.serviceSel: -- cgit v1.2.3 From dd3cf818ebef5c080a8d49f6663200d284840974 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 25 Feb 2010 13:47:32 +0100 Subject: lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py: [PATCH 3/3] use non-visual bouquet selector in graphmultiepg --- lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py index adb7015d..aed561bf 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py @@ -1,6 +1,6 @@ from Plugins.Plugin import PluginDescriptor from GraphMultiEpg import GraphMultiEPG -from Screens.ChannelSelection import BouquetSelector +from Screens.ChannelSelection import SilentBouquetSelector from enigma import eServiceCenter, eServiceReference from ServiceReference import ServiceReference @@ -79,16 +79,16 @@ def main(session, servicelist, **kwargs): global Servicelist Servicelist = servicelist bouquets = Servicelist.getBouquetList() + root = Servicelist.getRoot() if bouquets is None: cnt = 0 else: cnt = len(bouquets) - if cnt > 1: # show bouquet list + if cnt > 1: # create 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]): + bouquetSel = SilentBouquetSelector(bouquets, True, Servicelist.getBouquetNumOffset(root)) + if cnt >= 1: # open current bouquet + if not openBouquetEPG(root): cleanup() def Plugins(**kwargs): -- cgit v1.2.3 From 005321304bec7f71e748db3173d411f5684642e2 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 17 Mar 2011 18:46:32 +0100 Subject: 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 --- data/setup.xml | 1 + lib/python/Components/UsageConfig.py | 2 ++ .../Plugins/Extensions/GraphMultiEPG/plugin.py | 40 +++++++++++++++++----- lib/python/Screens/InfoBarGenerics.py | 26 +++++++++++++- 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/data/setup.xml b/data/setup.xml index 9425afda..93549fa8 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 60827107..90f11fe2 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 aed561bf..3635272b 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 108610e3..5404a4e0 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: -- cgit v1.2.3