use NumericalTextInput to jump to entries in ChannelSelection (jumping needs to imple...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 29 Nov 2005 00:11:06 +0000 (00:11 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 29 Nov 2005 00:11:06 +0000 (00:11 +0000)
data/keymap.xml
lib/python/Screens/ChannelSelection.py
lib/python/Tools/NumericalTextInput.py

index 5a7c66965df02927035d51bd0dac7fc0d0e3789e..b909e09a7a3927d4d22652d7d3004eaeb8e3ba83 100644 (file)
                <!--<key id="KEY_BLUE" mapto="bouquet:(type == 1) FROM BOUQUET &quot;bouquets.tv&quot; ORDER BY bouquet" flags="m" />-->
                <key id="KEY_BLUE" mapto="showFavourites" flags="m" />
                <key id="KEY_INFO" mapto="showEPGList" flags="m" />
+               
+               <key id="KEY_1" mapto="1" flags="m" />
+               <key id="KEY_2" mapto="2" flags="m" />
+               <key id="KEY_3" mapto="3" flags="m" />
+               <key id="KEY_4" mapto="4" flags="m" />
+               <key id="KEY_5" mapto="5" flags="m" />
+               <key id="KEY_6" mapto="6" flags="m" />
+               <key id="KEY_7" mapto="7" flags="m" />
+               <key id="KEY_8" mapto="8" flags="m" />
+               <key id="KEY_9" mapto="9" flags="m" />
+               <key id="KEY_0" mapto="0" flags="m" />
        </map>
 
        <map context="EPGSelectActions">
index 0534a78d79e2ed0ed4a14abc1b09191df0ef3b8c..d3bf1b40ed92094ab2540fd1e75bc6a747968a8d 100644 (file)
@@ -1,11 +1,12 @@
 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 Tools.NumericalTextInput import NumericalTextInput
 
 import xml.dom.minidom
 
@@ -224,6 +225,8 @@ class ChannelSelectionBase(Screen):
 
                #self["okbutton"] = Button("ok", [self.channelSelected])
                
+               self.numericalTextInput = NumericalTextInput()
+               
                self.lastService = None
 
                self.lastServiceTimer = eTimer()
@@ -272,6 +275,11 @@ class ChannelSelectionBase(Screen):
        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))
+               pass
+
        def enterBouquet(self, action):
                if action[:7] == "bouquet":
                        if action.find("FROM BOUQUET") != -1:
@@ -306,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)"""))
 
-               class ChannelActionMap(ActionMap):
+               class ChannelActionMap(NumberActionMap):
                        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,
@@ -319,7 +327,17 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit):
                                "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
 
@@ -387,6 +405,16 @@ class SimpleChannelSelection(ChannelSelectionBase):
                                "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
 
index 79c330107bed9cb4f0f980fb5cd0db5617439451..744978953ca738efa51c7081f938637eacccdde1 100644 (file)
@@ -13,7 +13,7 @@ class NumericalTextInput:
     mapping.append ("tuv8TUV") # 8
     mapping.append ("wxyz9WXYZ") # 9
                                 
-    def __init__(self, nextFunction):
+    def __init__(self, nextFunction = None):
         self.nextFunction = nextFunction
         self.Timer = eTimer()
         self.Timer.timeout.get().append(self.nextChar)
@@ -40,5 +40,6 @@ class NumericalTextInput:
         self.Timer.stop()
         print "Timer done"
         self.nextKey()
-        self.nextFunction()
+        if (self.nextFunction != None):
+               self.nextFunction()
         
\ No newline at end of file