class InfoBarChannelSelection():
def __init__(self):
self.servicelist = self.session.instantiateDialog(ChannelSelection)
if config.misc.initialchannelselection.value:
self.onShown.append(self.firstRun)
self['ChannelSelectActions'] = HelpableActionMap(self, 'InfobarChannelSelection', {'switchChannelUp': (self.switchChannelUp, _('Open service list and select previous channel')),
'switchChannelDown': (self.switchChannelDown, _('Open service list and select next channel')),
'zapUp': (self.zapUp, _('Switch to previous channel')),
'zapDown': (self.zapDown, _('Switch next channel')),
'historyBack': (self.historyBack, _('Switch to previous channel in history')),
historyNext': (self.historyNext, _('Switch to next channel in history')),
'showFavourites': (self.showFavourites, _('show favourites')),
'openServiceList': (self.openServiceList, _('Open service list'))})
def showTvChannelList(self, zap = False):
self.servicelist.setModeTv()
if zap:
self.servicelist.zap()
def showRadioChannelList(self, zap = False):
self.servicelist.setModeRadio()
if zap:
self.servicelist.zap()
def firstRun(self):
self.onShown.remove(self.firstRun)
config.misc.initialchannelselection.value = False
config.misc.initialchannelselection.save()
self.switchChannelDown()
def historyBack(self):
self.checkTimeshiftRunning(self.historyBackCheckTimeshiftCallback)
def historyBackCheckTimeshiftCallback(self, answer):
if answer:
self.servicelist.historyBack()
def historyNext(self):
self.checkTimeshiftRunning(self.historyNextCheckTimeshiftCallback)
def historyNextCheckTimeshiftCallback(self, answer):
if answer:
self.servicelist.historyNext()
def showFavourites(self):
self.session.execDialog(self.servicelist)
self.servicelist.showFavourites()
def switchChannelUp(self):
if 'keep' not in config.usage.servicelist_cursor_behavior.value:
self.servicelist.moveUp()
self.session.execDialog(self.servicelist)
def switchChannelDown(self):
if 'keep' not in config.usage.servicelist_cursor_behavior.value:
self.servicelist.moveDown()
self.session.execDialog(self.servicelist)
def openServiceList(self):
self.session.execDialog(self.servicelist)
def zapUp(self):
if self.servicelist.inBouquet():
prev = self.servicelist.getCurrentSelection()
if prev:
prev = prev.toString()
while True:
if config.usage.quickzap_bouquet_change.value:
if self.servicelist.atBegin():
self.servicelist.prevBouquet()
self.servicelist.moveUp()
cur = self.servicelist.getCurrentSelection()
if cur:
if self.servicelist.dopipzap:
isPlayable = self.session.pip.isPlayableForPipService(cur)
else:
isPlayable = isPlayableForCur(cur)
if cur and (cur.toString() == prev or isPlayable):
break
else:
self.servicelist.moveUp()
self.servicelist.zap(enable_pipzap=True)