def __init__(self, session): self.session = session Screen.__init__(self, self.session) ProtectedScreen.__init__(self) # Lets get a list of elements for the config list self.list = [ getConfigListEntry(_("Enabled"), config.plugins.KiddyTimer.enabled), getConfigListEntry(_("PIN"), config.plugins.KiddyTimer.pin), getConfigListEntry(_("Don't monitor TV started before"), config.plugins.KiddyTimer.monitorStartTime ), getConfigListEntry(_("Don't monitor TV started after"), config.plugins.KiddyTimer.monitorEndTime ), getConfigListEntry(_("Style of timer"), config.plugins.KiddyTimer.timerStyle ), getConfigListEntry(_("Timeout for activation dialog"), config.plugins.KiddyTimer.activationDialogTimeout ) ] for i in range(0,7): self.list.append(getConfigListEntry(KTglob.DAYNAMES[i], config.plugins.KiddyTimer.dayTimes[i].timeValue)) ConfigListScreen.__init__(self, self.list) self["config"].list = self.list self.skin_path = KTglob.plugin_path self.kiddyTimerStopped = False; # Temporarily stop timer as long as we are in the setup screen if kiddyTimer.active: self.kiddyTimerStopped = True; kiddyTimer.stopTimer() # Plugin Information self.remainingTime = config.plugins.KiddyTimer.remainingTime.value sRemainingTime = KTglob.getTimeFromSeconds(self.remainingTime , True ) self["PluginInfo"] = Label(_("Plugin: %(plugin)s , Version: %(version)s") %dict(plugin=KTglob.PLUGIN_BASE,version=KTglob.PLUGIN_VERSION)) self["RemainingTime"] = Label(_("Remaining time: %s") %sRemainingTime) self["LastDayStarted"] = Label(_("Last day started: %s") % config.plugins.KiddyTimer.lastStartDay.getValue()) # BUTTONS self["key_red"] = Button(_("Cancel")) self["key_green"] = Button(_("Save")) self["key_yellow"] = Button(_("Reset clock")) self["key_blue"] = Button(_("Move clock")) self["setupActions"] = NumberActionMap(["SetupActions", "ColorActions"], { "save": self.save, "cancel": self.cancel, "green": self.save, "red": self.cancel, "ok": self.save, "blue": self.keyPositioner, "yellow": self.resetTimer }, -2)
def checkStopTimer(self): # Temporarily stop timer as long as we are in the setup screen if kiddyTimer.active: self.kiddyTimerStopped = True; kiddyTimer.stopTimer()
def __init__(self, session): self.session = session Screen.__init__(self, self.session) ProtectedScreen.__init__(self) # Lets get a list of elements for the config list self.list = [ getConfigListEntry(_("Enabled"), config.plugins.KiddyTimer.enabled), getConfigListEntry(_("PIN"), config.plugins.KiddyTimer.pin), getConfigListEntry(_("Don't monitor TV started before"), config.plugins.KiddyTimer.monitorStartTime), getConfigListEntry(_("Don't monitor TV started after"), config.plugins.KiddyTimer.monitorEndTime), getConfigListEntry(_("Style of timer"), config.plugins.KiddyTimer.timerStyle), getConfigListEntry( _("Timeout for activation dialog"), config.plugins.KiddyTimer.activationDialogTimeout) ] for i in range(0, 7): self.list.append( getConfigListEntry( KTglob.DAYNAMES[i], config.plugins.KiddyTimer.dayTimes[i].timeValue)) ConfigListScreen.__init__(self, self.list) self["config"].list = self.list self.skin_path = KTglob.plugin_path self.kiddyTimerStopped = False # Temporarily stop timer as long as we are in the setup screen if kiddyTimer.active: self.kiddyTimerStopped = True kiddyTimer.stopTimer() # Plugin Information self.remainingTime = config.plugins.KiddyTimer.remainingTime.value sRemainingTime = KTglob.getTimeFromSeconds(self.remainingTime, True) self["PluginInfo"] = Label( _("Plugin: %(plugin)s , Version: %(version)s") % dict(plugin=KTglob.PLUGIN_BASE, version=KTglob.PLUGIN_VERSION)) self["RemainingTime"] = Label(_("Remaining time: %s") % sRemainingTime) self["LastDayStarted"] = Label( _("Last day started: %s") % config.plugins.KiddyTimer.lastStartDay.getValue()) # BUTTONS self["key_red"] = Button(_("Cancel")) self["key_green"] = Button(_("Save")) self["key_yellow"] = Button(_("Reset clock")) self["key_blue"] = Button(_("Move clock")) self["setupActions"] = NumberActionMap( ["SetupActions", "ColorActions"], { "save": self.save, "cancel": self.cancel, "green": self.save, "red": self.cancel, "ok": self.save, "blue": self.keyPositioner, "yellow": self.resetTimer }, -2)
def autostart(reason, **kwargs): if reason == 1: global kiddyTimer kiddyTimer.stopTimer() kiddyTimer = None