Merge remote-tracking branch 'origin/bug_453_multiepg_no_more_ask_bouquet'
authorghost <andreas.monzner@multimedia-labs.de>
Tue, 13 Sep 2011 08:50:43 +0000 (10:50 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 13 Sep 2011 08:50:43 +0000 (10:50 +0200)
data/setup.xml
lib/python/Components/UsageConfig.py
lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/InfoBarGenerics.py

index 5f7cbf6..8620709 100755 (executable)
@@ -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 acbc342..ce56f0f 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 bcc7b9b..af14578 100644 (file)
@@ -1,8 +1,9 @@
 from Plugins.Plugin import PluginDescriptor
 from GraphMultiEpg import GraphMultiEPG
-from Screens.ChannelSelection import BouquetSelector
+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,6 +74,32 @@ 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
@@ -83,13 +110,10 @@ def main(session, servicelist, **kwargs):
                cnt = 0
        else:
                cnt = len(bouquets)
-       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()
+       if config.usage.multiepg_ask_bouquet.value:
+               openAskBouquet(session, bouquets, cnt)
+       else:
+               openSilent(servicelist, bouquets, cnt)
 
 def Plugins(**kwargs):
        name = _("Graphical Multi EPG")
index c07e349..912d678 100644 (file)
@@ -65,6 +65,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
index 2e97b59..93a4788 100644 (file)
@@ -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
@@ -559,6 +559,12 @@ class InfoBarEPG:
                        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)
@@ -568,6 +574,21 @@ class InfoBarEPG:
                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:
+                       self.openBouquetEPG(root, withCallback)
+
        def changeServiceCB(self, direction, epg):
                if self.serviceSel:
                        if direction > 0: