本文整理汇总了Python中Components.config.ConfigClock类的典型用法代码示例。如果您正苦于以下问题:Python ConfigClock类的具体用法?Python ConfigClock怎么用?Python ConfigClock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigClock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TimerEntry
#.........这里部分代码省略.........
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [
("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to deep standby")
choicelist = [("always", _("always")), ("from_standby", _("only from standby")), ("from_deep_standby", _("only from deep standby")), ("never", _("never"))]
else:
shutdownString = _("shut down")
choicelist = [("always", _("always")), ("never", _("never"))]
self.timerentry_zapwakeup = ConfigSelection(choices = choicelist, default = zap_wakeup)
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_renamerepeat = ConfigYesNo(default = rename_repeat)
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
# FIXME some service-chooser needed here
servicename = "N/A"
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
def createSetup(self, widget):
self.list = []
self.entryName = getConfigListEntry(_("Name"), self.timerentry_name)
self.list.append(self.entryName)
self.entryDescription = getConfigListEntry(_("Description"), self.timerentry_description)
self.list.append(self.entryDescription)
示例2: createConfig
def createConfig(self):
justplay = self.timer.justplay
always_zap = self.timer.always_zap
zap_wakeup = self.timer.zap_wakeup
rename_repeat = self.timer.rename_repeat
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.AUTO: "auto"
}[self.timer.afterEvent]
if self.timer.record_ecm and self.timer.descramble:
recordingtype = "descrambled+ecm"
elif self.timer.record_ecm:
recordingtype = "scrambled+ecm"
elif self.timer.descramble:
recordingtype = "normal"
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if (self.timer.repeated == 31): # Mon-Fri
repeated = "weekdays"
elif (self.timer.repeated == 127): # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [
("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to deep standby")
choicelist = [("always", _("always")), ("from_standby", _("only from standby")), ("from_deep_standby", _("only from deep standby")), ("never", _("never"))]
else:
shutdownString = _("shut down")
choicelist = [("always", _("always")), ("never", _("never"))]
self.timerentry_zapwakeup = ConfigSelection(choices = choicelist, default = zap_wakeup)
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_renamerepeat = ConfigYesNo(default = rename_repeat)
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
# FIXME some service-chooser needed here
servicename = "N/A"
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
#.........这里部分代码省略.........
示例3: createConfig
def createConfig(self):
justplay = self.timer.justplay
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.AUTO: "auto"
}[self.timer.afterEvent]
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if (self.timer.repeated == 31): # Mon-Fri
repeated = "weekdays"
elif (self.timer.repeated == 127): # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
day[weekday] = 1
if not config.misc.recording_allowed.value:
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap"))], default = "zap")
else:
tmp_dir = self.timer.dirname or defaultMoviePath()
if not harddiskmanager.inside_mountpoint(tmp_dir):
justplay = 1
justplay_default = {0: "record", 1: "zap"}[justplay]
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = justplay_default)
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to standby")
else:
shutdownString = _("shut down")
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to idle mode")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
servicename = servicename or "N/A"
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
self.timerentry_plugins = {}
if config.usage.setup_level.index >= 2:
from Plugins.Plugin import PluginDescriptor
from Components.PluginComponent import plugins
missing = self.timer.plugins.keys()
for p in plugins.getPlugins(PluginDescriptor.WHERE_TIMEREDIT):
#.........这里部分代码省略.........
示例4: TimerEntry
#.........这里部分代码省略.........
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags >>= 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [
("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to deep standby")
else:
shutdownString = _("shut down")
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode("utf-8"), visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.getValue()
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
# FIXME some service-chooser needed here
servicename = "N/A"
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
def createSetup(self, widget):
self.list = []
self.list.append(getConfigListEntry(_("Name"), self.timerentry_name, _("Set the name the recording will get.")))
self.list.append(getConfigListEntry(_("Description"), self.timerentry_description, _("Set the description of the recording.")))
self.timerJustplayEntry = getConfigListEntry(_("Timer type"), self.timerentry_justplay, _("Chose between record and ZAP."))
self.list.append(self.timerJustplayEntry)
示例5: createConfig
def createConfig(self):
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.WAKEUPTOSTANDBY: "wakeuptostandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.DEEPSTANDBY: "deepstandby"
}[self.timer.afterEvent]
timertype = {
TIMERTYPE.WAKEUP: "wakeup",
TIMERTYPE.WAKEUPTOSTANDBY: "wakeuptostandby",
TIMERTYPE.AUTOSTANDBY: "autostandby",
TIMERTYPE.AUTODEEPSTANDBY: "autodeepstandby",
TIMERTYPE.STANDBY: "standby",
TIMERTYPE.DEEPSTANDBY: "deepstandby",
TIMERTYPE.REBOOT: "reboot",
TIMERTYPE.RESTART: "restart"
}[self.timer.timerType]
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if self.timer.repeated == 31: # Mon-Fri
repeated = "weekdays"
elif self.timer.repeated == 127: # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags >>= 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
autosleepinstandbyonly = self.timer.autosleepinstandbyonly
autosleepdelay = self.timer.autosleepdelay
autosleeprepeat = self.timer.autosleeprepeat
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to deep standby")
else:
shutdownString = _("shut down")
self.timerentry_timertype = ConfigSelection(choices = [("wakeup", _("wakeup")),("wakeuptostandby", _("wakeup to standby")), ("autostandby", _("auto standby")), ("autodeepstandby", _("auto deepstandby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("reboot", _("reboot system")), ("restart", _("restart GUI"))], default = timertype)
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("wakeuptostandby", _("wakeup to standby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("nothing", _("do nothing"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerrntry_autosleepdelay = ConfigInteger(default=autosleepdelay, limits = (10, 300))
self.timerentry_autosleeprepeat = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = autosleeprepeat)
self.timerrntry_autosleepinstandbyonly = ConfigSelection(choices = [("yes",_("Yes")), ("no", _("No"))],default=autosleepinstandbyonly)
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = (((self.timer.end - self.timer.begin) /60 ) > 1), choices = [(True, _("yes")), (False, _("no"))])
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
示例6: TimerEntry
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.timer = timer
self.entryDate = None
self.entryService = None
self["oktext"] = Label(_("OK"))
self["canceltext"] = Label(_("Cancel"))
self["ok"] = Pixmap()
self["cancel"] = Pixmap()
self.createConfig()
self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions"],
{
"ok": self.keySelect,
"save": self.keyGo,
"cancel": self.keyCancel,
"volumeUp": self.incrementStart,
"volumeDown": self.decrementStart,
"size+": self.incrementEnd,
"size-": self.decrementEnd
}, -2)
self.list = []
ConfigListScreen.__init__(self, self.list, session = session)
self.createSetup("config")
def createConfig(self):
justplay = self.timer.justplay
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.AUTO: "auto"
}[self.timer.afterEvent]
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if (self.timer.repeated == 31): # Mon-Fri
repeated = "weekdays"
elif (self.timer.repeated == 127): # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
day[weekday] = 1
if not config.misc.recording_allowed.value:
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap"))], default = "zap")
else:
tmp_dir = self.timer.dirname or defaultMoviePath()
if not harddiskmanager.inside_mountpoint(tmp_dir):
justplay = 1
justplay_default = {0: "record", 1: "zap"}[justplay]
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = justplay_default)
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to standby")
else:
shutdownString = _("shut down")
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to idle mode")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
#.........这里部分代码省略.........
示例7: createConfig
def createConfig(self):
justplay = self.timer.justplay
always_zap = self.timer.always_zap
rename_repeat = self.timer.rename_repeat
afterevent = {AFTEREVENT.NONE: 'nothing',
AFTEREVENT.DEEPSTANDBY: 'deepstandby',
AFTEREVENT.STANDBY: 'standby',
AFTEREVENT.AUTO: 'auto'}[self.timer.afterEvent]
if self.timer.record_ecm and self.timer.descramble:
recordingtype = 'descrambled+ecm'
elif self.timer.record_ecm:
recordingtype = 'scrambled+ecm'
elif self.timer.descramble:
recordingtype = 'normal'
weekday_table = ('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated:
type = 'repeated'
if self.timer.repeated == 31:
repeated = 'weekdays'
elif self.timer.repeated == 127:
repeated = 'daily'
else:
flags = self.timer.repeated
repeated = 'user'
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1:
weekday = x
if flags & 1 == 1:
day[x] = 1
count += 1
else:
day[x] = 0
flags >>= 1
if count == 1:
repeated = 'weekly'
else:
type = 'once'
repeated = None
weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices=[('zap', _('zap')), ('record', _('record')), ('zap+record', _('zap and record'))], default={0: 'record',
1: 'zap',
2: 'zap+record'}[justplay + 2 * always_zap])
if SystemInfo['DeepstandbySupport']:
shutdownString = _('go to deep standby')
else:
shutdownString = _('shut down')
self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('auto', _('auto'))], default=afterevent)
self.timerentry_recordingtype = ConfigSelection(choices=[('normal', _('normal')), ('descrambled+ecm', _('descramble and record ecm')), ('scrambled+ecm', _("don't descramble, record ecm"))], default=recordingtype)
self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
self.timerentry_name = ConfigText(default=self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode('utf-8'), visible_width=50, fixed_size=False)
self.timerentry_description = ConfigText(default=self.timer.description, visible_width=50, fixed_size=False)
self.timerentry_tags = self.timer.tags[:]
if not self.timerentry_tags:
tagname = self.timer.name.strip()
if tagname:
tagname = tagname[0].upper() + tagname[1:].replace(' ', '_')
self.timerentry_tags.append(tagname)
self.timerentry_tagsset = ConfigSelection(choices=[not self.timerentry_tags and 'None' or ' '.join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('weekly', _('weekly')),
('daily', _('daily')),
('weekdays', _('Mon-Fri')),
('user', _('user defined'))])
self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d %B %Y'), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(default=self.timer.end > self.timer.begin + 3 and self.timer.justplay, choices=[(True, _('yes')), (False, _('no'))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
('tue', _('Tuesday')),
('wed', _('Wednesday')),
('thu', _('Thursday')),
('fri', _('Friday')),
('sat', _('Saturday')),
('sun', _('Sunday'))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
servicename = 'N/A'
try:
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
#.........这里部分代码省略.........
示例8: TimerEntry
#.........这里部分代码省略.........
else:
type = 'once'
repeated = None
weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
day[weekday] = 1
if SystemInfo['DeepstandbySupport']:
shutdownString = _('go to deep standby')
else:
shutdownString = _('shut down')
self.timerentry_timertype = ConfigSelection(choices=[('nothing', _('do nothing')),
('wakeup', _('wakeup')),
('wakeuptostandby', _('wakeup to standby')),
('autostandby', _('auto standby')),
('autodeepstandby', _('auto deepstandby')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('reboot', _('reboot system')),
('restart', _('restart GUI'))], default=timertype)
self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
('wakeup', _('wakeup')),
('wakeuptostandby', _('wakeup to standby')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('nothing', _('do nothing'))], default=afterevent)
self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('daily', _('daily')),
('weekly', _('weekly')),
('weekdays', _('Mon-Fri')),
('user', _('user defined'))])
self.timerrntry_autosleepdelay = ConfigSelection(choices=time_table, default=self.timer.autosleepdelay)
self.timerentry_autosleeprepeat = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=self.timer.autosleeprepeat)
self.timerrntry_autosleepinstandbyonly = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.autosleepinstandbyonly)
self.timerrntry_autosleepwindow = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.autosleepwindow)
self.timerrntry_autosleepbegin = ConfigClock(default=self.timer.autosleepbegin)
self.timerrntry_autosleepend = ConfigClock(default=self.timer.autosleepend)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(default=(self.timer.end - self.timer.begin) / 60 > 4, choices=[(True, _('yes')), (False, _('no'))])
self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
('tue', _('Tuesday')),
('wed', _('Wednesday')),
('thu', _('Thursday')),
('fri', _('Friday')),
('sat', _('Saturday')),
('sun', _('Sunday'))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
self.timerrntry_showExtended = ConfigSelection(default=self.timer.nettraffic == 'yes' or self.timer.netip == 'yes', choices=[(True, _('yes')), (False, _('no'))])
self.timerrntry_nettraffic = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.nettraffic)
self.timerrntry_trafficlimit = ConfigSelection(choices=traffic_table, default=self.timer.trafficlimit)
self.timerrntry_netip = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.netip)
self.timerrntry_ipadress = self.timer.ipadress.split(',')
self.ipcount = ConfigSelectionNumber(default=len(self.timerrntry_ipadress), stepwidth=1, min=1, max=5)
self.ipadressEntry = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5):
try:
self.ipadressEntry.append(ConfigIP(default=[ int(n) for n in self.timerrntry_ipadress[x].split('.') ] or [0,
0,
0,
0]))
except:
self.ipadressEntry.append(ConfigIP(default=[0,
示例9: TimerEntry
#.........这里部分代码省略.........
("standby", _("go to standby")),
("deepstandby", shutdownString),
("auto", _("auto"))
], default=afterevent)
self.timerentry_recordingtype = ConfigSelection(choices=[
("normal", _("normal")),
("descrambled+ecm", _("descramble and record ecm")),
("scrambled+ecm", _("don't descramble, record ecm"))
], default=recordingtype)
self.timerentry_type = ConfigSelection(choices=[
("once", _("once")),
("repeated", _("repeated"))
], default=repeat_type)
self.timerentry_name = ConfigText(default=self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode("utf-8"), visible_width=50, fixed_size=False)
self.timerentry_description = ConfigText(default=self.timer.description, visible_width=50, fixed_size=False)
self.timerentry_tags = self.timer.tags[:]
# if no tags found, make name of event default tag set.
if not self.timerentry_tags:
tagname = self.timer.name.strip()
if tagname:
tagname = tagname[0].upper() + tagname[1:].replace(" ", "_")
self.timerentry_tags.append(tagname)
self.timerentry_tagsset = ConfigSelection(choices=[not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(choices=[
("weekly", _("weekly")),
("daily", _("daily")),
("weekdays", _("Mon-Fri")),
("user", _("user defined"))
], default=repeated)
self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_("%d %B %Y"), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(default=((self.timer.end - self.timer.begin) > 4), choices=[(True, _("yes")), (False, _("no"))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_("%d.%B %Y"), increment=86400)
self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[
("mon", _("Monday")),
("tue", _("Tuesday")),
("wed", _("Wednesday")),
("thu", _("Thursday")),
("fri", _("Friday")),
("sat", _("Saturday")),
("sun", _("Sunday"))
])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
# FIXME some service-chooser needed here
servicename = "N/A"
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
self.timerentry_service_ref = self.timer.service_ref
示例10: TimerEntry
#.........这里部分代码省略.........
else:
type = 'once'
repeated = None
weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices=[('zap', _('zap')), ('record', _('record')), ('zap+record', _('zap and record'))], default={0: 'record',
1: 'zap',
2: 'zap+record'}[justplay + 2 * always_zap])
if SystemInfo['DeepstandbySupport']:
shutdownString = _('go to deep standby')
else:
shutdownString = _('shut down')
self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('auto', _('auto'))], default=afterevent)
self.timerentry_recordingtype = ConfigSelection(choices=[('normal', _('normal')), ('descrambled+ecm', _('descramble and record ecm')), ('scrambled+ecm', _("don't descramble, record ecm"))], default=recordingtype)
self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
self.timerentry_name = ConfigText(default=self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode('utf-8'), visible_width=50, fixed_size=False)
self.timerentry_description = ConfigText(default=self.timer.description, visible_width=50, fixed_size=False)
self.timerentry_tags = self.timer.tags[:]
if not self.timerentry_tags:
tagname = self.timer.name.strip()
if tagname:
tagname = tagname[0].upper() + tagname[1:].replace(' ', '_')
self.timerentry_tags.append(tagname)
self.timerentry_tagsset = ConfigSelection(choices=[not self.timerentry_tags and 'None' or ' '.join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('weekly', _('weekly')),
('daily', _('daily')),
('weekdays', _('Mon-Fri')),
('user', _('user defined'))])
self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d %B %Y'), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(default=self.timer.end > self.timer.begin + 3 and self.timer.justplay, choices=[(True, _('yes')), (False, _('no'))])
default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default=default, choices=tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
('tue', _('Tuesday')),
('wed', _('Wednesday')),
('thu', _('Thursday')),
('fri', _('Friday')),
('sat', _('Saturday')),
('sun', _('Sunday'))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
servicename = 'N/A'
try:
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
return
def createSetup(self, widget):
self.list = []
self.entryName = getConfigListEntry(_('Name'), self.timerentry_name, _('Set the name the recording will get.'))
示例11: createConfig
def createConfig(self):
justplay = self.timer.justplay
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.AUTO: "auto"
}[self.timer.afterEvent]
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if (self.timer.repeated == 31): # Mon-Fri
repeated = "weekdays"
elif (self.timer.repeated == 127): # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay])
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
default = self.timer.dirname or resolveFilename(SCOPE_HDD)
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
# FIXME some service-chooser needed here
servicename = "N/A"
try: # no current service available?
servicename = str(self.timer.service_ref.getServiceName())
except:
pass
self.timerentry_service_ref = self.timer.service_ref
self.timerentry_service = ConfigSelection([servicename])
示例12: TimerEntry
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.timer = timer
self.entryDate = None
self.entryService = None
self["oktext"] = Label(_("OK"))
self["canceltext"] = Label(_("Cancel"))
self["ok"] = Pixmap()
self["cancel"] = Pixmap()
self.createConfig()
self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions"],
{
"ok": self.keySelect,
"save": self.keyGo,
"cancel": self.keyCancel,
"volumeUp": self.incrementStart,
"volumeDown": self.decrementStart,
"size+": self.incrementEnd,
"size-": self.decrementEnd
}, -2)
self.list = []
ConfigListScreen.__init__(self, self.list, session = session)
self.createSetup("config")
def createConfig(self):
justplay = self.timer.justplay
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.AUTO: "auto"
}[self.timer.afterEvent]
weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
type = "repeated"
if (self.timer.repeated == 31): # Mon-Fri
repeated = "weekdays"
elif (self.timer.repeated == 127): # daily
repeated = "daily"
else:
flags = self.timer.repeated
repeated = "user"
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1: # weekly
print "Set to weekday " + str(x)
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags = flags >> 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = (int(strftime("%w", localtime(self.timer.begin))) - 1) % 7
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay])
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False)
self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
self.timerentry_tags = self.timer.tags[:]
self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
default = self.timer.dirname or resolveFilename(SCOPE_HDD)
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
#.........这里部分代码省略.........
示例13: createConfig
#.........这里部分代码省略.........
(1000, '1000')]
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated:
type = 'repeated'
if self.timer.repeated == 31:
repeated = 'weekdays'
elif self.timer.repeated == 127:
repeated = 'daily'
else:
flags = self.timer.repeated
repeated = 'user'
count = 0
for x in (0, 1, 2, 3, 4, 5, 6):
if flags == 1:
print 'Set to weekday ' + str(x)
weekday = x
if flags & 1 == 1:
day[x] = 1
count += 1
else:
day[x] = 0
flags >>= 1
if count == 1:
repeated = 'weekly'
else:
type = 'once'
repeated = None
weekday = int(strftime('%u', localtime(self.timer.begin))) - 1
day[weekday] = 1
if SystemInfo['DeepstandbySupport']:
shutdownString = _('go to deep standby')
else:
shutdownString = _('shut down')
self.timerentry_timertype = ConfigSelection(choices=[('nothing', _('do nothing')),
('wakeup', _('wakeup')),
('wakeuptostandby', _('wakeup to standby')),
('autostandby', _('auto standby')),
('autodeepstandby', _('auto deepstandby')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('reboot', _('reboot system')),
('restart', _('restart GUI'))], default=timertype)
self.timerentry_afterevent = ConfigSelection(choices=[('nothing', _('do nothing')),
('wakeup', _('wakeup')),
('wakeuptostandby', _('wakeup to standby')),
('standby', _('go to standby')),
('deepstandby', shutdownString),
('nothing', _('do nothing'))], default=afterevent)
self.timerentry_type = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=type)
self.timerentry_repeated = ConfigSelection(default=repeated, choices=[('daily', _('daily')),
('weekly', _('weekly')),
('weekdays', _('Mon-Fri')),
('user', _('user defined'))])
self.timerrntry_autosleepdelay = ConfigSelection(choices=time_table, default=self.timer.autosleepdelay)
self.timerentry_autosleeprepeat = ConfigSelection(choices=[('once', _('once')), ('repeated', _('repeated'))], default=self.timer.autosleeprepeat)
self.timerrntry_autosleepinstandbyonly = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.autosleepinstandbyonly)
self.timerrntry_autosleepwindow = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.autosleepwindow)
self.timerrntry_autosleepbegin = ConfigClock(default=self.timer.autosleepbegin)
self.timerrntry_autosleepend = ConfigClock(default=self.timer.autosleepend)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(default=(self.timer.end - self.timer.begin) / 60 > 4, choices=[(True, _('yes')), (False, _('no'))])
self.timerentry_repeatedbegindate = ConfigDateTime(default=self.timer.repeatedbegindate, formatstring=_('%d.%B %Y'), increment=86400)
self.timerentry_weekday = ConfigSelection(default=weekday_table[weekday], choices=[('mon', _('Monday')),
('tue', _('Tuesday')),
('wed', _('Wednesday')),
('thu', _('Thursday')),
('fri', _('Friday')),
('sat', _('Saturday')),
('sun', _('Sunday'))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
self.timerrntry_showExtended = ConfigSelection(default=self.timer.nettraffic == 'yes' or self.timer.netip == 'yes', choices=[(True, _('yes')), (False, _('no'))])
self.timerrntry_nettraffic = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.nettraffic)
self.timerrntry_trafficlimit = ConfigSelection(choices=traffic_table, default=self.timer.trafficlimit)
self.timerrntry_netip = ConfigSelection(choices=[('yes', _('Yes')), ('no', _('No'))], default=self.timer.netip)
self.timerrntry_ipadress = self.timer.ipadress.split(',')
self.ipcount = ConfigSelectionNumber(default=len(self.timerrntry_ipadress), stepwidth=1, min=1, max=5)
self.ipadressEntry = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5):
try:
self.ipadressEntry.append(ConfigIP(default=[ int(n) for n in self.timerrntry_ipadress[x].split('.') ] or [0,
0,
0,
0]))
except:
self.ipadressEntry.append(ConfigIP(default=[0,
0,
0,
0]))
return
示例14: TimerEntry
#.........这里部分代码省略.........
self.timerentry_afterevent = ConfigSelection(
choices=[
("nothing", _("do nothing")),
("wakeup", _("wakeup")),
("wakeuptostandby", _("wakeup to standby")),
("standby", _("go to standby")),
("deepstandby", shutdownString),
("nothing", _("do nothing")),
],
default=afterevent,
)
self.timerentry_type = ConfigSelection(choices=[("once", _("once")), ("repeated", _("repeated"))], default=type)
self.timerentry_repeated = ConfigSelection(
default=repeated,
choices=[
("daily", _("daily")),
("weekly", _("weekly")),
("weekdays", _("Mon-Fri")),
("user", _("user defined")),
],
)
self.timerrntry_autosleepdelay = ConfigSelection(choices=time_table, default=self.timer.autosleepdelay)
self.timerentry_autosleeprepeat = ConfigSelection(
choices=[("once", _("once")), ("repeated", _("repeated"))], default=self.timer.autosleeprepeat
)
self.timerrntry_autosleepinstandbyonly = ConfigSelection(
choices=[("yes", _("only in Standby")), ("no", _("Standard (always)")), ("noquery", _("without Query"))],
default=self.timer.autosleepinstandbyonly,
)
self.timerrntry_autosleepwindow = ConfigSelection(
choices=[("yes", _("Yes")), ("no", _("No"))], default=self.timer.autosleepwindow
)
self.timerrntry_autosleepbegin = ConfigClock(default=self.timer.autosleepbegin)
self.timerrntry_autosleepend = ConfigClock(default=self.timer.autosleepend)
self.timerentry_date = ConfigDateTime(default=self.timer.begin, formatstring=_("%d.%B %Y"), increment=86400)
self.timerentry_starttime = ConfigClock(default=self.timer.begin)
self.timerentry_endtime = ConfigClock(default=self.timer.end)
self.timerentry_showendtime = ConfigSelection(
default=(((self.timer.end - self.timer.begin) / 60) > 4), choices=[(True, _("yes")), (False, _("no"))]
)
self.timerentry_repeatedbegindate = ConfigDateTime(
default=self.timer.repeatedbegindate, formatstring=_("%d.%B %Y"), increment=86400
)
self.timerentry_weekday = ConfigSelection(
default=weekday_table[weekday],
choices=[
("mon", _("Monday")),
("tue", _("Tuesday")),
("wed", _("Wednesday")),
("thu", _("Thursday")),
("fri", _("Friday")),
("sat", _("Saturday")),
("sun", _("Sunday")),
],
)
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default=day[x]))
self.timerrntry_showExtended = ConfigSelection(
default=(self.timer.nettraffic == "yes" or self.timer.netip == "yes"),
示例15: TimerEntry
#.........这里部分代码省略.........
weekday = x
if flags & 1 == 1: # set user defined flags
day[x] = 1
count += 1
else:
day[x] = 0
flags >>= 1
if count == 1:
repeated = "weekly"
else: # once
type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
autosleepinstandbyonly = self.timer.autosleepinstandbyonly
autosleepdelay = self.timer.autosleepdelay
autosleeprepeat = self.timer.autosleeprepeat
if SystemInfo["DeepstandbySupport"]:
shutdownString = _("go to deep standby")
else:
shutdownString = _("shut down")
self.timerentry_timertype = ConfigSelection(choices = [("wakeup", _("wakeup")),("wakeuptostandby", _("wakeup to standby")), ("autostandby", _("auto standby")), ("autodeepstandby", _("auto deepstandby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("reboot", _("reboot system")), ("restart", _("restart GUI"))], default = timertype)
self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("wakeuptostandby", _("wakeup to standby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("nothing", _("do nothing"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])
self.timerrntry_autosleepdelay = ConfigInteger(default=autosleepdelay, limits = (10, 300))
self.timerentry_autosleeprepeat = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = autosleeprepeat)
self.timerrntry_autosleepinstandbyonly = ConfigSelection(choices = [("yes",_("Yes")), ("no", _("No"))],default=autosleepinstandbyonly)
self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
self.timerentry_showendtime = ConfigSelection(default = (((self.timer.end - self.timer.begin) /60 ) > 1), choices = [(True, _("yes")), (False, _("no"))])
self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)
self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])
self.timerentry_day = ConfigSubList()
for x in (0, 1, 2, 3, 4, 5, 6):
self.timerentry_day.append(ConfigYesNo(default = day[x]))
def createSetup(self, widget):
self.list = []
self.timerType = getConfigListEntry(_("Timer type"), self.timerentry_timertype)
self.list.append(self.timerType)
if self.timerentry_timertype.value == "autostandby" or self.timerentry_timertype.value == "autodeepstandby":
if self.timerentry_timertype.value == "autodeepstandby":
self.list.append(getConfigListEntry(_("Only active when in standby"), self.timerrntry_autosleepinstandbyonly))
self.list.append(getConfigListEntry(_("Sleep delay"), self.timerrntry_autosleepdelay))
self.list.append(getConfigListEntry(_("Repeat type"), self.timerentry_autosleeprepeat))
self.timerTypeEntry = getConfigListEntry(_("Repeat type"), self.timerentry_type)
self.entryShowEndTime = getConfigListEntry(_("Set end time"), self.timerentry_showendtime)
self.frequencyEntry = getConfigListEntry(_("Repeats"), self.timerentry_repeated)
else:
self.timerTypeEntry = getConfigListEntry(_("Repeat type"), self.timerentry_type)
self.list.append(self.timerTypeEntry)
if self.timerentry_type.value == "once":
self.frequencyEntry = None
else: # repeated