X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/a4c65dae04761e9e5da358e9b4a1159436a6f18b..1c041a12021d9b29334c5a409fcc9e07dfcca1bc:/lib/python/Screens/InfoBarGenerics.py diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 0ef08d43..f8b185f0 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1,32 +1,34 @@ -from Screen import Screen -from Components.ActionMap import ActionMap, HelpableActionMap -from Components.ActionMap import NumberActionMap -from Components.Label import * -from Components.ProgressBar import * -from Components.config import configfile, configsequencearg -from Components.config import config, configElement, ConfigSubsection, configSequence from ChannelSelection import ChannelSelection, BouquetSelector -from Components.Pixmap import Pixmap, PixmapConditional +from Components.ActionMap import ActionMap, HelpableActionMap +from Components.ActionMap import NumberActionMap from Components.BlinkingPixmap import BlinkingPixmapConditional -from Components.ServiceName import ServiceName -from Components.EventInfo import EventInfo, EventInfoProgress from Components.Clock import Clock +from Components.EventInfo import EventInfo, EventInfoProgress +from Components.Harddisk import harddiskmanager from Components.Input import Input +from Components.Label import * +from Components.Pixmap import Pixmap, PixmapConditional +from Components.PluginComponent import plugins +from Components.ProgressBar import * +from Components.ServiceEventTracker import ServiceEventTracker +from Components.ServiceName import ServiceName +from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean +from Components.config import configfile, configsequencearg +from Components.TimerList import TimerEntryComponent -from ServiceReference import ServiceReference from EpgSelection import EPGSelection +from Plugins.Plugin import PluginDescriptor -from Screens.MessageBox import MessageBox +from Screen import Screen from Screens.ChoiceBox import ChoiceBox -from Screens.InputBox import InputBox from Screens.Dish import Dish -from Screens.Standby import Standby from Screens.EventView import EventViewEPGSelect, EventViewSimple +from Screens.InputBox import InputBox +from Screens.MessageBox import MessageBox from Screens.MinuteInput import MinuteInput -from Components.Harddisk import harddiskmanager - -from Components.ServiceEventTracker import ServiceEventTracker +from Screens.TimerSelection import TimerSelection +from ServiceReference import ServiceReference from Tools import Notifications from Tools.Directories import * @@ -165,41 +167,6 @@ class NumberZap(Screen): self.Timer.timeout.get().append(self.keyOK) self.Timer.start(3000, True) -class InfoBarPowerKey: - """ PowerKey stuff - handles the powerkey press and powerkey release actions""" - - def __init__(self): - self.powerKeyTimer = eTimer() - self.powerKeyTimer.timeout.get().append(self.powertimer) - self["PowerKeyActions"] = HelpableActionMap(self, "PowerKeyActions", - { - "powerdown": self.powerdown, - "powerup": self.powerup, - "discreteStandby": (self.standby, "Go standby"), - "discretePowerOff": (self.quit, "Go to deep standby"), - }) - - def powertimer(self): - print "PowerOff - Now!" - self.quit() - - def powerdown(self): - self.standbyblocked = 0 - self.powerKeyTimer.start(3000, True) - - def powerup(self): - self.powerKeyTimer.stop() - if self.standbyblocked == 0: - self.standbyblocked = 1 - self.standby() - - def standby(self): - self.session.open(Standby, self) - - def quit(self): - # halt - quitMainloop(1) - class InfoBarNumberZap: """ Handles an initial number for NumberZapping """ def __init__(self): @@ -269,12 +236,17 @@ class InfoBarNumberZap: self.servicelist.setCurrentSelection(service) #select the service in servicelist self.servicelist.zap() +config.misc.initialchannelselection = configElementBoolean("config.misc.initialchannelselection", 1); + class InfoBarChannelSelection: """ ChannelSelection - handles the channelSelection dialog and the initial channelChange actions which open the channelSelection dialog """ def __init__(self): #instantiate forever self.servicelist = self.session.instantiateDialog(ChannelSelection) + + if config.misc.initialchannelselection.value == 1: + self.onShown.append(self.firstRun) self["ChannelSelectActions"] = HelpableActionMap(self, "InfobarChannelSelection", { @@ -286,6 +258,12 @@ class InfoBarChannelSelection: "historyNext": (self.historyNext, _("next channel in history")) }) + def firstRun(self): + self.onShown.remove(self.firstRun) + config.misc.initialchannelselection.value = 0 + config.misc.initialchannelselection.save() + self.switchChannelDown() + def historyBack(self): self.servicelist.historyBack() @@ -554,8 +532,9 @@ class InfoBarSeek: if action[:5] == "seek:": time = int(action[5:]) self.screen.seekRelative(time * 90000) + return 1 else: - HelpableActionMap.action(self, contexts, action) + return HelpableActionMap.action(self, contexts, action) self["SeekActions"] = InfoBarSeekActionMap(self, "InfobarSeekActions", { @@ -655,7 +634,7 @@ class InfoBarSeek: self.checkSkipShowHideLock() return True - + def pauseService(self): if self.seekstate == self.SEEK_STATE_PAUSE: print "pause, but in fact unpause" @@ -805,17 +784,17 @@ class InfoBarSeek: if seekable is not None: seekable.seekRelative(1, diff) -from Screens.PVRState import PVRState +from Screens.PVRState import PVRState, TimeshiftState class InfoBarPVRState: - def __init__(self): + def __init__(self, screen=PVRState): self.onPlayStateChanged.append(self.__playStateChanged) - self.pvrStateDialog = self.session.instantiateDialog(PVRState) + self.pvrStateDialog = self.session.instantiateDialog(screen) self.onShow.append(self.__mayShow) self.onHide.append(self.pvrStateDialog.hide) def __mayShow(self): - if self.seekstate != self.SEEK_STATE_PLAY: + if self.seekstate != self.SEEK_STATE_PLAY and self.execing: self.pvrStateDialog.show() def __playStateChanged(self, state): @@ -823,6 +802,11 @@ class InfoBarPVRState: self.pvrStateDialog["state"].setText(playstateString) self.__mayShow() +class InfoBarTimeshiftState(InfoBarPVRState): + def __init__(self): + InfoBarPVRState.__init__(self, screen=TimeshiftState) + + class InfoBarShowMovies: # i don't really like this class. @@ -884,6 +868,7 @@ class InfoBarTimeshift: self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { + iPlayableService.evStart: self.__serviceStarted, iPlayableService.evSeekableStatusChanged: self.__seekableStatusChanged }) @@ -903,7 +888,9 @@ class InfoBarTimeshift: print "hu, timeshift already enabled?" else: if not ts.startTimeshift(): + import time self.timeshift_enabled = 1 + self.pvrStateDialog["timeshift"].setRelative(time.time()) # PAUSE. self.setSeekState(self.SEEK_STATE_PAUSE) @@ -984,6 +971,10 @@ class InfoBarTimeshift: print "timeshift activate:", enabled self["TimeshiftActivateActions"].setEnabled(enabled) + def __serviceStarted(self): + self.timeshift_enabled = False + self.__seekableStatusChanged() + from RecordTimer import parseEvent class InfoBarInstantRecord: @@ -994,15 +985,16 @@ class InfoBarInstantRecord: { "instantRecord": (self.instantRecord, "Instant Record..."), }) - self.recording = None + self.recording = [] self["BlinkingPoint"] = BlinkingPixmapConditional() self["BlinkingPoint"].hide() self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording) - def stopCurrentRecording(self): - self.session.nav.RecordTimer.removeEntry(self.recording) - self.recording = None - + def stopCurrentRecording(self, entry = -1): + if entry is not None and entry != -1: + self.session.nav.RecordTimer.removeEntry(self.recording[entry]) + self.recording.remove(self.recording[entry]) + def startInstantRecording(self, limitEvent = False): serviceref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -1038,27 +1030,39 @@ class InfoBarInstantRecord: data = (begin, end, name, description, eventid) - self.recording = self.session.nav.recordWithTimer(serviceref, *data) - self.recording.dontSave = True + recording = self.session.nav.recordWithTimer(serviceref, *data) + recording.dontSave = True + self.recording.append(recording) #self["BlinkingPoint"].setConnect(lambda: self.recording.isRunning()) def isInstantRecordRunning(self): - if self.recording != None: - if self.recording.isRunning(): - return True + print "self.recording:", self.recording + if len(self.recording) > 0: + for x in self.recording: + if x.isRunning(): + return True return False def recordQuestionCallback(self, answer): if answer is None or answer[1] == "no": return - - if self.isInstantRecordRunning(): - if answer[1] == "manualduration": - self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) + list = [] + for x in self.recording: + if x.dontSave: + list.append(TimerEntryComponent(x, False)) + + if answer[1] == "changeduration": + if len(self.recording) == 1: + self.changeDuration(0) else: - self.stopCurrentRecording() - else: + self.session.openWithCallback(self.changeDuration, TimerSelection, list) + elif answer[1] == "stop": + if len(self.recording) == 1: + self.stopCurrentRecording(0) + else: + self.session.openWithCallback(self.stopCurrentRecording, TimerSelection, list) + if answer[1] == "indefinitely" or answer[1] == "manualduration" or answer[1] == "event": limitEvent = False if answer[1] == "event": limitEvent = True @@ -1066,12 +1070,16 @@ class InfoBarInstantRecord: self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) self.startInstantRecording(limitEvent = limitEvent) + def changeDuration(self, entry): + if entry is not None: + 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) + def inputCallback(self, value): if value is not None: print "stopping recording after", int(value), "minutes." - if self.recording is not None: - self.recording.end = time.time() + 60 * int(value) - self.session.nav.RecordTimer.timeChanged(self.recording) + self.recording[self.selectedEntry].end = time.time() + 60 * int(value) + self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry]) def instantRecord(self): try: @@ -1081,11 +1089,9 @@ class InfoBarInstantRecord: return if self.isInstantRecordRunning(): - self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "yes"), (_("enter recording duration"), "manualduration"), (_("do nothing"), "no")]) -# self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Do you want to stop the current\n(instant) recording?")) + self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "stop"), (_("change recording (duration)"), "changeduration"), (_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"), (_("do nothing"), "no")]) else: - self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("record indefinitely"), "indefinitely"), (_("stop after current event"), "event"), (_("enter recording duration"), "manualduration"),(_("don't record"), "no")]) - #self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Start recording?")) + self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"),(_("don't record"), "no")]) from Screens.AudioSelection import AudioSelection @@ -1375,8 +1381,8 @@ class InfoBarCueSheetSupport: class InfoBarSummary(Screen): skin = """ - - + + """ def __init__(self, session, parent): @@ -1390,3 +1396,21 @@ class InfoBarSummarySupport: def createSummary(self): return InfoBarSummary + +class InfoBarTeletextPlugin: + def __init__(self): + self.teletext_plugin = None + + for p in plugins.getPlugins(PluginDescriptor.WHERE_TELETEXT): + self.teletext_plugin = p + + if self.teletext_plugin is not None: + self["TeletextActions"] = HelpableActionMap(self, "InfobarTeletextActions", + { + "startTeletext": (self.startTeletext, "View teletext...") + }) + else: + print "no teletext plugin found!" + + def startTeletext(self): + self.teletext_plugin(session=self.session, service=self.session.nav.getCurrentService())