self.current = 0
def selectService(self, service):
- self.current = 0
- while self.services[self.current].ref != service:
- self.current += 1
+ if not self.length:
+ self.current = -1
+ return False
+ else:
+ self.current = 0
+ while self.services[self.current].ref != service:
+ self.current += 1
+ if self.current >= self.length:
+ return False
+ return True
def nextService(self):
+ if not self.length:
+ return
if self.current+1 < self.length:
self.current += 1
else:
self.current = 0
def prevService(self):
+ if not self.length:
+ return
if self.current-1 > -1:
self.current -= 1
else:
self.current = self.length - 1
def currentService(self):
+ if not self.length or self.current >= self.length:
+ return None
return self.services[self.current]
class InfoBarEPG:
current_path = self.servicelist.getRoot()
services = self.getBouquetServices(current_path)
self.serviceSel = SimpleServicelist(services)
- self.serviceSel.selectService(ref)
- self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = self.changeServiceCB)
+ if self.serviceSel.selectService(ref):
+ self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = self.changeServiceCB)
+ else:
+ self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref)
else:
self.session.open(EPGSelection, ref)
if list:
list.append((_("show single service EPG..."), self.openSingleServiceEPG))
- self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list)
+ self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list, skin_name = "EPGExtensionsList")
else:
self.openSingleServiceEPG()
-
+
def runPlugin(self, plugin):
plugin(session = self.session, servicelist = self.servicelist)
print "not pauseable."
state = self.SEEK_STATE_PLAY
- oldstate = self.seekstate
self.seekstate = state
- for i in (0, 1, 2):
- if oldstate[i] != self.seekstate[i]:
- (self.session.nav.pause, pauseable.setFastForward, pauseable.setSlowMotion)[i](self.seekstate[i])
+ if pauseable is not None:
+ if self.seekstate[0]:
+ print "resolved to PAUSE"
+ pauseable.pause()
+ elif self.seekstate[1]:
+ print "resolved to FAST FORWARD"
+ pauseable.setFastForward(self.seekstate[1])
+ elif self.seekstate[2]:
+ print "resolved to SLOW MOTION"
+ pauseable.setSlowMotion(self.seekstate[2])
+ else:
+ print "resolved to PLAY"
+ pauseable.unpause()
for c in self.onPlayStateChanged:
c(self.seekstate)
list.extend([(x[0](), x) for x in extensionsList])
keys += [""] * len(extensionsList)
- self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys)
+ self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys, skin_name = "ExtensionsList")
def extensionCallback(self, answer):
if answer is not None:
return name
def getPluginList(self):
- return [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)]
+ list = [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None, p.name) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)]
+ list.sort(key = lambda e: e[2]) # sort by name
+ return list
def runPlugin(self, plugin):
if isinstance(self, InfoBarChannelSelection):
print "after:\n", self.recording
def setEndtime(self, entry):
- if entry is not None:
+ if entry is not None and entry >= 0:
self.selectedEntry = entry
self.endtime=ConfigClock(default = self.recording[self.selectedEntry].end)
dlg = self.session.openWithCallback(self.TimeDateInputClosed, TimeDateInput, self.endtime)
self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
def changeDuration(self, entry):
- if entry is not None:
+ if entry is not None and entry >= 0:
self.selectedEntry = entry
self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)
tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist
keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n
selection += 2
- self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys)
+ self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection")
else:
del self.audioTracks
keys = ["red", "green", "yellow"]
selection = self.audioChannel.getCurrentChannel()
tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2))
- self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys)
+ self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys, skin_name ="AudioModeSelection")
else:
del self.audioChannel
if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]:
keys = ["red", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
selection += 2
- self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = selection, keys = keys)
+ self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = selection, keys = keys, skin_name = "SubserviceSelection")
def subserviceSelected(self, service):
del self.bouquets