Skip to content

Commit

Permalink
[EventView] Allow display of plugin description if available in Event…
Browse files Browse the repository at this point in the history
…ViewContextMenu
  • Loading branch information
Huevos committed Jul 18, 2023
1 parent b467414 commit 9279016
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/python/Screens/EventView.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from Components.Sources.ServiceEvent import ServiceEvent
from Components.Sources.Event import Event
from RecordTimer import AFTEREVENT
from Components.Sources.StaticText import StaticText
from Screens.TimerEntry import TimerEntry, addTimerFromEvent
from Plugins.Plugin import PluginDescriptor
from Tools.BoundFunction import boundFunction
Expand All @@ -29,20 +30,29 @@ def __init__(self, session, menu):
Screen.__init__(self, session)
self.setTitle(_('Event view menu'))

self["description"] = StaticText()

self["actions"] = ActionMap(["OkCancelActions"],
{
"ok": self.okbuttonClick,
"cancel": self.cancelClick
})

self["menu"] = MenuList(menu)
if self.updateDescription not in self["menu"].onSelectionChanged:
self["menu"].onSelectionChanged.append(self.updateDescription)
self.updateDescription()

def okbuttonClick(self):
self["menu"].getCurrent() and self["menu"].getCurrent()[1]()

def cancelClick(self):
self.close(False)

def updateDescription(self):
current = self["menu"].getCurrent()
self["description"].text = current and len(current) > 2 and hasattr(current[2], "description") and current[2].description or ""


class EventViewBase:
def __init__(self, event, ref, callback=None, similarEPGCB=None):
Expand Down Expand Up @@ -257,7 +267,7 @@ def doContext(self):
for p in plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO):
#only list service or event specific eventinfo plugins here, no servelist plugins
if "servicelist" not in p.fnc.__code__.co_varnames:
menu.append((p.name, boundFunction(self.runPlugin, p)))
menu.append((p.name, boundFunction(self.runPlugin, p), p))
if menu:
self.session.open(EventViewContextMenu, menu)

Expand Down

0 comments on commit 9279016

Please sign in to comment.