Skip to content

Commit

Permalink
Enable Helpscreen in ChannelSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlesat committed Dec 22, 2024
1 parent 598345f commit 69ba034
Showing 1 changed file with 83 additions and 50 deletions.
133 changes: 83 additions & 50 deletions lib/python/Screens/ChannelSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from Tools.Profile import profile

from Screens.Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Screens.Setup import Setup
import Screens.InfoBar
from Screens.ScreenSaver import InfoBarScreenSaver
Expand All @@ -11,7 +12,7 @@
from Components.Sources.Boolean import Boolean
from Components.Pixmap import Pixmap
from Components.ServiceList import ServiceList, refreshServiceList
from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap, HelpableNumberActionMap
from Components.MenuList import MenuList
from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
profile("ChannelSelection.py 1")
Expand All @@ -36,7 +37,7 @@
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Screens.MessageBox import MessageBox
from Screens.ServiceInfo import ServiceInfo
from Screens.Hotkey import InfoBarHotkey, hotkeyActionMap, hotkey
from Screens.Hotkey import InfoBarHotkey, helpableHotkeyActionMap, hotkey, getHotkeyFunctions
profile("ChannelSelection.py 4")
from Screens.PictureInPicture import PictureInPicture
from Screens.RdsDisplay import RassInteractive
Expand Down Expand Up @@ -814,11 +815,13 @@ def updateEventInfo(self):

class ChannelSelectionEPG(InfoBarHotkey):
def __init__(self):
if not hotkey.functions:
getHotkeyFunctions()
self.hotkeys = [("Info (EPG)", "info", "Infobar/openEventView"),
("Info (EPG)" + " " + _("long"), "info_long", "Infobar/showEventInfoPlugins"),
("EPG/Guide", "epg", "Plugins/Extensions/GraphMultiEPG/1"),
("EPG/Guide" + " " + _("long"), "epg_long", "Infobar/showEventInfoPlugins")]
self["ChannelSelectEPGActions"] = hotkeyActionMap(["ChannelSelectEPGActions"], dict((x[1], self.hotkeyGlobal) for x in self.hotkeys))
self["ChannelSelectEPGActions"] = helpableHotkeyActionMap(self, ["ChannelSelectEPGActions"], dict((x[1], (self.hotkeyGlobal, self.getHelpText(x[1]))) for x in self.hotkeys))
self.eventViewEPG = self.start_bouquet = self.epg_bouquet = None
self.currentSavedPath = []

Expand Down Expand Up @@ -1003,9 +1006,9 @@ def __init__(self):
self.editMode = False
self.confirmRemove = True

class ChannelSelectionEditActionMap(ActionMap):
def __init__(self, csel, contexts=[], actions={}, prio=0):
ActionMap.__init__(self, contexts, actions, prio)
class ChannelSelectionEditActionMap(HelpableActionMap):
def __init__(self, csel, *args, **kwargs):
HelpableActionMap.__init__(self, csel, *args, **kwargs)
self.csel = csel

def action(self, contexts, action):
Expand All @@ -1015,11 +1018,11 @@ def action(self, contexts, action):
elif action == "ok":
return 0 # fall-trough
else:
return ActionMap.action(self, contexts, action)
return HelpableActionMap.action(self, contexts, action)

self["ChannelSelectEditActions"] = ChannelSelectionEditActionMap(self, ["ChannelSelectEditActions", "OkCancelActions"],
{
"contextMenu": self.doContext,
"contextMenu": (self.doContext, _("Context Menu")),
})

def getMutableList(self, root=eServiceReference()):
Expand Down Expand Up @@ -1432,9 +1435,10 @@ def exitContext(self, close=False):
service_types_radio = '1:7:2:0:0:0:0:0:0:0:(type == 2) || (type == 10)'


class ChannelSelectionBase(Screen):
class ChannelSelectionBase(Screen, HelpableScreen):
def __init__(self, session):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
self["key_red"] = Button(_("All"))
self["key_green"] = Button(_("Satellites"))
self["key_yellow"] = Button(_("Provider"))
Expand Down Expand Up @@ -1466,38 +1470,67 @@ def __init__(self, session):
self.movemode = False
self.showSatDetails = False

