diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-11-18 02:53:40 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-11-18 02:53:40 +0000 |
| commit | bf7e40884d7add91e219e9e70e83988ae7752bd8 (patch) | |
| tree | 3e1048ad0c2b1e32a5c7b3b24dbcb59cf1a7045a /lib/python/Screens | |
| parent | 81b381e1f5dd38ad1b80a3b3d96060b89a5fab6c (diff) | |
| download | enigma2-bf7e40884d7add91e219e9e70e83988ae7752bd8.tar.gz enigma2-bf7e40884d7add91e219e9e70e83988ae7752bd8.zip | |
add help stuff
Diffstat (limited to 'lib/python/Screens')
| -rw-r--r-- | lib/python/Screens/HelpMenu.py | 30 | ||||
| -rw-r--r-- | lib/python/Screens/InfoBar.py | 16 | ||||
| -rw-r--r-- | lib/python/Screens/InfoBarGenerics.py | 12 | ||||
| -rw-r--r-- | lib/python/Screens/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Screens/Screen.py | 6 | ||||
| -rw-r--r-- | lib/python/Screens/__init__.py | 2 |
6 files changed, 55 insertions, 13 deletions
diff --git a/lib/python/Screens/HelpMenu.py b/lib/python/Screens/HelpMenu.py new file mode 100644 index 00000000..4e1d1c49 --- /dev/null +++ b/lib/python/Screens/HelpMenu.py @@ -0,0 +1,30 @@ +from Screen import Screen + +from Components.ActionMap import ActionMap +from Components.HelpMenuList import HelpMenuList + +class HelpMenu(Screen): + def __init__(self, session, list): + Screen.__init__(self, session) + + self["list"] = HelpMenuList(list, self.close) + self["actions"] = ActionMap(["OkCancelActions"], + { + "cancel": self.close, + "ok": self["list"].ok, + }) + +class HelpableScreen: + def __init__(self): + self["helpActions"] = ActionMap( [ "HelpActions" ], + { + "displayHelp": self.showHelp, + }) + + def showHelp(self): + self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList) + + def callHelpAction(self, *args): + if len(args): + (actionmap, context, action) = args + actionmap.action(context, action) diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 90594241..49e2cb5a 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -12,13 +12,16 @@ from Screens.InfoBarGenerics import InfoBarVolumeControl, InfoBarShowHide, \ InfoBarEPG, InfoBarEvent, InfoBarServiceName, InfoBarPVR, InfoBarInstantRecord, \ InfoBarAudioSelection +from Screens.HelpMenu import HelpableScreen, HelpMenu + from enigma import * import time class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection): + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection, + HelpableScreen): def __init__(self, session): Screen.__init__(self, session) @@ -28,16 +31,19 @@ class InfoBar(Screen, InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ "showMovies": self.showMovies, }) - for x in InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ - InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ - InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection: + for x in HelpableScreen, \ + InfoBarVolumeControl, InfoBarShowHide, InfoBarPowerKey, \ + InfoBarNumberZap, InfoBarChannelSelection, InfoBarMenu, InfoBarEPG, \ + InfoBarEvent, InfoBarServiceName, InfoBarInstantRecord, InfoBarAudioSelection: x.__init__(self) + self.helpList.append((self["actions"], "InfobarActions", [("showMovies", "Watch a Movie...")])) + self["CurrentTime"] = Clock() def showMovies(self): self.session.openWithCallback(self.movieSelected, MovieSelection) - + def movieSelected(self, service): if service is not None: self.session.open(MoviePlayer, service) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index d9c42bdb..45c7745e 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1,5 +1,5 @@ from Screen import Screen -from Components.ActionMap import ActionMap +from Components.ActionMap import ActionMap, HelpableActionMap from Components.ActionMap import NumberActionMap from Components.Label import Label from Components.config import configfile, configsequencearg @@ -235,12 +235,12 @@ class InfoBarChannelSelection: #instantiate forever self.servicelist = self.session.instantiateDialog(ChannelSelection) - self["ChannelSelectActions"] = ActionMap( ["InfobarChannelSelection"], + self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection", { "switchChannelUp": self.switchChannelUp, "switchChannelDown": self.switchChannelDown, - "zapUp": self.zapUp, - "zapDown": self.zapDown, + "zapUp": (self.zapUp, _("next channel")), + "zapDown": (self.zapDown, _("previous channel")), }) def switchChannelUp(self): @@ -276,9 +276,9 @@ class InfoBarMenu: class InfoBarEPG: """ EPG - Opens an EPG list when the showEPGList action fires """ def __init__(self): - self["EPGActions"] = ActionMap( [ "InfobarEPGActions" ], + self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { - "showEPGList": self.showEPGList, + "showEPGList": (self.showEPGList, _("show EPG...")), }) def showEPGList(self): diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index d722f05d..ca6e5d15 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -6,4 +6,4 @@ install_PYTHON = \ MovieSelection.py Setup.py About.py HarddiskSetup.py FixedMenu.py \ Satconfig.py ScanSetup.py NetworkSetup.py Ci.py TimerEntry.py Volume.py \ EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \ - AudioSelection.py InfoBarGenerics.py __init__.py + AudioSelection.py InfoBarGenerics.py HelpMenu.py __init__.py diff --git a/lib/python/Screens/Screen.py b/lib/python/Screens/Screen.py index a95c7655..e9f9affd 100644 --- a/lib/python/Screens/Screen.py +++ b/lib/python/Screens/Screen.py @@ -11,6 +11,10 @@ class Screen(dict, HTMLSkin, GUISkin): self.session = session GUISkin.__init__(self) + # in order to support screens *without* a help, + # we need the list in every screen. how ironic. + self.helpList = [ ] + def execBegin(self): # assert self.session == None, "a screen can only exec one per time" # self.session = session @@ -25,6 +29,8 @@ class Screen(dict, HTMLSkin, GUISkin): # never call this directly - it will be called from the session! def doClose(self): + # fixup circular references + del self.helpList GUISkin.close(self) del self.session diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py index ca1e0b03..157dee5d 100644 --- a/lib/python/Screens/__init__.py +++ b/lib/python/Screens/__init__.py @@ -4,4 +4,4 @@ __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu", "TimerEdit", "Setup", "HarddiskSetup", "FixedMenu", "Satconfig", "Scanconfig", "Ci.py", "Volume.py", "Mute.py", "EpgSelection", "EventView", "Standby", "ServiceInfo", - "AudioSelection", "InfoBarGenerics"] + "AudioSelection", "InfoBarGenerics", "HelpMenu"] |
