def __init__(self): assert not HdmiCec.instance, "only one HdmiCec instance is allowed!" HdmiCec.instance = self self.wait = eTimer() self.wait.timeout.get().append(self.sendCmd) self.waitKeyEvent = eTimer() self.waitKeyEvent.timeout.get().append(self.sendKeyEvent) self.queueKeyEvent = [] self.repeat = eTimer() self.repeat.timeout.get().append(self.wakeupMessages) self.queue = [] self.delay = eTimer() self.delay.timeout.get().append(self.sendStandbyMessages) self.useStandby = True eHdmiCEC.getInstance().messageReceived.get().append(self.messageReceived) config.misc.standbyCounter.addNotifier(self.onEnterStandby, initial_call = False) config.misc.DeepStandby.addNotifier(self.onEnterDeepStandby, initial_call = False) self.setFixedPhysicalAddress(config.hdmicec.fixed_physical_address.value) self.volumeForwardingEnabled = False self.volumeForwardingDestination = 0 self.wakeup_from_tv = False eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent) config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding) config.hdmicec.enabled.addNotifier(self.configVolumeForwarding) if config.hdmicec.enabled.value: if config.hdmicec.report_active_menu.value: if config.hdmicec.report_active_source.value and NavigationInstance.instance and not NavigationInstance.instance.isRestartUI(): self.sendMessage(0, "sourceinactive") self.sendMessage(0, "menuactive") if config.hdmicec.handle_deepstandby_events.value and (not getFPWasTimerWakeup() or (config.usage.startup_to_standby.value == "no" and config.misc.prev_wakeup_time_type.value == 3)): self.onLeaveStandby()
def __init__(self, session, url, folder, filename): screen = """ <screen flags="wfNoBorder" position="0,0" size="1280,720" backgroundColor="transparent"> <widget source="fname" render="Label" position="610,147" size="580,75" font="Regular;18" halign="center" valign="center" transparent="1" /> <widget source="progressbar" render="Progress" pixmap="icons/bar_downloader.png" position="610,233" size="580,12" zPosition="2" transparent="1" /> <widget source="status" render="Label" position="610,258" zPosition="3" size="580,71" font="Regular;22" halign="center" transparent="1" /> </screen>""" Screen.__init__(self, session) self.url = url self.filename = filename self.dstfilename = folder + filename self["oktext"] = Label(_("OK")) self["canceltext"] = Label(_("Cancel")) self["fname"] = StaticText('') self["status"] = StaticText('') self["progressbar"] = Progress() self["progressbar"].range = 1000 self["progressbar"].value = 0 self["actions"] = ActionMap(["WizardActions", "DirectionActions",'ColorActions'], { "ok": self.cancel, "back": self.cancel, "red": self.stop, "green": self.cancel }, -1) self.autoCloseTimer = eTimer() self.autoCloseTimer.timeout.get().append(self.cancel) self.startDownloadTimer = eTimer() self.startDownloadTimer.timeout.get().append(self.fileDownload) self.download = None self.downloading(False) self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.startDownload)
def __init__(self, session, servicelist, cleanupfnc = None): Screen.__init__(self, session) # Save Session&Servicelist self.session = session self.servicelist = servicelist # Create zap timer self.zap_time = None self.zap_timer = eTimer() self.zap_timer_conn = self.zap_timer.timeout.connect(self.zap) # Create event monitoring timer self.monitor_timer = eTimer() self.monitor_timer_conn = self.monitor_timer.timeout.connect(self.stopMonitoring) # Create delay timer self.delay_timer = eTimer() self.delay_timer_conn = self.delay_timer.timeout.connect(self.zappedAway) # Initialize services self.zap_service = None self.move_service = None self.root = None # Initialize monitoring self.monitored_service = None self.monitored_event = None self.__event_tracker = None # Keep Cleanup self.cleanupfnc = cleanupfnc
def __init__(self, session): self["actions"] = ActionMap(["DirectionActions","OkCancelActions"], { "ok": self.keyOk, "up": self.up, "down":self.down, "cancel": self.keyCancel, }, -2) Screen.__init__(self, session) tlist = [] tlist.append(("Smartcard 1 Test",0)) tlist.append(("Smartcard 2 Test",1)) tlist.append(("CI 1 Test",2)) tlist.append(("CI 2 Test",3)) self["testlist"] = MenuList(tlist) self.rlist = [] for x in range(4): self.rlist.append(("..")) self["resultlist"] = TestResultList(self.rlist) self.result = 0 self.removecard = eTimer() self.removecard.callback.append(self.remove_card) self["text"]=Label(("Press OK Key")) self.camstate= eTimer() self.camstate.callback.append(self.cam_state) self.camtry = 5 self.camstep = 0
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session): Screen.__init__(self, session) self["Dishpixmap"] = BlinkingPixmapConditional() self["Dishpixmap"].onVisibilityChange.append(self.DishpixmapVisibilityChanged) self["turnTime"] = Label("") self["posFrom"] = Label("") self["posGoto"] = Label("") self["From"] = Label (_("From :")) self["Goto"] = Label (_("Goto :")) self.rotorTimer = eTimer() self.rotorTimer.callback.append(self.updateRotorMovingState) self.turnTimer = eTimer() self.turnTimer.callback.append(self.turnTimerLoop) self.showTimer = eTimer() self.showTimer.callback.append(self.hide) config.usage.showdish.addNotifier(self.configChanged) self.configChanged(config.usage.showdish) self.rotor_pos = self.cur_orbpos = config.misc.lastrotorposition.getValue() self.turn_time = self.total_time = None self.cur_polar = 0 self.__state = self.STATE_HIDDEN self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evStart: self.__serviceStarted, iPlayableService.evTunedIn: self.__serviceTuneEnd, iPlayableService.evTuneFailed: self.__serviceTuneEnd, })
def __init__(self, session): Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ShortcutActions", "WizardActions", "ColorActions", "SetupActions", "NumberActions", "MenuActions"], { "ok" : self.keyOK, "cancel": self.keyCancel, "red" : self.keyCancel, "green" : self.keyGreen, "yellow": self.keyYellow, "blue" : self.keyBlue, }, -1) global DLNA_CONFIG_CLIENT_CONFNAME self.configFileName = DLNA_CONFIG_CLIENT_CONFNAME self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Start")) self["key_yellow"] = StaticText(_("Setting")) self["key_blue"] = StaticText(_("Reload Device")) #self["devicelist"] = MenuList(self.setListOnView()) self["devicelist"] = MenuList([]) self.onLayoutFinish.append(self.layoutFinished) self.initConfig() self.taskManager = TaskManager() self.toggleGreenButtonTimer = eTimer() self.toggleGreenButtonTimer.timeout.get().append(self.cbToggleGreenButton) self.deviceListRefreshTimer = eTimer() self.deviceListRefreshTimer.timeout.get().append(self.cbDeviceListRefresh) global DLNA_CONFIG_DEVICE_REFRESH self.deviceListRefreshTimer.start(DLNA_CONFIG_DEVICE_REFRESH)
def __init__(self, session): global globalActionMap globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute assert not VolumeControl.instance, "only one VolumeControl instance is allowed!" VolumeControl.instance = self config.audio = ConfigSubsection() config.audio.volume = ConfigInteger(default = 50, limits = (0, 100)) self.volumeDialog = session.instantiateDialog(Volume) self.volumeDialog.setAnimationMode(0) self.muteDialog = session.instantiateDialog(Mute) self.muteDialog.setAnimationMode(0) self.hideVolTimer = eTimer() self.hideVolTimer.callback.append(self.volHide) self.stepVolTimer = eTimer() self.repeat = 500 self.delay = 3000 vol = config.audio.volume.value self.volumeDialog.setValue(vol) self.volctrl = eDVBVolumecontrol.getInstance() self.volctrl.setVolume(vol, vol)
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("SoftCam manager")) self.Console = Console() self["key_red"] = StaticText(_("Stop")) self["key_green"] = StaticText(_("Start")) self["key_yellow"] = StaticText(_("Restart")) self["key_blue"] = StaticText(_("Setup")) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "cancel": self.cancel, "ok": self.ok, "green": self.start, "red": self.stop, "yellow": self.restart, "blue": self.setup }) self["status"] = Label() self["list"] = List([]) checkconfigdir() self.actcam = config.plugins.AltSoftcam.actcam.value self.camstartcmd = "" self.actcampng = LoadPixmap(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/actcam.png")) self.defcampng = LoadPixmap(resolveFilename(SCOPE_PLUGINS, "Extensions/AlternativeSoftCamManager/images/defcam.png")) self.stoppingTimer = eTimer() self.stoppingTimer.timeout.get().append(self.stopping) self.closestopTimer = eTimer() self.closestopTimer.timeout.get().append(self.closestop) self.createinfo() self.Timer = eTimer() self.Timer.callback.append(self.listecminfo) self.Timer.start(2000, False)
def __init__(self, session): Screen.__init__(self, session) self['Dishpixmap'] = BlinkingPixmapConditional() self['Dishpixmap'].onVisibilityChange.append(self.DishpixmapVisibilityChanged) self['turnTime'] = Label('') self['posFrom'] = Label('') self['posGoto'] = Label('') self['From'] = Label(_('From :')) self['Goto'] = Label(_('Goto :')) self['Tuner'] = Label(_('Tuner :')) self['tunerName'] = Label('') self['turnSpeed'] = Label('') self.updateRotorSatList() self.rotorTimer = eTimer() self.rotorTimer.callback.append(self.updateRotorMovingState) self.turnTimer = eTimer() self.turnTimer.callback.append(self.turnTimerLoop) self.timeoutTimer = eTimer() self.timeoutTimer.callback.append(self.testIsTuned) self.showdish = config.usage.showdish.value config.usage.showdish.addNotifier(self.configChanged) self.configChanged(config.usage.showdish) self.rotor_pos = self.cur_orbpos = config.misc.lastrotorposition.value config.misc.lastrotorposition.addNotifier(self.rotorPositionChanged) self.turn_time = self.total_time = self.pmt_timeout = self.close_timeout = None self.cur_polar = 0 self.__state = self.STATE_HIDDEN self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) self.__event_tracker = ServiceEventTracker(screen=self, eventmap={iPlayableService.evStart: self.__serviceStarted, iPlayableService.evTunedIn: self.__serviceTunedIn}) return
def __init__(self, session): Screen.__init__(self, session) self['Dishpixmap'] = Boolean(fixed=True, poll=1500) self['turnTime'] = Label('') self['posFrom'] = Label('') self['posGoto'] = Label('') self['From'] = Label(_('From :')) self['Goto'] = Label(_('Goto :')) self['tunerName'] = Label('') self['turnSpeed'] = Label('') self.updateRotorSatList() self.frontend = None self['Frontend'] = FrontendStatus(service_source=lambda : self.frontend, update_interval=1000) self.rotorTimer = eTimer() self.rotorTimer.timeout.get().append(self.updateRotorMovingState) self.turnTimer = eTimer() self.turnTimer.callback.append(self.turnTimerLoop) self.timeoutTimer = eTimer() self.timeoutTimer.callback.append(self.__toHide) self.rotor_pos = self.cur_orbpos = config.misc.lastrotorposition.value config.misc.lastrotorposition.addNotifier(self.RotorpositionChange) self.turn_time = self.total_time = None self.close_timeout = self.moving_timeout = self.cur_polar = 0 self.__state = self.STATE_HIDDEN self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return
def __init__(self, session): self.session = session self.autobouquetsmakertimer = eTimer() self.autobouquetsmakertimer.callback.append(self.AutoBouquetsMakeronTimer) self.autobouquetsmakeractivityTimer = eTimer() self.autobouquetsmakeractivityTimer.timeout.get().append(self.autobouquetsmakerdatedelay) now = int(time()) global AutoBouquetsMakerTime if config.autobouquetsmaker.schedule.value: print >> log, "[AutoBouquetsMaker] AutoBouquetsMaker Schedule Enabled at ", strftime("%c", localtime(now)) if now > 1262304000: self.autobouquetsmakerdate() else: print >> log, "[AutoBouquetsMaker] AutoBouquetsMaker Time not yet set." AutoBouquetsMakerTime = 0 self.autobouquetsmakeractivityTimer.start(36000) else: AutoBouquetsMakerTime = 0 print >> log, "[AutoBouquetsMaker] AutoBouquetsMaker Schedule Disabled at", strftime("%c", localtime(now)) self.autobouquetsmakeractivityTimer.stop() assert ( AutoAutoBouquetsMakerTimer.instance is None ), "class AutoAutoBouquetsMakerTimer is a singleton class and just one instance of this class is allowed!" AutoAutoBouquetsMakerTimer.instance = self
def __init__(self, session, parent): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = """<screen position="0,0" size="%i,%i" flags="wfNoBorder" title="LastFMSaveScreen" > <widget name="cover" position="50,50" size="%i,%i" /> </screen>""" % (size_w, size_h, self.coverartsize[0], self.coverartsize[1]) Screen.__init__(self, session) HelpableScreen.__init__(self) self.imageconverter = ImageConverter(self.coverartsize[0], self.coverartsize[1], self.setCoverArt) self.session = session self.streamplayer = parent.streamplayer self.parent = parent self["cover"] = MovingPixmap() self["actions"] = HelpableActionMap(self, ["WizardActions", "ShortcutActions"], { "ok": (self.action_exit, _("Exit screensaver")), "back": (self.action_exit, _("Exit screensaver")), "red": (self.parent.action_startstop, _("Start/stop streaming")), "green": (self.parent.skipTrack, _("Skip current track")), "yellow": (self.parent.love, _("Mark track as loved")), "blue": (self.parent.banTrack, _("Ban track, never play")) }, prio=-1, description=config.plugins.LastFM.name.value + " " + _("Screensaver")) self.onLayoutFinish.append(self.update) self.updatetimer = eTimer() self.updatetimer.timeout.get().append(self.update) self.updatetimer.start(1000) if config.plugins.LastFM.sreensaver.coverartanimation.value: self.startmovingtimer = eTimer() self.startmovingtimer.timeout.get().append(self.movePixmap) self.startmovingtimer.start(config.plugins.LastFM.sreensaver.coverartinterval.value * 1000)
def __init__(self, nextRecordTimerAfterEventActionAuto=False): if NavigationInstance.instance is not None: raise NavigationInstance.instance NavigationInstance.instance = self self.ServiceHandler = eServiceCenter.getInstance() import Navigation as Nav Nav.navcore = self self.pnav = pNavigation() self.pnav.m_event.get().append(self.dispatchEvent) self.pnav.m_record_event.get().append(self.dispatchRecordEvent) self.event = [ ] self.record_event = [ ] self.currentlyPlayingServiceReference = None self.currentlyPlayingService = None self.RecordTimer = RecordTimer.RecordTimer() if getFPWasTimerWakeup(): if nextRecordTimerAfterEventActionAuto: # We need to give the system the chance to fully startup, # before we initiate the standby command. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True) # We need to give the systemclock the chance to sync with the transponder time, # before we will make the decision about whether or not we need to shutdown # after the upcoming recording has completed self.recordshutdowntimer = eTimer() self.recordshutdowntimer.callback.append(self.checkShutdownAfterRecording) self.recordshutdowntimer.start(30000, True) self.SleepTimer = SleepTimer.SleepTimer()
def doActions(self): from Screens.Standby import inStandby if len(self.actionsList) == 0: self.progresscurrent += 1 if not inStandby: self["progress"].setValue(self.progresscurrent) self["action"].setText(_("Bouquets generation...")) self["status"].setText( _("Services: %d video - %d radio") % (self.manager.getServiceVideoRead(), self.manager.getServiceAudioRead()) ) self.timer = eTimer() self.timer.callback.append(self.doBuildIndex) self.timer.start(100, 1) return self.currentAction = self.actionsList[0] del (self.actionsList[0]) self.progresscurrent += 1 if not inStandby: self["progress"].setValue(self.progresscurrent) self["action"].setText(_("Tuning %s...") % str(self.providers[self.currentAction]["name"])) self["status"].setText( _("Services: %d video - %d radio") % (self.manager.getServiceVideoRead(), self.manager.getServiceAudioRead()) ) self.timer = eTimer() self.timer.callback.append(self.doTune) self.timer.start(100, 1)
def __init__(self,session,parent): size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.skin = """<screen position="0,0" size="%i,%i" flags="wfNoBorder" title="LastFMSaveScreen" > <widget name="cover" position="50,50" size="%i,%i" /> </screen>"""%(size_w,size_h,self.coverartsize[0],self.coverartsize[1]) Screen.__init__(self,session) self.imageconverter = ImageConverter(self.coverartsize[0],self.coverartsize[1],self.setCoverArt) self.session = session self.streamplayer = parent.streamplayer self.parent = parent self["cover"] = MovingPixmap() self["actions"] = ActionMap(["InfobarChannelSelection","WizardActions", "DirectionActions","MenuActions","ShortcutActions","GlobalActions","HelpActions"], { "ok": self.action_exit, "back": self.action_exit, "red": self.parent.action_startstop, "green": self.parent.skipTrack, "yellow": self.parent.love, "blue": self.parent.banTrack , }, -1) self.onLayoutFinish.append(self.update) self.updatetimer = eTimer() self.updatetimer.timeout.get().append(self.update) self.updatetimer.start(1000) if config.plugins.LastFM.sreensaver.coverartanimation.value: self.startmovingtimer = eTimer() self.startmovingtimer.timeout.get().append(self.movePixmap) self.startmovingtimer.start(config.plugins.LastFM.sreensaver.coverartinterval.value*1000)
def __init__(self, session): self.skin = DishPiP.skin Screen.__init__(self, session) self["Dishpixmap"] = Boolean(fixed=True, poll=1500) self["turnTime"] = Label("") self["posFrom"] = Label("") self["posGoto"] = Label("") self["From"] = Label(_("From :")) self["Goto"] = Label(_("Goto :")) self["tunerName"] = Label("") self["turnSpeed"] = Label("") self.frontend = None self["Frontend"] = FrontendStatus(service_source = lambda: self.frontend, update_interval = 1000) self.rotorTimer = eTimer() self.rotorTimer.timeout.get().append(self.updateRotorMovingState) self.turnTimer = eTimer() self.turnTimer.callback.append(self.turnTimerLoop) self.timeoutTimer = eTimer() self.timeoutTimer.callback.append(self.__toHide) self.rotor_pos = self.cur_orbpos = configDishpip.value self.turn_time = self.total_time = self.close_timeout = None self.moving_timeout = self.cur_polar = 0 self.__state = self.STATE_HIDDEN configDishpip.addNotifier(self.lastrotorPiPpositionChange) self.onShow.append(self.__onShow) self.onHide.append(self.__onHide)
def __init__(self): # support only tm models self.devices = { "tm2toe":1, "tmnano2t":1, "tmtwinoe":2, "tmsingle":4, "tmnanooe":4} self.models = { 1:"TM-2T-OE/TM-NANO-2T", 2:"TM-TWIN-OE", 4:"TM-SINGLE/TM-NANO-OE" } self.rcu = self.devices.get(HardwareInfo().get_device_name()) self.rcuSaveFile = "/etc/.rcu" if os.path.exists(self.rcuSaveFile): fd = open(self.rcuSaveFile, "r") try: if int(fd.readline().strip()) in self.devices.values(): self.rcu = int(fd.readline().strip()) except: pass self.menuKeyCount = 0 self.ChannelMinusKeyCount = 0 self.volctrl = eDVBVolumecontrol.getInstance() #IQON model = HardwareInfo().get_device_name() # tmnano2t has not menu key. if model in ("tmnano2t"): self.resetChannelMinusKeyCountTimer = eTimer() self.resetChannelMinusKeyCountTimer.callback.append(self.resetChannelMinusKeyCount) else: self.resetMenuKeyCountTimer = eTimer() self.resetMenuKeyCountTimer.callback.append(self.resetMenuKeyCount)
def __init__(self, session): Screen.__init__(self, session) self.list = [] self['config'] = ConfigList(self.list) self["title"] = Label(_("DB Panel")) self["ecmtext"] = ScrollLabel("") self["key_blue"] = Label(_("Addons Manager")) self["key_yellow"] = Label(_("System Settings")) self["key_green"] = Label(_("System Information")) self["key_red"] = Label(_("System Utility")) self["key_1"] = Label(_("DB News")) self["key_2"] = Label(_("Parental Control Setup")) self["key_3"] = Label(_("About DB")) self["info_use"] = Label(_("Use arrows < > to select")) self["actions"] = NumberActionMap(["ColorActions", "CiSelectionActions","WizardActions","SetupActions"], { "left": self.keyLeft, "right": self.keyRight, "blue": self.naddons, "green": self.ninfo, "yellow": self.nsetting, "red": self.nutility, "ok": self.ok_pressed, "back": self.close, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal },-1) self.activityTimer = eTimer() self.ecmTimer = eTimer() self.ecmTimer.timeout.get().append(self.readEcmInfo) self.ecmTimer.start(10000, True) self.readEcmInfo() self.onLayoutFinish.append(self.loadEmuList) self.onShown.append(self.setWindowTitle)
def __init__(self, session, alt_bouquet_count): self.reclist = {} self.session = session self.anchor = config.plugins.RecInfobar.anchor.value self.acount = alt_bouquet_count Screen.__init__(self, session) self.skinName = ["RecInfoBar_" + self.__class__.__name__, "RecInfoBar"] self.labels = ["chNum","chName","timelen","chProv","chBouq","recName","chTuner", "remaining", "chSnr"] for x in self.labels: self[x] = Label("") self.RecIndicator = None self.updateTimer = eTimer() self.updateTimer.callback.append(self.updateInfo) self.onClose.append(self.__onClose) self.onShow.append(self.__onShow) config.plugins.RecInfobar.x.addNotifier(self.__changePosition, False) config.plugins.RecInfobar.y.addNotifier(self.__changePosition, False) config.plugins.RecInfobar.rec_indicator.addNotifier(self.stateRecIndicator) self.onLayoutFinish.append(self.__onLayoutFinished) self.rec_ref = None self.zap_ref = None self.no_decode = False self.SetPosition = False config.misc.rectimerstate.value = False config.misc.rectimerstate.save() NavigationInstance.instance.RecordTimer.on_state_change.append(self.timerEntryOnStateChange) config.recording.asktozap.addNotifier(self.asktozapChanged) if config.plugins.RecInfobar.check_wakeup.value and getFPWasTimerWakeup(): self.checkTimer = eTimer() self.checkTimer.callback.append(self.checkWakeup) self.checkTimer.start(20000, True)
def isDMMImage(): try: from enigma import eTimer eTimer().timeout.connect except Exception as e: return False return True
def __init__(self, session, url, folder, filename): Screen.__init__(self, session) self.url = url self.filename = filename self.dstfilename = folder + filename self['oktext'] = Label(_('OK')) self['canceltext'] = Label(_('Cancel')) self['fname'] = StaticText('') self['status'] = StaticText('') self['progressbar'] = Progress() self['progressbar'].range = 1000 self['progressbar'].value = 0 self['actions'] = ActionMap(['WizardActions', 'DirectionActions', 'ColorActions'], {'ok': self.cancel, 'back': self.cancel, 'red': self.stop, 'green': self.cancel}, -1) self.autoCloseTimer = eTimer() self.autoCloseTimer.timeout.get().append(self.cancel) self.startDownloadTimer = eTimer() self.startDownloadTimer.timeout.get().append(self.fileDownload) self.download = None self.downloading(False) self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.startDownload) return
def gotSession(self): self.FanState = 0 self.FOnTest = 0 self.FOffTest = 0 self.testno = 60 self.testRTCSet = 0 self.rstate = 1 self.recf = 0 self.ledstatus = 1 self.FANtimeTimer = eTimer() self.LEDtimeTimer = eTimer() self.RtimeTimer = eTimer() self.RtiminimeTimer = eTimer() self.AVptimeTimer = eTimer() hw_type = HardwareInfo().get_device_name() if hw_type == "me" or hw_type == "minime" : self.LEDtimeTimer.callback.append(self.updateLED) if hw_type == "minime" : self.RtiminimeTimer.callback.append(self.updateCR) elif hw_type == 'elite' or hw_type == 'premium' or hw_type == 'premium+' or hw_type == 'ultra' : self.LEDtimeTimer.callback.append(self.updateLEDHD) if hw_type == 'ultra' or hw_type == 'premium+': self.FANtimeTimer.callback.append(self.updateFAN) self.RtimeTimer.callback.append(self.updateRT) self.AVptimeTimer.callback.append(self.updateAVp) self.LEDtimeTimer.start(12000, True) self.RtimeTimer.start(12000, True) self.FANtimeTimer.start(12000, True) self.RtiminimeTimer.start(12000, True) self.AVptimeTimer.start(12000, True)
def __init__(self): self.popup = self.session.instantiateDialog(PopupInputDialog) self["config_actions"] = NumberActionMap(["SetupActions"], { "1": self.keyNumberPressed, "2": self.keyNumberPressed, "3": self.keyNumberPressed, "4": self.keyNumberPressed, "5": self.keyNumberPressed, "6": self.keyNumberPressed, "7": self.keyNumberPressed, "8": self.keyNumberPressed, "9": self.keyNumberPressed, "0": self.keyNumberPressed, }, -1) # to prevent left/right overriding the listbox # we use extra actions to disable them self["SetupActions"] = NumberActionMap(["SetupActions"], { "cancel": self.hidePopup, "deleteForward": self.keyBackspace, }, -1) self["InputAsciiActions"] = ActionMap(["InputAsciiActions"], { "gotAsciiCode": self.keyGotAscii }, -2) self.last_result = -1 self.__timer = eTimer() self.__timer.callback.append(self.__timeout) self.__timer_reload = eTimer() self.__timer_reload.callback.append(self.__timeout_reload) self.onClose.append(self.__onClose) self.onLayoutFinish.append(self.__onLayoutFinish)
def __init__(self, session): Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions"], { "ok": self._onOk, "cancel": self.close}, - 2) self.highPrioActionSlot = eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self._onKeypress) #highest prio self._pixmap = MyPixmap() self["wallpaper"] = self._pixmap self._setupAnimation() #picload setup size = getDesktop(0).size() width, height = size.width(), size.height() self._picload = ePicLoad() self.__picload_conn = self._picload.PictureData.connect(self._onPixmapReady) self._picload.setPara((width, height, width, height, False, 1, '#ff000000')) self._nextPixmap = None self._timer = eTimer() self.__timer_conn = self._timer.timeout.connect(self._onTimeout) self._inactivityTimer = eTimer() self.__inactivityTimer_conn = self._inactivityTimer.timeout.connect(self._onInactivityTimeout) self._immediateShow = True self._isEnabled = False self._isInitial = True self.onShow.append(self._onShow) self.onClose.append(self._onClose) config.plugins.screensaver.photo.speed.addNotifier(self._setupAnimation, initial_call = False)
def _processTimerWakeup(self): now = time() timeHandlerCallbacks = eDVBLocalTimeHandler.getInstance().m_timeUpdated.get() if self.__nextRecordTimerAfterEventActionAuto and now < eDVBLocalTimeHandler.timeOK: # 01.01.2004 print '[Navigation] RECTIMER: wakeup to standby but system time not set.' if self._processTimerWakeup not in timeHandlerCallbacks: timeHandlerCallbacks.append(self._processTimerWakeup) return if self._processTimerWakeup in timeHandlerCallbacks: timeHandlerCallbacks.remove(self._processTimerWakeup) if self.__nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - now) <= 360: print '[Navigation] RECTIMER: wakeup to standby detected.' f = open("/tmp/was_rectimer_wakeup", "w") f.write('1') f.close() # as we woke the box to record, place the box in standby. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True) elif self.__nextPowerManagerAfterEventActionAuto: print '[Navigation] POWERTIMER: wakeup to standby detected.' f = open("/tmp/was_powertimer_wakeup", "w") f.write('1') f.close() # as a PowerTimer WakeToStandby was actiond to it. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True)
def __init__(self, session): Screen.__init__(self, session) self.systemCod = [ 'beta', 'bis', 'bul', 'dream', 'dre', 'conax', 'cw', 'irdeto', 'nagra', 'nds', 'seca', 'via'] self.systemState = [ 'b_fta', 'b_card', 'b_emu', 'b_spider'] self.systemCaids = { '06': 'irdeto', '01': 'seca', '18': 'nagra', '05': 'via', '0B': 'conax', '17': 'beta', '0D': 'cw', '4A': 'dream', '09': 'nds', '4AE0': 'dre', '4AE1': 'dre', '55': 'bul', '26': 'bis' } for x in self.systemCod: self[x] = MultiColorLabel() for x in self.systemState: self[x] = Label() self['ecm_pict'] = Pixmap() self['TunerInfo'] = Label() self['SatInfo'] = Label() self['EmuInfo'] = Label() self['ecmtime'] = Label() self['netcard'] = Label() self['emuname'] = Label() self['hops'] = Label() self['reader'] = Label() self.path = 'piconSys' self.ecm_timer = eTimer() self.ecm_timer.timeout.get().append(self._nemesisEI__updateEmuInfo) self.ecmTimeStep = 0 self.emm_timer = eTimer() self.emm_timer.timeout.get().append(self._nemesisEI__updateEMMInfo) self._nemesisEI__evStart() self._nemesisEI__event_tracker = ServiceEventTracker(screen = self, eventmap = { iPlayableService.evStart: self._nemesisEI__evStart, iPlayableService.evUpdatedInfo: self._nemesisEI__evUpdatedInfo, iPlayableService.evTunedIn: self._nemesisEI__evTunedIn }) self.onHide.append(self._nemesisEI__onHide) self.onShow.append(self._nemesisEI__onShow)
def __init__(self, session): print "[ABMCustomMixSchedule][__init__] Starting..." self.session = session self.justBootedOrConfigChanged = True self.enableImporter = config.plugins.abmImporter.enableImporter.value self.leadTime = config.plugins.abmImporter.leadTime.value self.mix = config.plugins.abmImporter.mix.value try: self.enableSchedule = config.autobouquetsmaker.schedule.value self.clock = [config.autobouquetsmaker.scheduletime.value[0], config.autobouquetsmaker.scheduletime.value[1]] self.repeattype = config.autobouquetsmaker.repeattype.value print "[ABMCustomMixSchedule][__init__] ABM config available" except: self.enableSchedule = False self.clock = [0,0] self.repeattype = "daily" print "[ABMCustomMixSchedule][__init__] ABM config was not available" self.fetchtimer = eTimer() self.fetchtimer.callback.append(self.doSchedule) if self.enableSchedule: self.fetchtimer.startLongTimer(0) self.configtimer = eTimer() self.configtimer.callback.append(self.configChecker) self.configtimer.startLongTimer(60) assert simpleSchedule.instance is None, "[ABMCustomMixImporter] class simpleSchedule is a singleton class and just one instance of this class is allowed!" schedule.instance = self
def __init__(self, session): self.session = session self.channelsimportertimer = eTimer() self.channelsimportertimer.callback.append(self.ChannelsImporteronTimer) self.channelsimporteractivityTimer = eTimer() self.channelsimporteractivityTimer.timeout.get().append(self.channelsimporterchannelsimporterdatedelay) now = int(time()) if config.plugins.ChannelsImporter.importOnRestart.value: self.boottimer = eTimer() self.boottimer.callback.append(self.doautostartscan) print "[ChannelsImporterScheduler][AutoChannelsImporterTimer] Run plugin on boot" self.boottimer.start(100, 1) global ChannelsImporterTime if config.plugins.ChannelsImporter.enableSchedule.value: print "[ChannelsImporterScheduler][AutoChannelsImporterTimer] Schedule Enabled at ", strftime("%c", localtime(now)) if now > 1262304000: self.channelsimporterdate() else: print "[ChannelsImporterScheduler][AutoChannelsImporterTimer] Time not yet set." ChannelsImporterTime = 0 self.channelsimporteractivityTimer.start(36000) else: ChannelsImporterTime = 0 print "[ChannelsImporterScheduler][AutoChannelsImporterTimer] Schedule Disabled at", strftime("%c", localtime(now)) self.channelsimporteractivityTimer.stop() assert AutoChannelsImporterTimer.instance is None, "class AutoChannelsImporterTimer is a singleton class and just one instance of this class is allowed!" AutoChannelsImporterTimer.instance = self
def gotSession(self): self.FanState = 0 self.FOnTest = 0 self.FOffTest = 0 self.testno = 60 self.testRTCSet = 0 self.rstate = 1 self.recf = 0 self.ledstatus = 1 self.FANtimeTimer = eTimer() self.LEDtimeTimer = eTimer() self.RtimeTimer = eTimer() self.RtiminimeTimer = eTimer() self.AVptimeTimer = eTimer() f = open("/proc/stb/info/model",'r') hw_type = f.readline().strip() f.close() if hw_type in ("me", "minime"): self.LEDtimeTimer.callback.append(self.updateLED) if hw_type == "minime": self.RtiminimeTimer.callback.append(self.updateCR) elif hw_type in ('elite', 'premium', 'premium+', 'ultra'): self.LEDtimeTimer.callback.append(self.updateLEDHD) if hw_type in ('ultra', 'premium+'): self.FANtimeTimer.callback.append(self.updateFAN) self.RtimeTimer.callback.append(self.updateRT) self.AVptimeTimer.callback.append(self.updateAVp) self.LEDtimeTimer.start(12000, True) self.RtimeTimer.start(12000, True) self.FANtimeTimer.start(12000, True) self.RtiminimeTimer.start(12000, True) self.AVptimeTimer.start(12000, True)
def __evStart(self): self.switchAudioTimer = enigma.eTimer() self.switchAudioTimer.callback.append(self.switchAudio) self.switchAudioTimer.start(750, True) # 750 is a safe-value
if n.config.dvbs.configMode in ("loopthrough", "satposdepends"): root_id = nimmanager.sec.getRoot( n.slot_id, int(n.config.dvbs.connectedTo.value)) if n.type == nimmanager.nim_slots[ root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa continue nimList.append((str(n.slot), n.friendly_full_description)) if nimList: session.open(FastScanScreen, nimList) else: session.open(MessageBox, _("No suitable sat tuner found!"), MessageBox.TYPE_ERROR) Session = None FastScanAutoStartTimer = eTimer() autoproviders = [] def restartScanAutoStartTimer(reply=False): if not reply: print("[AutoFastScan] Scan was not succesfully retry in one hour") FastScanAutoStartTimer.startLongTimer(3600) elif reply is not True: global autoproviders if autoproviders: provider = autoproviders.pop(0) if provider: lastConfiguration = eval( config.misc.fastscan.last_configuration.value) lastConfiguration = (lastConfiguration[0], provider,
def __init__(self): self.timer = eTimer()
def __init__(self, session, showSteps=True, showStepSlider=True, showList=True, showConfig=True): Screen.__init__(self, session) self.isLastWizard = False # can be used to skip a "goodbye"-screen in a wizard self.stepHistory = [] self.wizard = {} parser = make_parser() if not isinstance(self.xmlfile, list): self.xmlfile = [self.xmlfile] print("[Wizard] Reading ", self.xmlfile) wizardHandler = self.parseWizard(self.wizard) parser.setContentHandler(wizardHandler) for xmlfile in self.xmlfile: if xmlfile[0] != '/': parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile) else: parser.parse(xmlfile) self.showSteps = showSteps self.showStepSlider = showStepSlider self.showList = showList self.showConfig = showConfig self.numSteps = len(self.wizard) self.currStep = self.getStepWithID("start") + 1 self.timeoutTimer = eTimer() self.timeoutTimer.callback.append(self.timeoutCounterFired) self["text"] = Label() if showConfig: self["config"] = ConfigList([], session=session) if self.showSteps: self["step"] = Label() if self.showStepSlider: self["stepslider"] = Slider(1, self.numSteps) if self.showList: self.list = [] self["list"] = List(self.list, enableWrapAround=True) self["list"].onSelectionChanged.append(self.selChanged) #self["list"] = MenuList(self.list, enableWrapAround = True) self.onShown.append(self.updateValues) self.configInstance = None self.currentConfigIndex = None Wizard.instance = self self.lcdCallbacks = [] self.disableKeys = False self["actions"] = NumberActionMap(["WizardActions", "NumberActions", "ColorActions", "SetupActions", "InputAsciiActions", "KeyboardInputActions"], { "gotAsciiCode": self.keyGotAscii, "ok": self.ok, "back": self.back, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "red": self.red, "green": self.green, "yellow": self.yellow, "blue": self.blue, "deleteBackward": self.deleteBackward, "deleteForward": self.deleteForward, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) self["VirtualKB"] = NumberActionMap(["VirtualKeyboardActions"], { "showVirtualKeyboard": self.KeyText, }, -2) self["VirtualKB"].setEnabled(False)
class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarScreenSaver, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen): ALLOW_SUSPEND = True ENABLE_RESUME_SUPPORT = True def __init__(self, session, args=None): Screen.__init__(self, session) InfoBarAudioSelection.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap="MediaPlayerCueSheetActions") InfoBarNotifications.__init__(self) InfoBarBase.__init__(self) InfoBarScreenSaver.__init__(self) InfoBarSubtitleSupport.__init__(self) HelpableScreen.__init__(self) self.summary = None self.oldService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.playlistparsers = {} self.addPlaylistParser(PlaylistIOM3U, "m3u") self.addPlaylistParser(PlaylistIOPLS, "pls") self.addPlaylistParser(PlaylistIOInternal, "e2pls") # 'None' is magic to start at the list of mountpoints defaultDir = config.mediaplayer.defaultDir.getValue() self.filelist = FileList( defaultDir, matchingPattern= "(?i)^.*\.(mp2|mp3|ogg|ts|mts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|flv|mov|dts|3gp|3g2|asf|wmv|wma)", useServiceRef=True, additionalExtensions="4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() self.is_closing = False self.delname = "" self.playlistname = "" self["playlist"] = self.playlist self["PositionGauge"] = ServicePositionGauge(self.session.nav) self["currenttext"] = Label("") self["artisttext"] = Label(_("Artist") + ':') self["artist"] = Label("") self["titletext"] = Label(_("Title") + ':') self["title"] = Label("") self["albumtext"] = Label(_("Album") + ':') self["album"] = Label("") self["yeartext"] = Label(_("Year") + ':') self["year"] = Label("") self["genretext"] = Label(_("Genre") + ':') self["genre"] = Label("") self["coverArt"] = MediaPixmap() self["repeat"] = MultiPixmap() self.seek_target = None try: from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier hotplugNotifier.append(self.hotplugCB) except Exception, ex: print "[MediaPlayer] No hotplug support", ex class MoviePlayerActionMap(NumberActionMap): def __init__(self, player, contexts=[], actions={}, prio=0): NumberActionMap.__init__(self, contexts, actions, prio) self.player = player def action(self, contexts, action): self.player.show() return NumberActionMap.action(self, contexts, action) self["OkCancelActions"] = HelpableActionMap( self, "OkCancelActions", { "ok": (self.ok, _("Add file to playlist")), "cancel": (self.exit, _("Exit mediaplayer")), }, -2) self["MediaPlayerActions"] = HelpableActionMap( self, "MediaPlayerActions", { "play": (self.xplayEntry, _("Play entry")), "pause": (self.pauseEntry, _("Pause")), "stop": (self.stopEntry, _("Stop entry")), "previous": (self.previousMarkOrEntry, _("Play from previous mark or playlist entry")), "next": (self.nextMarkOrEntry, _("Play from next mark or playlist entry")), "menu": (self.showMenu, _("Menu")), "skipListbegin": (self.skip_listbegin, _("Jump to beginning of list")), "skipListend": (self.skip_listend, _("Jump to end of list")), "prevBouquet": (self.switchLists, _("Switch between filelist/playlist")), "nextBouquet": (self.switchLists, _("Switch between filelist/playlist")), "delete": (self.deletePlaylistEntry, _("Delete playlist entry")), "shift_stop": (self.clear_playlist, _("Clear playlist")), "shift_record": (self.playlist.PlayListShuffle, _("Shuffle playlist")), "subtitles": (self.subtitleSelection, _("Subtitle selection")), }, -2) self["InfobarEPGActions"] = HelpableActionMap( self, "InfobarEPGActions", { "showEventInfo": (self.showEventInformation, _("show event details")), }) self["actions"] = MoviePlayerActionMap( self, ["DirectionActions"], { "right": self.rightDown, "rightRepeated": self.doNothing, "rightUp": self.rightUp, "left": self.leftDown, "leftRepeated": self.doNothing, "leftUp": self.leftUp, "up": self.up, "upRepeated": self.up, "upUp": self.doNothing, "down": self.down, "downRepeated": self.down, "downUp": self.doNothing, }, -2) InfoBarSeek.__init__(self, actionmap="MediaPlayerSeekActions") self.onClose.append(self.delMPTimer) self.onClose.append(self.__onClose) self.righttimer = False self.rightKeyTimer = eTimer() self.rightKeyTimer.callback.append(self.rightTimerFire) self.lefttimer = False self.leftKeyTimer = eTimer() self.leftKeyTimer.callback.append(self.leftTimerFire) self.currList = "filelist" self.isAudioCD = False self.AudioCD_albuminfo = {} self.cdAudioTrackFiles = [] self.onShown.append(self.applySettings) self.playlistIOInternal = PlaylistIOInternal() list = self.playlistIOInternal.open( resolveFilename(SCOPE_CONFIG, "playlist.e2pls")) if list: for x in list: self.playlist.addFile(x.ref) self.playlist.updateList() self.__event_tracker = ServiceEventTracker( screen=self, eventmap={ iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, iPlayableService.evUser + 10: self.__evAudioDecodeError, iPlayableService.evUser + 11: self.__evVideoDecodeError, iPlayableService.evUser + 12: self.__evPluginError, iPlayableService.evUser + 13: self["coverArt"].embeddedCoverArt })
def __init__(self, session, infobar): Screen.__init__(self, session) self.skin = QuickSubtitlesConfigMenu.skin self.infobar = infobar or self.session.infobar self.wait = eTimer() self.wait.timeout.get().append(self.resyncSubtitles) self.service = self.session.nav.getCurrentlyPlayingServiceReference() servicepath = self.service and self.service.getPath() if servicepath and servicepath.startswith("/") and self.service.toString().startswith("1:"): info = eServiceCenter.getInstance().info(self.service) self.service_string = info and info.getInfoString(self.service, iServiceInformation.sServiceref) else: self.service_string = self.service.toString() self.center_dvb_subs = ConfigYesNo(default = (eDVBDB.getInstance().getFlag(eServiceReference(self.service_string)) & self.FLAG_CENTER_DVB_SUBS) and True) self.center_dvb_subs.addNotifier(self.setCenterDvbSubs) self["videofps"] = Label("") sub = self.infobar.selected_subtitle if sub[0] == 0: # dvb menu = [ getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"), getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"), getConfigMenuItem("config.subtitles.dvb_subtitles_original_position"), (_("Center DVB subtitles"), self.center_dvb_subs), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"), ] elif sub[0] == 1: # teletext menu = [ getConfigMenuItem("config.subtitles.ttx_subtitle_colors"), getConfigMenuItem("config.subtitles.ttx_subtitle_original_position"), getConfigMenuItem("config.subtitles.ttx_subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.showbackground"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem("config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem("config.subtitles.subtitle_noPTSrecordingdelay"), ] else: # pango menu = [ getConfigMenuItem("config.subtitles.pango_subtitles_delay"), getConfigMenuItem("config.subtitles.pango_subtitle_colors"), getConfigMenuItem("config.subtitles.pango_subtitle_fontswitch"), getConfigMenuItem("config.subtitles.colourise_dialogs"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.pango_subtitle_removehi"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.showbackground"), getConfigMenuItem("config.subtitles.pango_subtitles_fps"), ] self["videofps"].setText(_("Video: %s fps") % (self.getFps().rstrip(".000"))) ConfigListScreen.__init__(self, menu, self.session, on_change = self.changedEntry) self["actions"] = NumberActionMap(["SetupActions"], { "cancel": self.cancel, "ok": self.ok, },-2) self.onLayoutFinish.append(self.layoutFinished)
def callLater(self, function): self.__callLaterTimer = eTimer() self.__callLaterTimer.callback.append(function) self.__callLaterTimer.start(0, True)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" if os.path.exists("/usr/script/Standby.sh"): Console().ePopen("/usr/script/Standby.sh off") if os.path.exists("/usr/script/standby_enter.sh"): Console().ePopen("/usr/script/standby_enter.sh") self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar from Screens.SleepTimerEdit import isNextWakeupTime self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.standbyWakeupTimer = eTimer() self.standbyWakeupTimer.callback.append(self.standbyWakeup) self.timeHandler = None self.setMute() # set LCDminiTV off if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: setLCDModeMinitTV("0") self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if Components.ParentalControl.parentalControl.isProtected(self.prev_running_service): self.prev_running_service = eServiceReference(config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr(self.session.current_dialog, "pauseService") and hasattr(self.session.current_dialog, "unPauseService") and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr(self.paused_service, "seekstate") and hasattr(self.paused_service, "SEEK_STATE_PLAY") and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) gotoWakeupTime = isNextWakeupTime(True) if gotoWakeupTime != -1: curtime = localtime(time()) if curtime.tm_year > 1970: wakeup_time = int(gotoWakeupTime - time()) if wakeup_time > 0: self.standbyWakeupTimer.startLongTimer(wakeup_time) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session): Screen.__init__(self, session) HelpableScreen.__init__(self) self["key_menu"] = StaticText(_("MENU")) self["key_info"] = StaticText(_("INFO")) self["key_red"] = StaticText() self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["icons"] = MultiPixmap() self["icons"].hide() self["locales"] = List(None, enableWrapAround=True) self["locales"].onSelectionChanged.append(self.selectionChanged) self["description"] = StaticText() self["selectionActions"] = HelpableActionMap( self, "LocaleSelectionActions", { "menu": (self.keySettings, _("Manage Locale/Language Selection settings")), "current": (self.keyCurrent, _("Jump to the currently active locale/language")), "select": (self.keySelect, _("Select the currently highlighted locale/language for the user interface" )), "close": (self.closeRecursive, _("Cancel any changes the active locale/language and exit all menus" )), "cancel": (self.keyCancel, _("Cancel any changes to the active locale/language and exit") ), "save": (self.keySave, _("Apply any changes to the active locale/language and exit")) }, prio=0, description=_("Locale/Language Selection Actions")) self["manageActions"] = HelpableActionMap( self, "LocaleSelectionActions", { "manage": (self.keyManage, (_("Purge all but / Add / Delete the currently highlighted locale/language" ), _("Purge all but the current and permanent locales/languages. Add the current locale/language if it is not installed. Delete the current locale/language if it is installed." ))) }, prio=0, description=_("Locale/Language Selection Actions")) topItem = _("Move up to first line") topDesc = _("Move up to the first line in the list.") pageUpItem = _("Move up one screen") pageUpDesc = _( "Move up one screen. Move to the first line of the screen if this is the first screen." ) upItem = _("Move up one line") upDesc = _( "Move up one line. Move to the bottom of the previous screen if this is the first line of the screen. Move to the last of the entry / list if this is the first line of the list." ) downItem = _("Move down one line") downDesc = _( "Move down one line. Move to the top of the next screen if this is the last line of the screen. Move to the first line of the list if this is the last line on the list." ) pageDownItem = _("Move down one screen") pageDownDesc = _( "Move down one screen. Move to the last line of the screen if this is the last screen." ) bottomItem = _("Move down to last line") bottomDesc = _("Move down to the last line in the list.") self["navigationActions"] = HelpableActionMap( self, "NavigationActions", { "top": (self.keyTop, (topItem, topDesc)), "pageUp": (self.keyPageUp, (pageUpItem, pageUpDesc)), "up": (self.keyUp, (upItem, upDesc)), "first": (self.keyTop, (topItem, topDesc)), "left": (self.keyPageUp, (pageUpItem, pageUpDesc)), "right": (self.keyPageDown, (pageDownItem, pageDownDesc)), "last": (self.keyBottom, (bottomItem, bottomDesc)), "down": (self.keyDown, (downItem, downDesc)), "pageDown": (self.keyPageDown, (pageDownItem, pageDownDesc)), "bottom": (self.keyBottom, (bottomItem, bottomDesc)) }, prio=0, description=_("List Navigation Actions")) self.initialLocale = international.getLocale() self.currentLocale = self.initialLocale self.packageTimer = eTimer() self.packageTimer.callback.append(self.processPackage) self.packageDoneTimer = eTimer() self.packageDoneTimer.callback.append(self.processPackageDone) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): self.skin = ServicesEditor.skin Screen.__init__(self, session) self.usk = None self.cur_service = None self.mainTitle = "ServicesEditor %s" %self.version self["actions"] = ActionMap(["ServicesEditorActions"], { "nextPage" : self.nextPage, "nextPageUp" : self.selectionKeyUp, "nextPageRepeated" : self.nextPageRepeated, "prevPage" : self.prevPage, "prevPageUp" : self.selectionKeyUp, "prevPageRepeated" : self.prevPageRepeated, "displayHelp" : self.showHelp, "displayMenu" : self.openMenu, "displayInfo" : self.showServiceInfo, "select" : self.editService, "exit" : self.Exit, "left" : self.left, "leftUp" : self.doNothing, "leftRepeated" : self.doNothing, "right" : self.right, "rightUp" : self.doNothing, "rightRepeated" : self.doNothing, "upUp" : self.selectionKeyUp, "up" : self.up, "upRepeated" : self.upRepeated, "down" : self.down, "downUp" : self.selectionKeyUp, "downRepeated" : self.downRepeated, "redUp" : self.hideService, "redLong" : self.hideServiceMenu, "green" : self.editService, "yellow" : self.addService, "blue" : self.sortColumn, },-1) self["key_red"] = Button(_("hide/unhide")) self["key_green"] = Button(_("edit")) self["key_yellow"] = Button(_(" ")) self["key_blue"] = Button(_("sort")) self["infolist"] = MenuList([]) self["infolist"].l = eListboxPythonMultiContent() self["infolist"].l.setSelectionClip(eRect(0,0,0,0)) self["infolist"].l.setItemHeight(24); self["infolist"].l.setFont(0, gFont("Regular", 20)) self["newscaster"] = Newscaster() self["head"] = Head() self["list"] = ServiceList() self.onLayoutFinish.append(self.layoutFinished) self.currentSelectedColumn = 1 self.row = [ ["name", _("Services"), False], ["provider", _("Providers"), False], ["position", _("Pos"), False], ] self.typesort = False self.myTimer = eTimer() db = eDVBDB.getInstance() db.saveServicelist() self.lamedb = Lamedb() self.database = self.lamedb.database self._initFlag = False self.gpsr = session.nav.getCurrentlyPlayingServiceReference().toString().lower() print_cy(self.gpsr) tmp = self.gpsr.split(":") if tmp[0]=="1" and tmp[1]=="0" and tmp[10]=="": self.usk = tmp[6].zfill(8)+tmp[4].zfill(4)+tmp[5].zfill(4)+tmp[3].zfill(4) print_cy(self.usk)
def prepare(self): from enigma import eTimer self.timer = eTimer() self.timer.callback.append(self.trigger) self.timer.start(1000)
def __init__(self): Renderer.__init__(self) self.piconsize = (0, 0) self.delayPicTime = 100 self.timer = eTimer() self.timer.callback.append(self.showPicture)
def delay(self): self.timer = eTimer() self.timer.callback.append(self.infos) self.timer.start(100, True)
def __init__(self, session, slotid, action, handler=eDVBCI_UI.getInstance(), wait_text="", screen_data=None): Screen.__init__(self, session) print "[CI] with action" + str(action) self.mmiclosed = False self.tag = None self.slotid = slotid self.timer = eTimer() self.timer.callback.append(self.keyCancel) #else the skins fails self["title"] = Label("") self["subtitle"] = Label("") self["bottom"] = Label("") self["entries"] = ConfigList([]) self["actions"] = NumberActionMap( ["SetupActions", "MenuActions"], { "ok": self.okbuttonClick, "cancel": self.keyCancel, "menu": self.forceExit, #for PIN "left": self.keyLeft, "right": self.keyRight, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) self.action = action self.screen_data = screen_data self.is_pin_list = -1 self.handler = handler if wait_text == "": self.wait_text = _("wait for ci...") else: self.wait_text = wait_text if action == 2: #start MMI handler.startMMI(self.slotid) self.showWait() elif action == 3: #mmi already there (called from infobar) self.showScreen()
def __init__(self, session, piclist, lastindex, path): self.textcolor = config.pic.textcolor.value self.color = config.pic.bgcolor.value tlf = TemplatedListFonts() self._labelFontSize = tlf.size(tlf.SMALLER) self._labelFontFace = tlf.face(tlf.SMALLER) sizes = componentSizes[Pic_Thumb.SKIN_COMPONENT_KEY] self._descSize = sizes.get(Pic_Thumb.SKIN_COMPONENT_DESCRIPTION_SIZE, 35) self._margin = sizes.get(Pic_Thumb.SKIN_COMPONENT_MARGIN, 10) self._spaceX = sizes.get(Pic_Thumb.SKIN_COMPONENT_SPACE_X, 55) self._spaceY = sizes.get(Pic_Thumb.SKIN_COMPONENT_SPACE_Y, 30) self._thumbX = sizes.get(Pic_Thumb.SKIN_COMPONENT_THUMP_X, 190) self._thumbY = sizes.get(Pic_Thumb.SKIN_COMPONENT_THUMP_Y, 200) size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() self.thumbsX = size_w / (self._spaceX + self._thumbX) # thumbnails in X self.thumbsY = size_h / (self._spaceY + self._thumbY) # thumbnails in Y self.thumbsC = self.thumbsX * self.thumbsY # all thumbnails self.positionlist = [] skincontent = "" posX = -1 for x in range(self.thumbsC): posY = x / self.thumbsX posX += 1 if posX >= self.thumbsX: posX = 0 absX = self._spaceX + (posX * (self._spaceX + self._thumbX)) absY = self._spaceY + (posY * (self._spaceY + self._thumbY)) self.positionlist.append((absX, absY)) absX += self._margin absY += self._margin skincontent += '<widget source="label%s" render="Label" position="%s,%s" size="%s,%s" font="%s;%s" valign="top" halign="center" zPosition="2" transparent="1" foregroundColor="%s"/>' % (x, absX, absY + self._thumbY - self._descSize, self._thumbX, self._descSize, self._labelFontFace, self._labelFontSize, self.textcolor) skincontent += '<widget name="thumb%s" position="%s,%s" size="%s,%s" zPosition="2" transparent="1" />' % (x, absX, absY, self._thumbX, self._thumbY - self._descSize - self._margin) # Screen, backgroundlabel and MovingPixmap doubleMargin = self._margin * 2 self.skin = """<screen position="0,0" size="{0},{1}" flags="wfNoBorder" > <eLabel position="0,0" zPosition="0" size="{0},{1}" backgroundColor="{2}" /> \ <widget name="frame" position="35,30" size="{3},{4}" pixmap="pic_frame.png" zPosition="1" alphatest="on" />{5}</screen>""".format(size_w, size_h, self.color, self._thumbX + doubleMargin, self._thumbY + doubleMargin, skincontent) Screen.__init__(self, session) self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions"], { "cancel": self.Exit, "ok": self.KeyOk, "left": self.key_left, "right": self.key_right, "up": self.key_up, "down": self.key_down, "showEventInfo": self.StartExif, }, -1) self["frame"] = MovingPixmap() for x in range(self.thumbsC): self["label"+str(x)] = StaticText() self["thumb"+str(x)] = Pixmap() self.Thumbnaillist = [] self.filelist = [] self.currPage = -1 self.dirlistcount = 0 self.path = path index = 0 framePos = 0 Page = 0 for x in piclist: if x[0][1] == False: self.filelist.append((index, framePos, Page, x[0][0], path + x[0][0])) index += 1 framePos += 1 if framePos > (self.thumbsC -1): framePos = 0 Page += 1 else: self.dirlistcount += 1 self.maxentry = len(self.filelist)-1 self.index = lastindex - self.dirlistcount if self.index < 0: self.index = 0 self.picload = ePicLoad() self.picload_conn = self.picload.PictureData.connect(self.showPic) self.onLayoutFinish.append(self.setPicloadConf) self.ThumbTimer = eTimer() self.ThumbTimer_conn = self.ThumbTimer.timeout.connect(self.showPic)
def getFrontend(self): print "[TerrestrialScan][getFrontend] searching for available tuner" nimList = [] if self.selectedNIM < 0: # automatic tuner selection for nim in nimmanager.nim_slots: if self.config_mode(nim) not in ( "nothing", ) and (nim.isCompatible("DVB-T2") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T2"))): nimList.append(nim.slot) self.isT2tuner = True if len(nimList) == 0: print "[TerrestrialScan][getFrontend] No T2 tuner found" for nim in nimmanager.nim_slots: if self.config_mode(nim) not in ("nothing", ) and ( nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))): nimList.append(nim.slot) if len(nimList) == 0: print "[TerrestrialScan][getFrontend] No terrestrial tuner found" self.showError(_('No terrestrial tuner found')) return else: # manual tuner selection, and subsequent iterations nim = nimmanager.nim_slots[self.selectedNIM] if self.config_mode(nim) not in ("nothing", ) and ( nim.isCompatible("DVB-T2") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T2"))): nimList.append(nim.slot) self.isT2tuner = True if len(nimList) == 0: print "[TerrestrialScan][getFrontend] User selected tuner is not T2 compatible" if self.config_mode(nim) not in ( "nothing", ) and (nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))): nimList.append(nim.slot) if len(nimList) == 0: print "[TerrestrialScan][getFrontend] User selected tuner not configured" self.showError(_('Selected tuner is not cofigured')) return if len(nimList) == 0: print "[TerrestrialScan][getFrontend] No terrestrial tuner found" self.showError(_('No terrestrial tuner found')) return resmanager = eDVBResourceManager.getInstance() if not resmanager: print "[TerrestrialScan][getFrontend] Cannot retrieve Resource Manager instance" self.showError(_('Cannot retrieve Resource Manager instance')) return if self.selectedNIM < 0: # automatic tuner selection print "[TerrestrialScan][getFrontend] Choosing NIM" # stop pip if running if self.session.pipshown: self.session.pipshown = False del self.session.pip print "[TerrestrialScan][getFrontend] Stopping PIP." # Find currently playin NIM currentlyPlayingNIM = None currentService = self.session and self.session.nav.getCurrentService() frontendInfo = currentService and currentService.frontendInfo() frontendData = frontendInfo and frontendInfo.getAll(True) if frontendData is not None: currentlyPlayingNIM = frontendData.get("tuner_number", None) del frontendInfo del currentService current_slotid = -1 if self.rawchannel: del (self.rawchannel) self.frontend = None self.rawchannel = None nimList.reverse() # start from the last for slotid in nimList: if current_slotid == -1: # mark the first valid slotid in case of no other one is free current_slotid = slotid self.rawchannel = resmanager.allocateRawChannel(slotid) if self.rawchannel: print "[TerrestrialScan][getFrontend] Nim found on slot id %d" % ( slotid) current_slotid = slotid break if current_slotid == -1: print "[TerrestrialScan][getFrontend] No valid NIM found" self.showError(_('No valid NIM found for terrestrial')) return if not self.rawchannel: # if we are here the only possible option is to close the active service if currentlyPlayingNIM in nimList: slotid = currentlyPlayingNIM print "[TerrestrialScan][getFrontend] Nim found on slot id %d but it's busy. Stopping active service" % slotid self.session.postScanService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.rawchannel = resmanager.allocateRawChannel(slotid) if self.rawchannel: print "[TerrestrialScan][getFrontend] The active service was stopped, and the NIM is now free to use." current_slotid = slotid if not self.rawchannel: if self.session.nav.RecordTimer.isRecording(): print "[TerrestrialScan][getFrontend] Cannot free NIM because a recording is in progress" self.showError( _('Cannot free NIM because a recording is in progress') ) return else: print "[TerrestrialScan][getFrontend] Cannot get the NIM" self.showError(_('Cannot get the NIM')) return print "[TerrestrialScan][getFrontend] Will wait up to %i seconds for tuner lock." % ( self.lockTimeout / 10) self.selectedNIM = current_slotid # Remember for next iteration self["tuner_text"].setText(chr(ord('A') + current_slotid)) self.frontend = self.rawchannel.getFrontend() if not self.frontend: print "[TerrestrialScan][getFrontend] Cannot get frontend" self.showError(_('Cannot get frontend')) return self.rawchannel.requestTsidOnid() self.tsid = None self.onid = None self.demuxer_id = self.rawchannel.reserveDemux() if self.demuxer_id < 0: print "[TerrestrialScan][getFrontend] Cannot allocate the demuxer" self.showError(_('Cannot allocate the demuxer')) return self.frontend.tune( setParamsFe(setParams(self.frequency, self.system, self.bandwidth))) self.lockcounter = 0 self.locktimer = eTimer() self.locktimer.callback.append(self.checkTunerLock) self.locktimer.start(100, 1)
def go(self): from Screens.Standby import inStandby self.manager = Manager() self.manager.setPath("/etc/enigma2") self.manager.setAddPrefix(config.autobouquetsmaker.addprefix.value) self.selectedProviders = {} self.actionsList = [] providers_tmp = self.abm_settings_str.split("|") for provider_tmp in providers_tmp: provider_config = ProviderConfig(provider_tmp) if provider_config.isValid() and Providers().providerFileExists( provider_config.getProvider()): self.actionsList.append(provider_config.getProvider()) self.selectedProviders[ provider_config.getProvider()] = provider_config if config.autobouquetsmaker.keepallbouquets.getValue(): bouquets = Manager().getBouquetsList() bouquets_tv = [] bouquets_radio = [] for bouquet in bouquets["tv"]: if bouquet["filename"][:len(self.ABM_BOUQUET_PREFIX )] == self.ABM_BOUQUET_PREFIX: continue if len(bouquet["filename"]) > 0: bouquets_tv.append(bouquet["filename"]) for bouquet in bouquets["radio"]: if bouquet["filename"][:len(self.ABM_BOUQUET_PREFIX )] == self.ABM_BOUQUET_PREFIX: continue if len(bouquet["filename"]) > 0: bouquets_radio.append(bouquet["filename"]) self.manager.setBouquetsToKeep(bouquets_tv, bouquets_radio) else: bouquets = config.autobouquetsmaker.keepbouquets.value.split("|") bouquets_tv = [] bouquets_radio = [] for bouquet in bouquets: if bouquet.endswith(".tv"): bouquets_tv.append(bouquet) elif bouquet.endswith(".radio"): bouquets_radio.append(bouquet) self.manager.setBouquetsToKeep(bouquets_tv, bouquets_radio) bouquetsToHide = {} bouquets = config.autobouquetsmaker.hidesections.value.split("|") for bouquet in bouquets: tmp = bouquet.split(":") if len(tmp) != 2: continue if tmp[0].strip() not in bouquetsToHide: bouquetsToHide[tmp[0].strip()] = [] bouquetsToHide[tmp[0].strip()].append(int(tmp[1].strip())) self.manager.setBouquetsToHide(bouquetsToHide) self.manager.load() self.progresscount = (len(self.actionsList) * 2) + 3 self.progresscurrent = 1 if not inStandby: self["progress_text"].range = self.progresscount self["progress_text"].value = self.progresscurrent self["progress"].setRange((0, self.progresscount)) self["progress"].setValue(self.progresscurrent) self.timer = eTimer() self.timer.callback.append(self.doActions) self.timer.start(100, 1)
def __init__(self, session, text="", filename="", currDir=None, bookmarks=None, userMode=False, windowTitle="Select location", minFree=None, autoAdd=False, editDir=False, inhibitDirs=[], inhibitMounts=[]): # Init parents Screen.__init__(self, session) NumericalTextInput.__init__(self, handleTimeout=False) HelpableScreen.__init__(self) # Set useable chars self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') # Quickselect Timer self.qs_timer = eTimer() self.qs_timer.callback.append(self.timeout) self.qs_timer_type = 0 # Initialize Quickselect self.curr_pos = -1 self.quickselect = "" # Set Text self["text"] = Label(text) self["textbook"] = Label(_("Bookmarks")) # Save parameters locally self.text = text self.filename = filename self.minFree = minFree self.realBookmarks = bookmarks self.bookmarks = bookmarks and bookmarks.value[:] or [] self.userMode = userMode self.autoAdd = autoAdd self.editDir = editDir self.inhibitDirs = inhibitDirs # Initialize FileList self["filelist"] = FileList(currDir, showDirectories=True, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs) # Initialize BookList self["booklist"] = MenuList(self.bookmarks) # Buttons self["key_green"] = Button(_("OK")) self["key_yellow"] = Button(_("Rename")) self["key_blue"] = Button(_("Remove bookmark")) self["key_red"] = Button(_("Cancel")) self["key_ch"] = Label(_("Change list")) # Background for Buttons self["green"] = Pixmap() self["yellow"] = Pixmap() self["blue"] = Pixmap() self["red"] = Pixmap() # Initialize Target self["target"] = Label() if self.userMode: self.usermodeOn() # Custom Action Handler class LocationBoxActionMap(HelpableActionMap): def __init__(self, parent, context, actions={}, prio=0): HelpableActionMap.__init__(self, parent, context, actions, prio) self.box = parent def action(self, contexts, action): # Reset Quickselect self.box.timeout(force=True) return HelpableActionMap.action(self, contexts, action) # Actions that will reset quickselect self["WizardActions"] = LocationBoxActionMap( self, "WizardActions", { "left": self.left, "right": self.right, "up": self.up, "down": self.down, "ok": (self.ok, _("select")), "back": (self.cancel, _("Cancel")), }, -2) self["ColorActions"] = LocationBoxActionMap( self, "ColorActions", { "red": self.cancel, "green": self.select, "yellow": self.changeName, "blue": self.addRemoveBookmark, }, -2) self["EPGSelectActions"] = LocationBoxActionMap( self, "EPGSelectActions", { "prevBouquet": (self.switchToBookList, _("switch to bookmarks")), "nextBouquet": (self.switchToFileList, _("switch to filelist")), }, -2) self["MenuActions"] = LocationBoxActionMap(self, "MenuActions", { "menu": (self.showMenu, _("menu")), }, -2) # Actions used by quickselect self["NumberActions"] = NumberActionMap( ["NumberActions"], { "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }) # Run some functions when shown self.onShown.extend(( boundFunction(self.setTitle, _(windowTitle)), self.updateTarget, self.showHideRename, )) self.onLayoutFinish.append(self.switchToFileListOnStart) # Make sure we remove our callback self.onClose.append(self.disableTimer)
def __init__(self): Renderer.__init__(self) self.vol_timer = eTimer() self.vol_timer.callback.append(self.pollme)
def doTune(self): print >> log, "[ABM-main][doTune] searching for tuner for %s" % self.providers[ self.currentAction]["name"] from Screens.Standby import inStandby if self.providers[self.currentAction]["streamtype"] == "dvbs": transponder = self.providers[self.currentAction]["transponder"] else: bouquet_key = None providers_tmp = self.abm_settings_str.split("|") for provider_tmp in providers_tmp: provider_config = ProviderConfig(provider_tmp) provider_key = provider_config.getProvider() if self.currentAction != provider_key: continue bouquet_key = provider_config.getArea() if not bouquet_key: print >> log, "[ABM-main][doTune] No area found" self.showError(_('No area found')) return transponder = self.providers[ self.currentAction]["bouquets"][bouquet_key] nimList = [] for nim in nimmanager.nim_slots: if self.providers[self.currentAction][ "streamtype"] == "dvbs" and nim.isCompatible("DVB-S"): try: if nim.isFBCTuner() and not nim.isFBCRoot(): continue # do not load FBC links, only root tuners except: pass try: # OpenPLi Hot Switch compatible image if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \ {"dvbs": "DVB-S", "dvbc": "DVB-C", "dvbt": "DVB-T"}.get(self.providers[self.currentAction]["streamtype"], "UNKNOWN") in [x[:5] for x in nim.getTunerTypesEnabled()]: nimList.append(nim.slot) except AttributeError: try: if (nim.config_mode not in ("loopthrough", "satposdepends", "nothing")) and \ ((self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.isCompatible("DVB-S")) or \ (self.providers[self.currentAction]["streamtype"] == "dvbc" and (nim.isCompatible("DVB-C") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-C")))) or \ (self.providers[self.currentAction]["streamtype"] == "dvbt" and (nim.isCompatible("DVB-T") or (nim.isCompatible("DVB-S") and nim.canBeCompatible("DVB-T"))))): nimList.append(nim.slot) except AttributeError: # OpenATV > 5.3 if (self.providers[self.currentAction]["streamtype"] == "dvbs" and nim.canBeCompatible("DVB-S") and nim.config_mode_dvbs not in ("loopthrough", "satposdepends", "nothing")) or \ (self.providers[self.currentAction]["streamtype"] == "dvbc" and nim.canBeCompatible("DVB-C") and nim.config_mode_dvbc != "nothing") or \ (self.providers[self.currentAction]["streamtype"] == "dvbt" and nim.canBeCompatible("DVB-T") and nim.config_mode_dvbt != "nothing"): nimList.append(nim.slot) if len(nimList) == 0: print >> log, "[ABM-main][doTune] No NIMs found" self.showError( _('No NIMs found for ') + self.providers[self.currentAction]["name"]) return resmanager = eDVBResourceManager.getInstance() if not resmanager: print >> log, "[ABM-main][doTune] Cannot retrieve Resource Manager instance" self.showError(_('Cannot retrieve Resource Manager instance')) return if self.providers[self.currentAction]["streamtype"] == "dvbs": print >> log, "[ABM-main][doTune] Search NIM for orbital position %d" % transponder[ "orbital_position"] else: print >> log, "[ABM-main][doTune] Search NIM" # stop pip if running if self.session.pipshown: self.session.pipshown = False del self.session.pip print >> log, "[ABM-main][doTune] Stopping PIP." # stop currently playing service if it is using a tuner in ("loopthrough", "satposdepends") currentlyPlayingNIM = None currentService = self.session and self.session.nav.getCurrentService() frontendInfo = currentService and currentService.frontendInfo() frontendData = frontendInfo and frontendInfo.getAll(True) if frontendData is not None: currentlyPlayingNIM = frontendData.get("tuner_number", None) if self.providers[self.currentAction][ "streamtype"] == "dvbs" and currentlyPlayingNIM is not None and nimmanager.nim_slots[ currentlyPlayingNIM].isCompatible("DVB-S"): try: nimConfigMode = nimmanager.nim_slots[ currentlyPlayingNIM].config_mode except AttributeError: # OpenATV > 5.3 nimConfigMode = nimmanager.nim_slots[ currentlyPlayingNIM].config_mode_dvbs if nimConfigMode in ("loopthrough", "satposdepends"): self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() currentlyPlayingNIM = None print >> log, "[ABM-main][doTune] The active service was using a %s tuner, so had to be stopped (slot id %s)." % ( nimConfigMode, currentlyPlayingNIM) del frontendInfo del currentService current_slotid = -1 self.releaseFrontend() nimList.reverse() # start from the last for slotid in nimList: if self.providers[self.currentAction]["streamtype"] == "dvbs": sats = nimmanager.getSatListForNim(slotid) for sat in sats: if sat[0] == transponder["orbital_position"]: if current_slotid == -1: # mark the first valid slotid in case of no other one is free current_slotid = slotid self.rawchannel = resmanager.allocateRawChannel(slotid) if self.rawchannel: print >> log, "[ABM-main][doTune] Nim found on slot id %d with sat %s" % ( slotid, sat[1]) current_slotid = slotid break else: if current_slotid == -1: # mark the first valid slotid in case of no other one is free current_slotid = slotid self.rawchannel = resmanager.allocateRawChannel(slotid) if self.rawchannel: print >> log, "[ABM-main][doTune] Nim found on slot id %d" % ( slotid) current_slotid = slotid break if self.rawchannel: break if current_slotid == -1: print >> log, "[ABM-main][doTune] No valid NIM found" self.showError( _('No valid NIM found for ') + self.providers[self.currentAction]["name"]) return if not self.rawchannel: # if we are here the only possible option is to close the active service if currentlyPlayingNIM in nimList: slotid = currentlyPlayingNIM if self.providers[self.currentAction]["streamtype"] == "dvbs": sats = nimmanager.getSatListForNim(slotid) for sat in sats: if sat[0] == transponder["orbital_position"]: print >> log, "[ABM-main][doTune] Nim found on slot id %d but it's busy. Stopping active service" % slotid self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.rawchannel = resmanager.allocateRawChannel( slotid) if self.rawchannel: print >> log, "[ABM-main][doTune] The active service was stopped, and the NIM is now free to use." current_slotid = slotid break else: print >> log, "[ABM-main][doTune] Nim found on slot id %d but it's busy. Stopping active service" % slotid self.postScanService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.session.nav.stopService() self.rawchannel = resmanager.allocateRawChannel(slotid) if self.rawchannel: print >> log, "[ABM-main][doTune] The active service was stopped, and the NIM is now free to use." current_slotid = slotid if not self.rawchannel: if self.session.nav.RecordTimer.isRecording(): print >> log, "[ABM-main][doTune] Cannot free NIM because a recording is in progress" self.showError( _('Cannot free NIM because a recording is in progress') ) return else: print >> log, "[ABM-main][doTune] Cannot get the NIM" self.showError(_('Cannot get the NIM')) return # set extended timeout for rotors self.motorised = False if self.providers[self.currentAction][ "streamtype"] == "dvbs" and self.isRotorSat( current_slotid, transponder["orbital_position"]): self.motorised = True self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_ROTOR print >> log, "[ABM-main][doTune] Motorised dish. Will wait up to %i seconds for tuner lock." % ( self.LOCK_TIMEOUT / 10) else: self.LOCK_TIMEOUT = self.LOCK_TIMEOUT_FIXED print >> log, "[ABM-main][doTune] Fixed dish. Will wait up to %i seconds for tuner lock." % ( self.LOCK_TIMEOUT / 10) if not inStandby: self["tuner_text"].setText(chr(ord('A') + current_slotid)) self.frontend = self.rawchannel.getFrontend() if not self.frontend: print >> log, "[ABM-main][doTune] Cannot get frontend" self.showError(_('Cannot get frontend')) return demuxer_id = self.rawchannel.reserveDemux() if demuxer_id < 0: print >> log, "[ABM-main][doTune] Cannot allocate the demuxer." self.showError(_('Cannot allocate the demuxer.')) return if self.providers[self.currentAction]["streamtype"] == "dvbs": params = eDVBFrontendParametersSatellite() params.frequency = transponder["frequency"] params.symbol_rate = transponder["symbol_rate"] params.polarisation = transponder["polarization"] params.fec = transponder["fec_inner"] params.inversion = transponder["inversion"] params.orbital_position = transponder["orbital_position"] params.system = transponder["system"] params.modulation = transponder["modulation"] params.rolloff = transponder["roll_off"] params.pilot = transponder["pilot"] if hasattr(eDVBFrontendParametersSatellite, "No_Stream_Id_Filter"): params.is_id = eDVBFrontendParametersSatellite.No_Stream_Id_Filter if hasattr(eDVBFrontendParametersSatellite, "PLS_Gold"): params.pls_mode = eDVBFrontendParametersSatellite.PLS_Gold if hasattr(eDVBFrontendParametersSatellite, "PLS_Default_Gold_Code"): params.pls_code = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code if hasattr(eDVBFrontendParametersSatellite, "No_T2MI_PLP_Id"): params.t2mi_plp_id = eDVBFrontendParametersSatellite.No_T2MI_PLP_Id if hasattr(eDVBFrontendParametersSatellite, "T2MI_Default_Pid"): params.t2mi_pid = eDVBFrontendParametersSatellite.T2MI_Default_Pid params_fe = eDVBFrontendParameters() params_fe.setDVBS(params, False) elif self.providers[self.currentAction]["streamtype"] == "dvbt": params = eDVBFrontendParametersTerrestrial() params.frequency = transponder["frequency"] params.bandwidth = transponder["bandwidth"] params.code_rate_hp = transponder["code_rate_hp"] params.code_rate_lp = transponder["code_rate_lp"] params.inversion = transponder["inversion"] params.system = transponder["system"] params.modulation = transponder["modulation"] params.transmission_mode = transponder["transmission_mode"] params.guard_interval = transponder["guard_interval"] params.hierarchy = transponder["hierarchy"] params_fe = eDVBFrontendParameters() params_fe.setDVBT(params) elif self.providers[self.currentAction]["streamtype"] == "dvbc": params = eDVBFrontendParametersCable() params.frequency = transponder["frequency"] params.symbol_rate = transponder["symbol_rate"] params.fec_inner = transponder["fec_inner"] params.inversion = transponder["inversion"] params.modulation = transponder["modulation"] params_fe = eDVBFrontendParameters() params_fe.setDVBC(params) try: self.rawchannel.requestTsidOnid() except (TypeError): # for compatibility with some third party images self.rawchannel.requestTsidOnid(self.gotTsidOnid) self.frontend.tune(params_fe) self.manager.setAdapter(0) # FIX: use the correct device self.manager.setDemuxer(demuxer_id) self.manager.setFrontend(current_slotid) self.current_slotid = current_slotid self.lockcounter = 0 self.locktimer = eTimer() self.locktimer.callback.append(self.checkTunerLock) self.locktimer.start(100, 1)
def wakeupCheck(self, runCheck=True): now = time() stbytimer = 15 # original was 15 if runCheck and ( (self.__wasTimerWakeup or config.workaround.deeprecord.value) and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus): if self.syncCount > 0: stbytimer = stbytimer - (self.syncCount * 5) if stbytimer < 0: stbytimer = 0 if not self.__wasTimerWakeup: self.__wasTimerWakeup = True print "-" * 100 print "[NAVIGATION] was timer wakeup after time sync is = True" print "[NAVIGATION] wakeup time was %s" % ctime( self.wakeuptime) print "[NAVIGATION] wakeup type is '%s' %s" % ( { 0: "record-timer", 1: "zap-timer", 2: "power-timer", 3: "plugin-timer" }[self.wakeuptyp], { 0: "and starts normal", 1: "and starts in standby", 2: "and starts not in standby" }[self.getstandby]) #record timer, zap timer, some plugin timer or next record timer begins in 15 mins if self.wakeuptyp < 2 or self.forcerecord: print "[NAVIGATION] timer starts at %s" % ctime(self.timertime) if self.forcerecord: print "[NAVIGATION] timer is set from 'vps-plugin' or just before a 'record-timer' starts at %s" % ctime( self.recordtime) print "[NAVIGATION] was rectimer wakeup = True" self.__wasRecTimerWakeup = True f = open("/tmp/was_rectimer_wakeup", "w") f.write('1') f.close() #power timer if self.wakeuptyp == 2: if not self.forcerecord: print "[NAVIGATION] timer starts at %s" % ctime( self.timertime) print "[NAVIGATION] was powertimer wakeup = True" self.__wasPowerTimerWakeup = True f = open("/tmp/was_powertimer_wakeup", "w") f.write('1') f.close() #plugin timer elif self.wakeuptyp == 3: if not self.forcerecord: print "[NAVIGATION] timer starts at %s" % ctime( self.timertime) #check for standby cec = ((self.wakeuptyp == 0 and ( Screens.Standby.TVinStandby.getTVstandby('zapandrecordtimer'))) or (self.wakeuptyp == 1 and (Screens.Standby.TVinStandby.getTVstandby('zaptimer'))) or (self.wakeuptyp == 2 and (Screens.Standby.TVinStandby.getTVstandby( 'wakeuppowertimer')))) if self.getstandby != 1 and ( (self.wakeuptyp < 3 and self.timertime - now > 60 + stbytimer) or cec): self.getstandby = 1 txt = "" if cec: txt = "... or special hdmi-cec settings" print "[NAVIGATION] more than 60 seconds to wakeup%s - go in standby now" % txt print "=" * 100 #go in standby if self.getstandby == 1: if stbytimer: self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(stbytimer * 1000, True) else: self.gotostandby() else: if self.__wasTimerWakeup: print '+' * 100 print "[NAVIGATION] wrong signal 'was timer wakeup' detected - please activate the deep standby workaround." print "[NAVIGATION] secure timer wakeup detection window: %s - %s" % ( ctime(self.wakeupwindow_minus), ctime(self.wakeupwindow_plus)) print '+' * 100 if self.timertime > 0: print "[NAVIGATION] next '%s' starts at %s" % ( { 0: "record-timer", 1: "zap-timer", 2: "power-timer", 3: "plugin-timer" }[self.wakeuptyp], ctime(self.timertime)) if self.recordtime > 0 and self.timertime != self.recordtime: print "[NAVIGATION] next 'record-timer' starts at %s" % ctime( self.recordtime) else: print "[NAVIGATION] no next 'record-timer'" else: print "[NAVIGATION] no next timer" print "=" * 100 self.getstandby = 0 #workaround for normal operation if no time sync after e2 start - box is in standby if self.getstandby != 1 and not self.skipWakeup: self.gotopower()
def startSatelliteTransponderSearch(self, nim_idx, orb_pos): if hasattr(self, 'self.frontend'): del self.frontend if hasattr(self, 'self.channel'): del self.channel self.frontend = self.channel = None self.orb_pos = orb_pos self.nim = nimmanager.nim_slots[nim_idx] tunername = nimmanager.getNimName(nim_idx) print "tunername", tunername self.__tlist = [ ] self.tp_found = [ ] self.current_range = None self.range_list = [ ] tuner_no = -1 self.auto_scan = nimmanager.nim_slots[nim_idx].supportsBlindScan() or tunername.startswith('Si216') if self.auto_scan or tunername == "Alps BSBE1 C01A/D01A." or (tunername != "BCM4501" and "BCM45" in tunername): (self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False) if not self.frontend: self.session.nav.stopService() (self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False) if not self.frontend: if self.session.pipshown: if hasattr(self.session, 'infobar'): try: slist = self.session.infobar.servicelist if slist and slist.dopipzap: slist.togglePipzap() except: pass self.session.pipshown = False if hasattr(self.session, 'pip'): del self.session.pip (self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False) if not self.frontend: print "couldn't allocate tuner %d for blindscan!!!" %nim_idx text = _("Sorry, this tuner is in use.") if self.session.nav.getRecordings(): text += "\n" text += _("Maybe the reason that recording is currently running.") self.session.open(MessageBox, text, MessageBox.TYPE_ERROR) return band_cutoff_frequency = 11700001 s1 = self.scan_sat.bs_freq_start.value * 1000 s2 = self.scan_sat.bs_freq_stop.value * 1000 start = self.min_freq = min(s1,s2) stop = self.max_freq = max(s1,s2) if self.auto_scan: # hack for driver based blindscan... extend search range +/- 50Mhz limits = self.scan_sat.bs_freq_limits start -= 50000 stop += 50000 if start < limits[0]: start = limits[0] if stop >limits[1]: stop = limits[1] if self.scan_sat.bs_horizontal.value: if self.auto_scan and band_cutoff_frequency and stop > band_cutoff_frequency: if start < band_cutoff_frequency: self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Horizontal)) if stop > band_cutoff_frequency: self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal)) else: self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal)) if self.scan_sat.bs_vertical.value: if self.auto_scan and band_cutoff_frequency: if start < band_cutoff_frequency: self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Vertical)) if stop > band_cutoff_frequency: self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Vertical)) else: self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Vertical)) self.parm = self.setNextRange() if self.parm is not None: tparm = eDVBFrontendParameters() tparm.setDVBS(self.parm, False) self.frontend.tune(tparm, True) self.start_time = time() tmpstr = _("Try to find used satellite transponders...") else: tmpstr = _("Nothing to scan! Press Exit!") x = { } data = self.frontend.getFrontendData(x) tuner_no = x["tuner_number"] else: if "Sundtek DVB-S/S2" in tunername and "V" in tunername: tmpstr = _("Use Sundtek full hardware blind scan!") else: tmpstr = _("Hardware blind scan is not supported by this tuner (%s)!") % tunername self.session.open(MessageBox, tmpstr, MessageBox.TYPE_ERROR) return self.satellite_search_session = self.session.openWithCallback(self.satelliteTransponderSearchSessionClosed, SatBlindscanState, tuner_no, tmpstr) #if self.auto_scan: self.timer = eTimer() self.timer.callback.append(self.updateStateSat) self.timer.stop() self.updateStateSat()
def __init__(self, session, infobar): Screen.__init__(self, session) self.skin = QuickSubtitlesConfigMenu.skin self.infobar = infobar or self.session.infobar self.wait = eTimer() self.wait.timeout.get().append(self.resyncSubtitles) self["videofps"] = Label("") sub = self.infobar.selected_subtitle if sub[0] == 0: # dvb menu = [ getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"), getConfigMenuItem("config.subtitles.dvb_subtitles_centered"), getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"), getConfigMenuItem( "config.subtitles.dvb_subtitles_original_position"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem( "config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem( "config.subtitles.subtitle_noPTSrecordingdelay"), ] elif sub[0] == 1: # teletext menu = [ getConfigMenuItem("config.subtitles.ttx_subtitle_colors"), getConfigMenuItem( "config.subtitles.ttx_subtitle_original_position"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.showbackground"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem( "config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem( "config.subtitles.subtitle_noPTSrecordingdelay"), ] else: # pango menu = [ getConfigMenuItem("config.subtitles.pango_subtitles_delay"), getConfigMenuItem("config.subtitles.pango_subtitle_colors"), getConfigMenuItem( "config.subtitles.pango_subtitle_fontswitch"), getConfigMenuItem("config.subtitles.colourise_dialogs"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.showbackground"), getConfigMenuItem("config.subtitles.pango_subtitles_fps"), ] self["videofps"].setText( _("Video: %s fps") % (self.getFps().rstrip(".000"))) ConfigListScreen.__init__(self, menu, self.session, on_change=self.changedEntry) self["actions"] = NumberActionMap(["SetupActions"], { "cancel": self.cancel, "ok": self.ok, }, -2) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, wakeupData=None): if NavigationInstance.instance is not None: raise NavigationInstance.instance NavigationInstance.instance = self self.ServiceHandler = eServiceCenter.getInstance() import Navigation as Nav Nav.navcore = self self.pnav = pNavigation() self.pnav.m_event.get().append(self.dispatchEvent) self.pnav.m_record_event.get().append(self.dispatchRecordEvent) self.event = [] self.record_event = [] self.currentlyPlayingServiceReference = None self.currentlyPlayingServiceOrGroup = None self.currentlyPlayingService = None Screens.Standby.TVstate() self.skipWakeup = False self.skipTVWakeup = False self.RecordTimer = None self.isRecordTimerImageStandard = False for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER): self.RecordTimer = p() if self.RecordTimer: break if not self.RecordTimer: self.RecordTimer = RecordTimer.RecordTimer() self.isRecordTimerImageStandard = True self.PowerTimer = None self.PowerTimer = PowerTimer.PowerTimer() self.__wasTimerWakeup = False self.__wasRecTimerWakeup = False self.__wasPowerTimerWakeup = False if not path.exists("/etc/enigma2/.deep" ): #flag file comes from "/usr/bin/enigma2.sh" print "=" * 100 print "[NAVIGATION] Receiver does not start from Deep Standby - skip wake up detection" print "=" * 100 self.gotopower() return remove("/etc/enigma2/.deep") #wakeup data now = time() try: self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [ int(n) for n in wakeupData.split(',') ] except: print "=" * 100 print "[NAVIGATION] ERROR: can't read wakeup data" self.lastshutdowntime, self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = int( now), -1, -1, 0, 0, -1, 0 self.syncCount = 0 hasFakeTime = ( now <= 31536000 or now - self.lastshutdowntime <= 120 ) and self.getstandby < 2 #set hasFakeTime only if lower than values and was last shutdown to deep standby wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True) #TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True) if 0: #debug print "#" * 100 print "[NAVIGATION] timediff from last shutdown to now = %ds" % ( now - self.lastshutdowntime) print "[NAVIGATION] shutdowntime: %s, wakeuptime: %s timertime: %s, recordtime: %s" % ( ctime(self.lastshutdowntime), ctime(self.wakeuptime), ctime(self.timertime), ctime(self.recordtime)) print "[NAVIGATION] wakeuptyp: %s, getstandby: %s, forcerecord: %s" % ( { 0: "record-timer", 1: "zap-timer", 2: "power-timer", 3: "plugin-timer" }[self.wakeuptyp], { 0: "no standby", 1: "standby", 2: "no standby (box was not in deepstandby)" }[self.getstandby], self.forcerecord) print "#" * 100 print "=" * 100 print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup print "[NAVIGATION] current time is %s -> it's fake-time suspected: %s" % ( ctime(now), hasFakeTime) print "-" * 100 thisBox = getBoxType() if not config.workaround.deeprecord.value and ( wasTimerWakeup_failure or thisBox in ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM() in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia') or getMachineBuild() in ('dags7335', 'dags7356', 'dags7362')): print "[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" % thisBox print "-" * 100 config.workaround.deeprecord.setValue(True) config.workaround.deeprecord.save() config.save() if config.workaround.deeprecord.value: #work-around for boxes where driver not sent was_timer_wakeup signal to e2 print "[NAVIGATION] starting deepstandby-workaround" self.wakeupwindow_plus = self.timertime + 300 self.wakeupwindow_minus = self.wakeuptime - ( config.workaround.wakeupwindow.value * 60) wasTimerWakeup = False if not hasFakeTime and now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus: # if there is a recording sheduled, set the wasTimerWakeup flag wasTimerWakeup = True f = open("/tmp/was_timer_wakeup_workaround.txt", "w") file = f.write(str(wasTimerWakeup)) f.close() else: #secure wakeup window to prevent a wrong 'wasTimerWakeup' value as timer wakeup detection self.wakeupwindow_plus = self.timertime + 900 self.wakeupwindow_minus = self.wakeuptime - 3600 if self.wakeuptime > 0: print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" % ( ctime(self.wakeuptime)) if config.workaround.deeprecord.value: print "[NAVIGATION] timer wakeup detection window: %s - %s" % ( ctime(self.wakeupwindow_minus), ctime(self.wakeupwindow_plus)) else: print "[NAVIGATION] wakeup time was not set" print "-" * 100 if wasTimerWakeup: self.__wasTimerWakeup = True if not hasFakeTime: self.wakeupCheck() return if hasFakeTime and self.wakeuptime > 0: # check for NTP-time sync, if no sync, wait for transponder time if Screens.Standby.TVinStandby.getTVstandby( 'waitfortimesync') and not wasTimerWakeup: self.skipTVWakeup = True Screens.Standby.TVinStandby.setTVstate('power') self.savedOldTime = now self.timesynctimer = eTimer() self.timesynctimer.callback.append(self.TimeSynctimer) self.timesynctimer.start(5000, True) print "[NAVIGATION] wait for time sync" print "~" * 100 else: self.wakeupCheck(False)
def __init__(self): self.WeatherInfo = WeatherInfo = { "currentLocation": "N/A", "currentCountry": "N/A", "currentRegion": "N/A", "windChill": "N/A", "windDirectionShort": "N/A", "windDirectionLong": "N/A", "windSpeed": "N/A", "atmoHumidity": "N/A", "atmoPressure": "N/A", "atmoRising": "N/A", "atmoVisibility": "N/A", "astroSunrise": "N/A", "astroSunset": "N/A", "geoData": "N/A", "geoLat": "N/A", "geoLong": "N/A", "downloadDate": "N/A", "downloadTime": "N/A", "currentWeatherCode": "(", "currentWeatherText": "N/A", "currentWeatherTemp": "0", "currentWeatherPicon": "3200", "forecastTodayCode": "(", "forecastTodayDay": "N/A", "forecastTodayDate": "N/A", "forecastTodayTempMin": "0", "forecastTodayTempMax": "0", "forecastTodayText": "N/A", "forecastTodayPicon": "3200", "forecastTomorrowCode": "(", "forecastTomorrowDay": "N/A", "forecastTomorrowDate": "N/A", "forecastTomorrowTempMin": "0", "forecastTomorrowTempMax": "0", "forecastTomorrowText": "N/A", "forecastTomorrowPicon": "3200", "forecastTomorrow1Code": "(", "forecastTomorrow1Day": "N/A", "forecastTomorrow1Date": "N/A", "forecastTomorrow1TempMin": "0", "forecastTomorrow1TempMax": "0", "forecastTomorrow1Text": "N/A", "forecastTomorrow1Picon": "3200", "forecastTomorrow2Code": "(", "forecastTomorrow2Day": "N/A", "forecastTomorrow2Date": "N/A", "forecastTomorrow2TempMin": "0", "forecastTomorrow2TempMax": "0", "forecastTomorrow2Text": "N/A", "forecastTomorrow2Picon": "3200", "forecastTomorrow3Code": "(", "forecastTomorrow3Day": "N/A", "forecastTomorrow3Date": "N/A", "forecastTomorrow3TempMin": "0", "forecastTomorrow3TempMax": "0", "forecastTomorrow3Text": "N/A", "forecastTomorrow3Picon": "3200", "forecastTomorrow4Code": "(", "forecastTomorrow4Day": "N/A", "forecastTomorrow4Date": "N/A", "forecastTomorrow4TempMin": "0", "forecastTomorrow4TempMax": "0", "forecastTomorrow4Text": "N/A", "forecastTomorrow4Picon": "3200", "forecastTomorrow5Code": "(", "forecastTomorrow5Day": "N/A", "forecastTomorrow5Date": "N/A", "forecastTomorrow5TempMin": "0", "forecastTomorrow5TempMax": "0", "forecastTomorrow5Text": "N/A", "forecastTomorrow5Picon": "3200", "forecastTomorrow6Code": "(", "forecastTomorrow6Day": "N/A", "forecastTomorrow6Date": "N/A", "forecastTomorrow6TempMin": "0", "forecastTomorrow6TempMax": "0", "forecastTomorrow6Text": "N/A", "forecastTomorrow6Picon": "3200", "forecastTomorrow7Code": "(", "forecastTomorrow7Day": "N/A", "forecastTomorrow7Date": "N/A", "forecastTomorrow7TempMin": "0", "forecastTomorrow7TempMax": "0", "forecastTomorrow7Text": "N/A", "forecastTomorrow7Picon": "3200", "forecastTomorrow8Code": "(", "forecastTomorrow8Day": "N/A", "forecastTomorrow8Date": "N/A", "forecastTomorrow8TempMin": "0", "forecastTomorrow8TempMax": "0", "forecastTomorrow8Text": "N/A", "forecastTomorrow8Picon": "3200", } if config.plugins.AtileHD.refreshInterval.value > 0: self.timer = eTimer() self.timer.callback.append(self.GetWeather) self.GetWeather()
def delay(self): self.timer = eTimer() self.timer.callback.append(self.showPoster) self.timer.start(30, True)
refreshServiceList() self.close(result > 0) def Power(self): from Screens.Standby import inStandby inStandby.Power() print("[CableScan] aborted due to power button pressed") self.close(True) def createSummary(self): from Screens.Standby import StandbySummary return StandbySummary Session = None CableScanAutoStartTimer = eTimer() def CableScanMain(session, **kwargs): session.open(CableScanScreen, nimmanager.getEnabledNimListOfType("DVB-C")) def restartScanAutoStartTimer(reply=False): if reply: CableScanAutoStartTimer.startLongTimer(86400) else: print("[CableScan] Scan was not successful retry in one hour") CableScanAutoStartTimer.startLongTimer(3600) def CableScanAuto():
def startProgressTimer(self): self.progressTimer = eTimer() self.progressTimer.start(5000, True) self.progressTimer.callback.append(self.endTimer)
def __init__(self, session, piclist, lastindex, path): self["key_red"] = Button("") self["key_green"] = Button("Slide Show") self["key_yellow"] = Button("File View") self["key_blue"] = Button(_("Settings")) self.textcolor = config.plugins.mc_pp.textcolor.value self.color = config.plugins.mc_pp.bgcolor.value textsize = 20 self.spaceX = 20 self.spaceY = 28 self.picX = config.plugins.mc_pp.ThumbWidth.value self.picY = config.plugins.mc_pp.ThumbHeight.value size_w = getDesktop(0).size().width() size_h = getDesktop(0).size().height() if size_w == 1280: self.spaceTop = 130 self.spaceLeft = 50 self.ButtonPosY = 95 else: self.spaceTop = 120 self.spaceLeft = 25 self.ButtonPosY = 72 self.thumbsX = size_w / (self.spaceX + self.picX) # thumbnails in X self.thumbsY = size_h / (self.spaceY + self.picY) # thumbnails in Y self.thumbsC = self.thumbsX * self.thumbsY # all thumbnails self.positionlist = [] skincontent = "" posX = -1 for x in range(self.thumbsC): posY = x / self.thumbsX posX += 1 if posX >= self.thumbsX: posX = 0 absX = self.spaceLeft + self.spaceX + (posX * (self.spaceX + self.picX)) absY = self.spaceTop + self.spaceY + (posY * (self.spaceY + self.picY)) self.positionlist.append((absX, absY)) skincontent += "<widget name=\"label" + str( x ) + "\" position=\"" + str(absX + 5) + "," + str( absY + self.picY - textsize ) + "\" size=\"" + str(self.picX - 10) + "," + str( textsize ) + "\" font=\"Regular;14\" zPosition=\"2\" transparent=\"1\" noWrap=\"1\" foregroundColor=\"" + self.textcolor + "\" />" skincontent += "<widget name=\"thumb" + str( x) + "\" position=\"" + str(absX + 5) + "," + str( absY + 5 ) + "\" size=\"" + str(self.picX - 10) + "," + str( self.picY - (textsize * 2) ) + "\" zPosition=\"2\" transparent=\"1\" alphatest=\"on\" />" # Screen, buttons, backgroundlabel and MovingPixmap self.skin = "<screen position=\"0,0\" size=\"" + str( size_w ) + "," + str(size_h) + "\" flags=\"wfNoBorder\" > \ <ePixmap name=\"mb_bg\" position=\"0,0\" zPosition=\"1\" size=\"" + str( size_w ) + "," + str( size_h ) + "\" pixmap=\"" + mcpath + "skins/defaultHD/images/background.png\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-red.png\" position=\"60," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-green.png\" position=\"210," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-yellow.png\" position=\"360," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <ePixmap pixmap=\"" + mcpath + "icons/key-blue.png\" position=\"510," + str( self.ButtonPosY ) + "\" zPosition=\"2\" size=\"140,40\" transparent=\"1\" alphatest=\"on\" /> \ <widget name=\"key_red\" position=\"60," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#9f1313\" transparent=\"1\" /> \ <widget name=\"key_green\" position=\"210," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#1f771f\" transparent=\"1\" /> \ <widget name=\"key_yellow\" position=\"360," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#a08500\" transparent=\"1\" /> \ <widget name=\"key_blue\" position=\"510," + str( self.ButtonPosY ) + "\" zPosition=\"3\" size=\"140,40\" font=\"Regular;20\" valign=\"center\" halign=\"center\" backgroundColor=\"#18188b\" transparent=\"1\" /> \ <eLabel position=\"0,0\" zPosition=\"0\" size=\"" + str(size_w) + "," + str( size_h ) + "\" backgroundColor=\"" + self.color + "\" /> \ <widget name=\"frame\" position=\"35,30\" size=\"" + str( self.picX + 1 ) + "," + str( self.picY + 10 ) + "\" pixmap=\"pic_frame.png\" zPosition=\"3\" alphatest=\"on\" />" + skincontent + "</screen>" Screen.__init__(self, session) self["actions"] = HelpableActionMap( self, "MC_PictureViewerActions", { "ok": (self.KeyOk, "Show Picture"), "cancel": (self.Exit, "Exit Picture Viewer"), "left": (self.key_left, "List Top"), "right": (self.key_right, "List Bottom"), "up": (self.key_up, "List up"), "down": (self.key_down, "List down"), "info": (self.StartExif, "Show File Info"), "green": (self.startslideshow, "Start Slideshow"), "yellow": (self.close, "File View"), "blue": (self.Settings, "Settings"), }, -2) self["frame"] = MovingPixmap() for x in range(self.thumbsC): self["label" + str(x)] = Label() self["thumb" + str(x)] = Pixmap() self.Thumbnaillist = [] self.filelist = [] self.currPage = -1 self.dirlistcount = 0 self.path = path index = 0 framePos = 0 Page = 0 for x in piclist: if x[0][1] == False: self.filelist.append( (index, framePos, Page, x[0][0], path + x[0][0])) index += 1 framePos += 1 if framePos > (self.thumbsC - 1): framePos = 0 Page += 1 else: self.dirlistcount += 1 self.maxentry = len(self.filelist) - 1 self.index = lastindex - self.dirlistcount if self.index < 0: self.index = 0 self.picload = ePicLoad() self.picload.PictureData.get().append(self.showPic) self.onLayoutFinish.append(self.setPicloadConf) self.ThumbTimer = eTimer() self.ThumbTimer.callback.append(self.showPic)
def __init__(self, session, args = 0): self.session = session Screen.__init__(self, session) self.text="" self.text="Emu OScam, Ncam, Gcam and CCcam arm mips All ipk and deb For enigma2" ### EDit By RAED To DreamOS OE2.5/2.6 if fileExists('/var/lib/dpkg/status'): self.wget = "/usr/bin/wget2 --no-check-certificate" else: self.wget = "/usr/bin/wget" ### End self["myText"] = Label() self["go"] = Label() self["goto"] = Label() self["prombt"] = Label() self["myRedBtn"] = Label(_("Cancel")) self["myGreenBtn"] = Label(_("OSCAM")) self["myYellowBtn"] = Label(_("NCAM")) self["myBlueBtn"] = Label(_("GCAM")) self.cmdlist = [] self['text'] = Label() self["key_blue"] = Label() self["key_yellow"] = Label() self["key_green"] = Label() self["key_red"] = Label() self['icon'] = Pixmap() self['icon2'] = Pixmap() self['icon3'] = Pixmap() self['icon4'] = Pixmap() self['Btn'] = Pixmap() self['Bt1'] = Pixmap() self['Bt2'] = Pixmap() self['Bt3'] = Pixmap() self['Bt4'] = Pixmap() self['Bt5'] = Pixmap() self['Bt6'] = Pixmap() #self["myMenu"] = MenuList(list) self['actions'] = ActionMap(['MovieSelectionActions', 'SetupActions', 'DirectionActions', 'ColorActions'], {'ok': self.close, "showEventInfo": self.gotoa, '0': self.restart, '1': self.goc, 'blue': self.got, 'yellow': self.goto, #'ok': self.go, 'red': self.close, 'cancel': self.cancel, 'green': self.go}, -1) self.onShown.append(self.setMyText) self.go self.goto self.got self.goc self.prombt self.onChangedEntry = [] self.timer_list = [] self.processed_timers = [] self.timer = eTimer() self.initialservice = session.nav.getCurrentlyPlayingServiceReference() self.updateTimer = eTimer() self.timer.start(2000, True)