self["ChannelSelectBaseActions"] = NumberActionMap(["ChannelSelectBaseActions", "NumberActions", "InputAsciiActions"],
self["ChannelSelectBaseActions"] = HelpableNumberActionMap(self, ["ChannelSelectBaseActions", "NumberActions", "InputAsciiActions"],
{
"showFavourites": self.showFavourites,
"showAllServices": self.showAllServices,
"showProviders": self.showProviders,
"showSatellites": boundFunction(self.showSatellites, changeMode=True),
"nextBouquet": self.nextBouquet,
"prevBouquet": self.prevBouquet,
"nextMarker": self.nextMarker,
"prevMarker": self.prevMarker,
"showFavourites": (self.showFavourites, _("Show Favorites")),
"showAllServices": (self.showAllServices, _("Show All Services")),
"showProviders": (self.showProviders, _("Show Providers")),
"showSatellites": (boundFunction(self.showSatellites, changeMode=True), _("Show Satellites")),
"nextBouquet": (self.nextBouquet, lambda: self._helpPrevNextBouquet(prev=False)),
"prevBouquet": (self.prevBouquet,lambda: self._helpPrevNextBouquet(prev=True)),
"nextMarker": (self.nextMarker, _("Jump to next marker")),
"prevMarker": (self.prevMarker, _("Jump to previous marker")),
"gotAsciiCode": self.keyAsciiCode,
"keyLeft": self.keyLeft,
"keyRight": self.keyRight,
"keyRecord": self.keyRecord,
"toggleTwoLines": self.toggleTwoLines,
"1": self.keyNumberGlobal,
"2": self.keyNumberGlobal,
"3": self.keyNumberGlobal,
"4": self.keyNumberGlobal,
"5": self.keyNumberGlobal,
"6": self.keyNumberGlobal,
"7": self.keyNumberGlobal,
"8": self.keyNumberGlobal,
"9": self.keyNumberGlobal,
"0": self.keyNumber0
"keyLeft": (self.keyLeft, lambda: self._helpKeyleftright(prev=False)),
"keyRight": (self.keyRight, lambda: self._helpKeyleftright(prev=True)),
"keyRecord": (self.keyRecord, _("Start instant recording")),
"toggleTwoLines": (self.toggleTwoLines, _("Change view mode")),
"1": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(1)),
"2": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(2)),
"3": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(3)),
"4": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(4)),
"5": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(5)),
"6": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(6)),
"7": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(7)),
"8": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(8)),
"9": (self.keyNumberGlobal, lambda: self._helpKeyNumberGlobal(9)),
"0": (self.keyNumber0, lambda: self._helpKeyNumberGlobal(0)),
}, -2)
self.maintitle = _("Channel selection")
self.modetitle = ""
self.servicetitle = ""
self.functiontitle = ""
self.recallBouquetMode()

def _helpPrevNextBouquet(self, prev):
if ("reverseB" in config.usage.servicelist_cursor_behavior.value) == prev:
return _("Move up in bouquet list")
else:
return _("Move down in bouquet list")

def _helpKeyleftright(self, prev):
if config.usage.oldstyle_channel_select_controls.value:
return _("Bouquet down") if prev else _("Bouquet up")
else:
return _("Page down") if prev else _("Page up")

def _helpKeyNumberGlobal(self, number):
editmode = {2: _("Rename"), 6: _("Toggle movemode"), 8: _("Remove")}.get(number, None)
if self.isBasePathEqual(self.bouquet_root):
if hasattr(self, "editMode") and self.editMode:
return editmode
else:
return _("Zap to channel number")
else:
current_root = self.getRoot()
if current_root and 'FROM BOUQUET "bouquets.' in current_root.getPath():
if hasattr(self, "editMode") and self.editMode:
return editmode
else:
return _("Zap to channel number")
else:
return _("Search in SMS mode")

def compileTitle(self):
self.setTitle("%s%s%s%s" % (self.maintitle, self.modetitle, self.functiontitle, self.servicetitle))

Expand Down Expand Up @@ -2036,13 +2069,13 @@ def __init__(self, session):
ChannelSelectionEPG.__init__(self)
SelectionEventInfo.__init__(self)

self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"],
self["actions"] = HelpableActionMap(self, ["OkCancelActions", "TvRadioActions"],
{
"cancel": self.cancel,
"ok": self.channelSelected,
"keyRadio": self.doRadioButton,
"keyTV": self.doTVButton,
"toggleTvRadio": self.toggleTVRadio,
"cancel": (self.cancel, _("Cancel")),
"ok": (self.channelSelected, _("Select service")),
"keyRadio": (self.doRadioButton, _("Radio mode")),
"keyTV": (self.doTVButton, _("TV mode")),
"toggleTvRadio": (self.toggleTVRadio, _("Toggle TV Radio mode")),
})

self.__event_tracker = ServiceEventTracker(screen=self, eventmap={
Expand Down Expand Up @@ -2569,13 +2602,13 @@ def __init__(self, session, infobar):

self.info = session.instantiateDialog(RadioInfoBar) # our simple infobar

self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"],
self["actions"] = HelpableActionMap(self, ["OkCancelActions", "TvRadioActions"],
{
"keyTV": self.cancel,
"keyRadio": self.cancel,
"cancel": self.cancel,
"ok": self.channelSelected,
"audio": self.audioSelection
"keyTV": (self.cancel, _("Cancel")),
"keyRadio": (self.cancel, _("Cancel")),
"cancel": (self.cancel, _("Cancel")),
"ok": (self.channelSelected, _("Select service")),
"audio": (self.audioSelection, _("Select Audio")),
})

self.__event_tracker = ServiceEventTracker(screen=self, eventmap={
Expand Down Expand Up @@ -2717,13 +2750,13 @@ class SimpleChannelSelection(ChannelSelectionBase, SelectionEventInfo):
def __init__(self, session, title, currentBouquet=False, returnBouquet=False, setService=None, setBouquet=None):
ChannelSelectionBase.__init__(self, session)
SelectionEventInfo.__init__(self)
self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"],
self["actions"] = HelpableActionMap(["OkCancelActions", "TvRadioActions"],
{
"cancel": self.close,
"ok": self.channelSelected,
"keyRadio": self.setModeRadio,
"keyTV": self.setModeTv,
"toggleTvRadio": self.toggleTVRadio,
"cancel": (self.close, _("Cancel")),
"ok": (self.channelSelected, _("Select service")),
"keyRadio": (self.setModeRadio, _("Radio mode")),
"keyTV": (self.setModeTv, _("TV mode")),
"toggleTvRadio": (self.toggleTVRadio, _("Toggle TV radio mode")),
})
self.bouquet_mark_edit = OFF
if isinstance(title, str):
Expand Down

0 comments on commit 69ba034

Please sign in to comment.