fix arrow movement, do not crash on exit
[vuplus_dvbapp] / 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                 
22                 self["rc"] = Pixmap()
23                 self["arrowup"] = MovingPixmap()
24
25                 self["actions"] = ActionMap(["WizardActions"], 
26                 {
27                         "ok": self["list"].ok,
28                         "back": self.close,
29                         "up": self.up,
30                         "down": self.down
31                 }, -1)
32         
33         def up(self):
34                 self["list"].instance.moveSelection(self["list"].instance.moveUp)
35                 self.SelectionChanged()
36                 
37         def down(self):
38                 self["list"].instance.moveSelection(self["list"].instance.moveDown)
39                 self.SelectionChanged()
40                 
41         def SelectionChanged(self):
42                 selection = self["list"].getCurrent()[3]
43                 if selection is None:
44                         self["arrowup"].instance.hide()
45                 else:
46                         self["arrowup"].moveTo(selection[1], selection[2], 1)
47                         self["arrowup"].startMoving()
48                         self["arrowup"].instance.show()
49
50 class HelpableScreen:
51         def __init__(self):
52                 self["helpActions"] = ActionMap( [ "HelpActions" ],
53                         {
54                                 "displayHelp": self.showHelp,
55                         })
56         def showHelp(self):
57                 self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
58         def callHelpAction(self, *args):
59                 if len(args):
60                         (actionmap, context, action) = args
61                         actionmap.action(context, action)