generic show/hide support for GUIComponents
[enigma2.git] / lib / python / Screens / HelpMenu.py
1 from Screen import Screen
2
3 from Components.Pixmap import *
4 from Components.Pixmap import Pixmap
5 from Components.Pixmap import MovingPixmap
6 from Components.Label import Label
7 from Components.Slider import Slider
8 from Components.ActionMap import ActionMap
9 from Components.HelpMenuList import HelpMenuList
10 import string
11 from xml.sax import make_parser
12 from xml.sax.handler import ContentHandler
13 from Components.MenuList import MenuList
14
15 class HelpMenu(Screen):
16         def __init__(self, session, list):
17                 Screen.__init__(self, session)
18                 self.onSelChanged = [ ]
19                 
20                 self["list"] = HelpMenuList(list, self.close)
21                 self["list"].onSelChanged.append(self.SelectionChanged)
22                 
23                 self["rc"] = Pixmap()
24                 self["arrowup"] = MovingPixmap()
25
26                 self["actions"] = ActionMap(["WizardActions"], 
27                 {
28                         "ok": self["list"].ok,
29                         "back": self.close,
30                 }, -1)
31                 
32         def SelectionChanged(self):
33                 selection = self["list"].getCurrent()[3]
34                 arrow = self["arrowup"]
35
36                 if selection is None:
37                         arrow.hide()
38                 else:
39                         arrow.moveTo(selection[1], selection[2], 1)
40                         arrow.startMoving()
41                         arrow.show()
42
43 class HelpableScreen:
44         def __init__(self):
45                 self["helpActions"] = ActionMap( [ "HelpActions" ],
46                         {
47                                 "displayHelp": self.showHelp,
48                         })
49
50         def showHelp(self):
51                 self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
52
53         def callHelpAction(self, *args):
54                 if len(args):
55                         (actionmap, context, action) = args
56                         actionmap.action(context, action)