better tabs?
[enigma2.git] / lib / python / Screens / ChannelSelection.py
index f22070c01f41bdf5f65cd31355ccee1f06bbcb54..9f90d1b20212236b850275e80b2cce2026dea4de 100644 (file)
@@ -1,11 +1,12 @@
 from Screen import Screen
 from Components.Button import Button
 from Components.ServiceList import ServiceList
 from Screen import Screen
 from Components.Button import Button
 from Components.ServiceList import ServiceList
-from Components.ActionMap import ActionMap
+from Components.ActionMap import NumberActionMap
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer
 from Components.config import config, configElement, ConfigSubsection, configText
 from Screens.FixedMenu import FixedMenu
 from EpgSelection import EPGSelection
 from enigma import eServiceReference, eEPGCache, eEPGCachePtr, eServiceCenter, eServiceCenterPtr, iMutableServiceListPtr, iStaticServiceInformationPtr, eTimer
 from Components.config import config, configElement, ConfigSubsection, configText
 from Screens.FixedMenu import FixedMenu
+from Tools.NumericalTextInput import NumericalTextInput
 
 import xml.dom.minidom
 
 
 import xml.dom.minidom
 
@@ -213,14 +214,20 @@ class ChannelSelectionBase(Screen):
                #self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet')
 
                self["key_red"] = Button("All")
                #self.bouquet_root = eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet')
 
                self["key_red"] = Button("All")
-               self["key_green"] = Button("Provider")
-               self["key_yellow"] = Button("Satellite")
+               #self["key_green"] = Button("Provider")
+               #self["key_yellow"] = Button("Satellite")
+               self["key_green"] = Button("")
+               self["key_yellow"] = Button("")
                self["key_blue"] = Button("Favourites")
 
                self["list"] = ServiceList()
                self.servicelist = self["list"]
 
                #self["okbutton"] = Button("ok", [self.channelSelected])
                self["key_blue"] = Button("Favourites")
 
                self["list"] = ServiceList()
                self.servicelist = self["list"]
 
                #self["okbutton"] = Button("ok", [self.channelSelected])
+               
+               self.numericalTextInput = NumericalTextInput()
+               
+               self.lastService = None
 
                self.lastServiceTimer = eTimer()
                self.lastServiceTimer.timeout.get().append(self.lastService)
 
                self.lastServiceTimer = eTimer()
                self.lastServiceTimer.timeout.get().append(self.lastService)
@@ -268,6 +275,11 @@ class ChannelSelectionBase(Screen):
        def showFavourites(self):
                self.setRoot(self.bouquet_root)
 
        def showFavourites(self):
                self.setRoot(self.bouquet_root)
 
+       def keyNumberGlobal(self, number):
+               print "You pressed number " + str(number)
+               print "You would go to character " + str(self.numericalTextInput.getKey(number))
+               # TODO let the servicelist jump to the next entry strating with the chosen character
+
        def enterBouquet(self, action):
                if action[:7] == "bouquet":
                        if action.find("FROM BOUQUET") != -1:
        def enterBouquet(self, action):
                if action[:7] == "bouquet":
                        if action.find("FROM BOUQUET") != -1:
@@ -302,12 +314,12 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit):
                if config.tv.lastroot.value == "":
                        self.servicelist.setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(type == 1)"""))
 
                if config.tv.lastroot.value == "":
                        self.servicelist.setRoot(eServiceReference("""1:0:1:0:0:0:0:0:0:0:(type == 1)"""))
 
-               class ChannelActionMap(ActionMap):
+               class ChannelActionMap(NumberActionMap):
                        def action(self, contexts, action):
                                if not self.csel.enterBouquet(action):
                                        if action == "cancel":
                                                self.csel.handleEditCancel()
                        def action(self, contexts, action):
                                if not self.csel.enterBouquet(action):
                                        if action == "cancel":
                                                self.csel.handleEditCancel()
-                                       ActionMap.action(self, contexts, action)
+                                       NumberActionMap.action(self, contexts, action)
                self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions", "ContextMenuActions"],
                        {
                                "cancel": self.cancel,
                self["actions"] = ChannelActionMap(["ChannelSelectActions", "OkCancelActions", "ContextMenuActions"],
                        {
                                "cancel": self.cancel,
@@ -315,7 +327,17 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit):
                                "mark": self.doMark,
                                "contextMenu": self.doContext,
                                "showFavourites": self.showFavourites,
                                "mark": self.doMark,
                                "contextMenu": self.doContext,
                                "showFavourites": self.showFavourites,
-                               "showEPGList": self.showEPGList
+                               "showEPGList": self.showEPGList,
+                               "1": self.keyNumberGlobal,
+                               "2": self.keyNumberGlobal,
+                               "3": self.keyNumberGlobal,
+                               "4": self.keyNumberGlobal,
+                               "5": self.keyNumberGlobal,
+                               "6": self.keyNumberGlobal,
+                               "7": self.keyNumberGlobal,
+                               "8": self.keyNumberGlobal,
+                               "9": self.keyNumberGlobal,
+                               "0": self.keyNumberGlobal
                        })
                self["actions"].csel = self
 
                        })
                self["actions"].csel = self
 
@@ -383,6 +405,16 @@ class SimpleChannelSelection(ChannelSelectionBase):
                                "cancel": self.cancel,
                                "ok": self.channelSelected,
                                "showFavourites": self.showFavourites,
                                "cancel": self.cancel,
                                "ok": self.channelSelected,
                                "showFavourites": self.showFavourites,
+                               "1": self.keyNumberGlobal,
+                               "2": self.keyNumberGlobal,
+                               "3": self.keyNumberGlobal,
+                               "4": self.keyNumberGlobal,
+                               "5": self.keyNumberGlobal,
+                               "6": self.keyNumberGlobal,
+                               "7": self.keyNumberGlobal,
+                               "8": self.keyNumberGlobal,
+                               "9": self.keyNumberGlobal,
+                               "0": self.keyNumberGlobal
                        })
                self["actions"].csel = self
 
                        })
                self["actions"].csel = self