SoftwareManager/plugin.py, Screens/PluginBrowser.py: -reactivate packetmanager in...
[enigma2.git] / lib / python / Screens / HelpMenu.py
1 from Screen import Screen
2 from Components.Pixmap import Pixmap, MovingPixmap
3 from Components.Label import Label
4 from Components.ActionMap import ActionMap
5 from Components.HelpMenuList import HelpMenuList
6 from Screens.Rc import Rc
7
8 class HelpMenu(Screen, Rc):
9         def __init__(self, session, list):
10                 Screen.__init__(self, session)
11                 self.onSelChanged = [ ]
12                 self["list"] = HelpMenuList(list, self.close)
13                 self["list"].onSelChanged.append(self.SelectionChanged)
14                 Rc.__init__(self)
15                 self["long_key"] = Label("")
16
17                 self["actions"] = ActionMap(["WizardActions"], 
18                 {
19                         "ok": self["list"].ok,
20                         "back": self.close,
21                 }, -1)
22
23                 self.onLayoutFinish.append(self.SelectionChanged)
24
25         def SelectionChanged(self):
26                 self.clearSelectedKeys()
27                 selection = self["list"].getCurrent()
28                 if selection:
29                         selection = selection[3]
30                 #arrow = self["arrowup"]
31                 print "selection:", selection
32
33                 longText = ""
34                 if selection and len(selection) > 1:
35                         if selection[1] == "SHIFT":
36                                 self.selectKey("SHIFT")
37                         elif selection[1] == "long":
38                                 longText = _("Long Keypress")
39                 self["long_key"].setText(longText)
40
41                 self.selectKey(selection[0])
42                 #if selection is None:
43                 print "select arrow"
44                 #       arrow.moveTo(selection[1], selection[2], 1)
45                 #       arrow.startMoving()
46                 #       arrow.show()
47
48 class HelpableScreen:
49         def __init__(self):
50                 self["helpActions"] = ActionMap( [ "HelpActions" ],
51                         {
52                                 "displayHelp": self.showHelp,
53                         })
54
55         def showHelp(self):
56                 self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList)
57
58         def callHelpAction(self, *args):
59                 if args:
60                         (actionmap, context, action) = args
61                         actionmap.action(context, action)