# TODO: we could just accept the current path here....
print "[BouquetSelector] Dunno what to do, no directory selected:", ref," :-/"
-class EPGRefreshChannelEditor(Screen, ConfigListScreen):
+class EPGRefreshServiceEditor(Screen, ConfigListScreen):
"""Edit Services to be refreshed by EPGRefresh"""
- skin = """<screen name="EPGRefreshChannelEditor" title="Edit Services to refresh" position="75,150" size="565,245">
+ skin = """<screen name="EPGRefreshServiceEditor" title="Edit Services to refresh" position="75,150" size="565,245">
<widget name="config" position="5,5" size="555,200" scrollbarMode="showOnDemand" />
<ePixmap position="5,205" zPosition="4" size="140,40" pixmap="skin_default/key-red.png" transparent="1" alphatest="on" />
<ePixmap position="145,205" zPosition="4" size="140,40" pixmap="skin_default/key-green.png" transparent="1" alphatest="on" />
self.setup_title = "EPGRefresh Services"
self.onChangedEntry = []
- self.services = services
+ # We need to copy the list to be able to ignore changes
+ self.services = (
+ services[0][:],
+ services[1][:]
+ )
self.typeSelection = ConfigSelection(choices = [("channels", _("Channels")), ("bouquets", _("Bouquets"))])
self.typeSelection.addNotifier(self.refresh, initial_call = False)
{
"cancel": self.cancel,
"save": self.save,
- "yellow": self.removeChannel,
- "blue": self.newChannel
+ "yellow": self.removeService,
+ "blue": self.newService
}
)
if self.typeSelection.value == "channels":
self.idx = 0
- self.list.extend([
- getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(str(x), ServiceReference(str(x)).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))
- for x in self.services[0]
- ])
else: # self.typeSelection.value == "bouquets":
self.idx = 1
- self.list.extend([
- getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(str(x), ServiceReference(str(x)).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))
- for x in self.services[1]
- ])
+
+ self.list.extend([
+ getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(str(x), ServiceReference(str(x)).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))]))
+ for x in self.services[self.idx]
+ ])
def changed(self):
for x in self.onChangedEntry:
def createSummary(self):
return SetupSummary
- def removeChannel(self):
+ def removeService(self):
cur = self["config"].getCurrent()
if cur:
list = self["config"].getList()
list.remove(cur)
self["config"].setList(list)
- def newChannel(self):
+ def newService(self):
if self.typeSelection.value == "channels":
self.session.openWithCallback(
- self.finishedChannelSelection,
+ self.finishedServiceSelection,
SimpleChannelSelection,
_("Select channel to refresh")
)
else: # self.typeSelection.value == "bouquets":
self.session.openWithCallback(
- self.finishedChannelSelection,
+ self.finishedServiceSelection,
SimpleBouquetSelection,
_("Select bouquet to refresh")
)
- def finishedChannelSelection(self, *args):
+ def finishedServiceSelection(self, *args):
if len(args):
list = self["config"].getList()
- list.append(getConfigListEntry(_("Refreshing"), ConfigSelection(choices = [(args[0].toString(), ServiceReference(args[0]).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))])))
+ list.append(getConfigListEntry(
+ _("Refreshing"),
+ ConfigSelection(choices = [(args[0].toString(), ServiceReference(args[0]).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))])
+ ))
self["config"].setList(list)
def cancel(self):
# GUI (Screens)
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
-from EPGRefreshChannelEditor import EPGRefreshChannelEditor
+from EPGRefreshChannelEditor import EPGRefreshServiceEditor
# GUI (Summary)
from Screens.Setup import SetupSummary
self.setup_title = "EPGRefresh Configuration"
self.onChangedEntry = []
- # Entries are saved internally as a set, but we might need item deletion later on
+ # Although EPGRefresh keeps services in a Set we prefer a list
self.services = (
[x for x in epgrefresh.services[0]],
[x for x in epgrefresh.services[1]]
"cancel": self.keyCancel,
"save": self.keySave,
"yellow": self.forceRefresh,
- "blue": self.editChannels
+ "blue": self.editServices
}
)
self.changed()
def forceRefresh(self):
- # TODO: fix this :-)
epgrefresh.services = (Set(self.services[0]), Set(self.services[1]))
- # TODO: maybe we need to save the configuration here...
epgrefresh.forceRefresh(self.session)
- def editChannels(self):
+ def editServices(self):
self.session.openWithCallback(
- self.editChannelsCallback,
- EPGRefreshChannelEditor,
+ self.editServicesCallback,
+ EPGRefreshServiceEditor,
self.services
)
- def editChannelsCallback(self, ret):
+ def editServicesCallback(self, ret):
if ret:
self.services = ret