make new multi epg bouquet handling optional via usage config "Multi-EPG bouquet...
authorghost <andreas.monzner@multimedia-labs.de>
Thu, 17 Mar 2011 17:46:32 +0000 (18:46 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Thu, 17 Mar 2011 17:47:34 +0000 (18:47 +0100)
default is the old behaviour
refs bug #453

data/setup.xml
lib/python/Components/UsageConfig.py
lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
lib/python/Screens/InfoBarGenerics.py

index 9425afda93b0dfe1948a7f638bc6dd40058c1ea0..93549fa87fa86bb39862f08e5c1dd13cf110648d 100644 (file)
@@ -28,6 +28,7 @@
                        <item level="2" text="Load Length of Movies in Movielist">config.usage.load_length_of_movies_in_moviellist</item>
                        <item level="1" text="Show positioner movement">config.usage.showdish</item>
                        <item level="1" text="Enable multiple bouquets">config.usage.multibouquet</item>
+                       <item level="1" text="Multi-EPG bouquet selection">config.usage.multiepg_ask_bouquet</item>
                        <item level="1" text="Change bouquets in quickzap">config.usage.quickzap_bouquet_change</item>
                        <item level="1" text="Alternative radio mode">config.usage.e1like_radio_mode</item>
                        <item level="1" text="Action on long powerbutton press">config.usage.on_long_powerpress</item>
index 6082710768479543100ea036b4584ac788c10d0c..90f11fe21087922766982c3bb362f6a07a75c4d2 100644 (file)
@@ -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 = [
index aed561bf8b549944d75e431bce56bf4098e770fd..3635272b3864cfbbd8f8c369c1f2b50b28c93403 100644 (file)
@@ -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")
index 108610e312950f6eadc7e84f01107e9bea949f94..5404a4e00256a42d4cba2da288a86203191d3fa5 100644 (file)
@@ -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: