new help
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 15 Feb 2006 01:17:14 +0000 (01:17 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 15 Feb 2006 01:17:14 +0000 (01:17 +0000)
data/skin.xml
lib/python/Components/HelpMenuList.py
lib/python/Screens/HelpMenu.py
lib/python/Tools/KeyBindings.py

index 2726276..6a60764 100644 (file)
@@ -3,13 +3,13 @@
                        <color name="white"     value="#ffffff" />
                        <color name="black"     value="#000000" />
                        <color name="dark"      value="#20294a6b" />
                        <color name="white"     value="#ffffff" />
                        <color name="black"     value="#000000" />
                        <color name="dark"      value="#20294a6b" />
-                       
+
                        <color name="red"               value="#ff0000" />
                        <color name="green"     value="#00ff00" />
                        <color name="blue"              value="#0000ff" />
                        <color name="yellow"    value="#c0c000" />
                        <color name="transparent"       value="#ffffffff" />
                        <color name="red"               value="#ff0000" />
                        <color name="green"     value="#00ff00" />
                        <color name="blue"              value="#0000ff" />
                        <color name="yellow"    value="#c0c000" />
                        <color name="transparent"       value="#ffffffff" />
-                       
+
                        <color name="transpBlack" value="#80000000" />
                </colors>
                <windowstyle type="skinned">
                        <color name="transpBlack" value="#80000000" />
                </colors>
                <windowstyle type="skinned">
@@ -21,7 +21,6 @@
                        <color name="ListboxSelectedForeground" color="#ffffff" />
                        <color name="ListboxMarkedBackground" color="#ff0000" />
                        <color name="ListboxMarkedForeground" color="#ffffff" />
                        <color name="ListboxSelectedForeground" color="#ffffff" />
                        <color name="ListboxMarkedBackground" color="#ff0000" />
                        <color name="ListboxMarkedForeground" color="#ffffff" />
-                       
                        <color name="WindowTitleForeground" color="#ffffff" />
                        <color name="WindowTitleBackground" color="#33294a6b" />
                        <borderset name="bsWindow">
                        <color name="WindowTitleForeground" color="#ffffff" />
                        <color name="WindowTitleBackground" color="#33294a6b" />
                        <borderset name="bsWindow">
                        <widget name="apply" position="10,240" size="250,35" />
                </screen>
                <screen name="HelpMenu" flags="wfNoBorder" position="0,0" size="720,576" title="Menu">
                        <widget name="apply" position="10,240" size="250,35" />
                </screen>
                <screen name="HelpMenu" flags="wfNoBorder" position="0,0" size="720,576" title="Menu">
-                       <widget name="list" position="100,100" size="550,375" scrollbarMode="showOnDemand" />
-                       <eLabel position="500,40" size="220,60" text="help..." font="Regular;50" />
+                       <widget name="list" position="50,100" size="450,375" scrollbarMode="showOnDemand" />
+                       <widget name="rc" pixmap="/usr/share/enigma2/rc.png" position="540,50" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
+                       <widget name="arrowup" pixmap="/usr/share/enigma2/arrowup.png" position="585,425" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
+                       <eLabel position="400,40" size="220,60" text="help..." font="Regular;50" />
                </screen>
                <screen name="PVRState" flags="wfNoBorder" position="70,70" size="150,30" backgroundColor="transpBlack" zPosition="2">
                        <widget name="state" position="0,0" size="150,30" font="Regular;25" halign="center" 
                </screen>
                <screen name="PVRState" flags="wfNoBorder" position="70,70" size="150,30" backgroundColor="transpBlack" zPosition="2">
                        <widget name="state" position="0,0" size="150,30" font="Regular;25" halign="center" 
@@ -369,7 +370,7 @@ if (280 > wsizex):
 wsize = (wsizex, wsizey)
 
 
 wsize = (wsizex, wsizey)
 
 
-# resize 
+# resize
 self.instance.resize(eSize(*wsize))
 
 # resize label
 self.instance.resize(eSize(*wsize))
 
 # resize label
index 521496b..c8ff379 100644 (file)
@@ -3,13 +3,14 @@ from GUIComponent import *
 from enigma import eListboxPythonMultiContent, eListbox, gFont
 
 from Tools.KeyBindings import queryKeyBinding, getKeyDescription
 from enigma import eListboxPythonMultiContent, eListbox, gFont
 
 from Tools.KeyBindings import queryKeyBinding, getKeyDescription
+#getKeyPositions
 
 # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ]
 
 class HelpMenuList(GUIComponent):
        def __init__(self, list, callback):
                GUIComponent.__init__(self)
 
 # [ ( actionmap, context, [(action, help), (action, help), ...] ), (actionmap, ... ), ... ]
 
 class HelpMenuList(GUIComponent):
        def __init__(self, list, callback):
                GUIComponent.__init__(self)
-               
+               self.onSelChanged = [ ]
                self.l = eListboxPythonMultiContent()
                self.callback = callback
                
                self.l = eListboxPythonMultiContent()
                self.callback = callback
                
@@ -18,48 +19,46 @@ class HelpMenuList(GUIComponent):
                        for (action, help) in actions:
                                entry = [ ]
                                
                        for (action, help) in actions:
                                entry = [ ]
                                
-                               entry.append( (actionmap, context, action) )
                                buttons = queryKeyBinding(context, action)
                                buttons = queryKeyBinding(context, action)
-                               buttonstring = ""
-       
-                               first = True
+
+                               name = None
+                               
                                for n in buttons:
                                        name = getKeyDescription(n)
                                for n in buttons:
                                        name = getKeyDescription(n)
-                                       if name is None:
-                                               continue
-
-                                       if not first:
-                                               buttonstring += ", or "
-
-                                       first = False
-                                       buttonstring += name
+                                       if name is not None:
+                                               break
 
 
-                               if not first:
-                                       buttonstring = "You can also press " + buttonstring + "."
-
-                               entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 550, 36, 0, 0, help) )
-                               entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 40, 550, 20, 1, 0, buttonstring) )
+                               entry.append( (actionmap, context, action, name ) )
+                               entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) )
                                
                                l.append(entry)
                
                self.l.setList(l)
                
                                
                                l.append(entry)
                
                self.l.setList(l)
                
-               self.l.setFont(0, gFont("Regular", 36))
-               self.l.setFont(1, gFont("Regular", 18))
+               self.l.setFont(0, gFont("Regular", 26))
        
        
+       def ok(self):
+               # a list entry has a "private" tuple as first entry...
+               l = self.l.getCurrentSelection()[0]
+               
+               # ...containing (Actionmap, Context, Action, keydata).
+               # we returns this tuple to the callback.
+               self.callback(l[0], l[1], l[2])
+       
+       def getCurrent(self):
+               return self.l.getCurrentSelection()[0]
+
        def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
        def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
-               self.instance.setItemHeight(75)
-       
+               self.instance.setItemHeight(42)
+               self.instance.selectionChanged.get().append(self.selectionChanged)
+               
        def GUIdelete(self):
                self.instance.setContent(None)
        def GUIdelete(self):
                self.instance.setContent(None)
+               self.instance.selectionChanged.get().remove(self.selectionChanged)
                self.instance = None
 
                self.instance = None
 
-       def ok(self):
-               # a list entry has a "private" tuple as first entry...
-               l = self.l.getCurrentSelection()[0]
-               
-               # ...containing (Actionmap, Context, Action).
-               # we returns this tuple to the callback.
-               self.callback(l[0], l[1], l[2])
+       def selectionChanged(self):
+               for x in self.onSelChanged:
+                       x()
index 4e1d1c4..e947ac9 100644 (file)
@@ -1,18 +1,42 @@
 from Screen import Screen
 
 from Screen import Screen
 
+from Components.Pixmap import *
+from Components.Pixmap import Pixmap
+from Components.Pixmap import MovingPixmap
+from Components.Label import Label
+from Components.Slider import Slider
 from Components.ActionMap import ActionMap
 from Components.HelpMenuList import HelpMenuList
 from Components.ActionMap import ActionMap
 from Components.HelpMenuList import HelpMenuList
+import string
+from xml.sax import make_parser
+from xml.sax.handler import ContentHandler
+from Components.MenuList import MenuList
 
 class HelpMenu(Screen):
        def __init__(self, session, list):
                Screen.__init__(self, session)
 
 class HelpMenu(Screen):
        def __init__(self, session, list):
                Screen.__init__(self, session)
+               self.onSelChanged = [ ]
                
                self["list"] = HelpMenuList(list, self.close)
                
                self["list"] = HelpMenuList(list, self.close)
-               self["actions"] = ActionMap(["OkCancelActions"],
-                       {
-                               "cancel": self.close,
-                               "ok": self["list"].ok,
-                       })
+               self["list"].onSelChanged.append(self.SelectionChanged)
+               
+               self["rc"] = Pixmap()
+               self["arrowup"] = MovingPixmap()
+
+               self["actions"] = ActionMap(["WizardActions"], 
+               {
+                       "ok": self["list"].ok,
+                       "back": self.close,
+               }, -1)
+               
+       def SelectionChanged(self):
+               selection = self["list"].getCurrent()[3]
+               if selection is None:
+                       self["arrowup"].instance.hide()
+               else:
+                       self["arrowup"].moveTo(selection[1], selection[2], 1)
+                       self["arrowup"].startMoving()
+                       self["arrowup"].instance.show()
 
 class HelpableScreen:
        def __init__(self):
 
 class HelpableScreen:
        def __init__(self):
@@ -20,10 +44,8 @@ class HelpableScreen:
                        {
                                "displayHelp": self.showHelp,
                        })
                        {
                                "displayHelp": self.showHelp,
                        })
-
        def showHelp(self):
                self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
        def showHelp(self):
                self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
-
        def callHelpAction(self, *args):
                if len(args):
                        (actionmap, context, action) = args
        def callHelpAction(self, *args):
                if len(args):
                        (actionmap, context, action) = args
index e758213..e093252 100644 (file)
@@ -4,16 +4,23 @@ keyBindings = { }
 from keyids import KEYIDS
 
 keyDescriptions = {
 from keyids import KEYIDS
 
 keyDescriptions = {
-               KEYIDS["KEY_RED"]: "red",
-               KEYIDS["KEY_BLUE"]: "blue",
-               KEYIDS["KEY_GREEN"]: "green",
-               KEYIDS["KEY_MENU"]: "menu",
-               KEYIDS["KEY_LEFT"]: "left",
-               KEYIDS["KEY_RIGHT"]: "right",
-               KEYIDS["KEY_VIDEO"]: "video",
-               KEYIDS["KEY_INFO"]: "info",
-               KEYIDS["KEY_AUDIO"]: "audio",
-               KEYIDS["KEY_RADIO"]: "radio"
+               KEYIDS["BTN_0"]: ("fp_up", 630, 320),
+               KEYIDS["BTN_1"]: ("fp_down", 565, 320),
+               KEYIDS["KEY_UP"]: ("up", 630, 320),
+               KEYIDS["KEY_DOWN"]: ("down", 565, 320),
+               KEYIDS["KEY_POWER"]: ("power", 615, 80),
+               KEYIDS["KEY_RED"]: ("red", 555, 390),
+               KEYIDS["KEY_BLUE"]: ("blue", 640, 390),
+               KEYIDS["KEY_GREEN"]: ("green", 585, 390),
+               KEYIDS["KEY_YELLOW"]: ("yellow", 610, 390),
+               KEYIDS["KEY_MENU"]: ("menu", 645, 290),
+               KEYIDS["KEY_LEFT"]: ("left", 565, 320),
+               KEYIDS["KEY_RIGHT"]: ("right", 630, 320),
+               KEYIDS["KEY_VIDEO"]: ("video", 645, 355),
+               KEYIDS["KEY_INFO"]: ("info", 550, 290),
+               KEYIDS["KEY_AUDIO"]: ("audio", 555, 355),
+               KEYIDS["KEY_TV"]: ("tv", 560, 425),
+               KEYIDS["KEY_RADIO"]: ("radio", 585, 425)
        }
 
 def addKeyBinding(key, context, action):
        }
 
 def addKeyBinding(key, context, action):
@@ -30,5 +37,4 @@ def queryKeyBinding(context, action):
 
 def getKeyDescription(key):
        if key in keyDescriptions:
 
 def getKeyDescription(key):
        if key in keyDescriptions:
-               return keyDescriptions[key]
-       return "key_%0x" % key
+               return keyDescriptions.get(key, [ ])