2 from Screens.Screen import Screen
3 from Components.ConfigList import ConfigListScreen
4 from Screens.ChannelSelection import SimpleChannelSelection
7 from Screens.Setup import SetupSummary
10 from Components.ActionMap import ActionMap
11 from Components.Button import Button
14 from Components.config import getConfigListEntry, ConfigSelection
16 # Show ServiceName instead of ServiceReference
17 from ServiceReference import ServiceReference
19 class EPGRefreshChannelEditor(Screen, ConfigListScreen):
20 """Edit Channels to refresh by EPGRefresh"""
22 skin = """<screen name="EPGRefreshChannelEditor" title="Edit Channels to refresh" position="75,150" size="565,245">
23 <widget name="config" position="5,5" size="555,200" scrollbarMode="showOnDemand" />
24 <ePixmap position="5,205" zPosition="4" size="140,40" pixmap="skin_default/key-red.png" transparent="1" alphatest="on" />
25 <ePixmap position="145,205" zPosition="4" size="140,40" pixmap="skin_default/key-green.png" transparent="1" alphatest="on" />
26 <ePixmap position="285,205" zPosition="4" size="140,40" pixmap="skin_default/key-yellow.png" transparent="1" alphatest="on" />
27 <ePixmap position="425,205" zPosition="4" size="140,40" pixmap="skin_default/key-blue.png" transparent="1" alphatest="on" />
28 <widget name="key_red" position="5,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
29 <widget name="key_green" position="145,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
30 <widget name="key_yellow" position="285,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
31 <widget name="key_blue" position="425,205" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
34 def __init__(self, session, servicelist):
35 Screen.__init__(self, session)
38 self.setup_title = "EPGRefresh Channels"
39 self.onChangedEntry = []
42 getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(str(x), ServiceReference(str(x)).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))
46 ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
49 self["key_red"] = Button(_("Cancel"))
50 self["key_green"] = Button(_("OK"))
51 self["key_yellow"] = Button(_("delete"))
52 self["key_blue"] = Button(_("New"))
55 self["actions"] = ActionMap(["SetupActions", "ColorActions"],
57 "cancel": self.cancel,
59 "yellow": self.removeChannel,
60 "blue": self.newChannel
68 for x in self.onChangedEntry:
74 def getCurrentEntry(self):
75 cur = self["config"].getCurrent()
80 def getCurrentValue(self):
81 cur = self["config"].getCurrent()
83 return str(cur[1].getText())
86 def createSummary(self):
89 def removeChannel(self):
90 cur = self["config"].getCurrent()
92 list = self["config"].getList()
94 self["config"].setList(list)
97 self.session.openWithCallback(
98 self.finishedChannelSelection,
99 SimpleChannelSelection,
100 _("Select channel to refresh")
103 def finishedChannelSelection(self, *args):
105 list = self["config"].getList()
106 list.append(getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(args[0].toString(), ServiceReference(args[0]).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))])))
107 self["config"].setList(list)
113 # Warning, accessing a ConfigListEntry directly might be considered evil!
115 x[1].value.encode("UTF-8")
116 for x in self["config"].getList()