本文整理汇总了Python中Components.config.ConfigSubList.append方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigSubList.append方法的具体用法?Python ConfigSubList.append怎么用?Python ConfigSubList.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.config.ConfigSubList
的用法示例。
在下文中一共展示了ConfigSubList.append方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.timer = timer
self.entryDate = None
self.entryService = None
self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
self["oktext"] = Label(_("OK"))
self["canceltext"] = Label(_("Cancel"))
self["ok"] = Pixmap()
self["cancel"] = Pixmap()
# self["summary_description"] = StaticText("")
self["description"] = Label("")
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,
"up": self.keyUp,
"down": self.keyDown,
},
-2,
)
self.list = []
ConfigListScreen.__init__(self, self.list, session=session)
self.setTitle(_("PowerManager entry"))
self.createSetup("config")
def createConfig(self):
afterevent = {
AFTEREVENT.NONE: "nothing",
AFTEREVENT.WAKEUP: "wakeup",
AFTEREVENT.WAKEUPTOSTANDBY: "wakeuptostandby",
AFTEREVENT.STANDBY: "standby",
AFTEREVENT.DEEPSTANDBY: "deepstandby",
}[self.timer.afterEvent]
timertype = {
TIMERTYPE.NONE: "nothing",
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")
time_table = [
(1, "1"),
(3, "3"),
(5, "5"),
(10, "10"),
(15, "15"),
(30, "30"),
(45, "45"),
(60, "60"),
(75, "75"),
(90, "90"),
(105, "105"),
(120, "120"),
(135, "135"),
(150, "150"),
(165, "165"),
(180, "180"),
(195, "195"),
(210, "210"),
(225, "225"),
(240, "240"),
(255, "255"),
(270, "270"),
(285, "285"),
(300, "300"),
]
traffic_table = [(10, "10"), (50, "50"), (100, "100"), (500, "500"), (1000, "1000")]
# 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"
#.........这里部分代码省略.........
示例2: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.setup_title = _("Timer entry")
self.timer = timer
self.entryDate = None
self.entryService = None
self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
self["description"] = Label("")
self["oktext"] = Label(_("OK"))
self["canceltext"] = Label(_("Cancel"))
self["ok"] = Pixmap()
self["cancel"] = Pixmap()
self["key_yellow"] = Label(_("Timer type"))
self.createConfig()
self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions", "ColorActions"],
{
"ok": self.keySelect,
"save": self.keyGo,
"cancel": self.keyCancel,
"volumeUp": self.incrementStart,
"volumeDown": self.decrementStart,
"size+": self.incrementEnd,
"size-": self.decrementEnd,
"yellow": self.changeTimerType
}, -2)
self.onChangedEntry = [ ]
self.list = []
ConfigListScreen.__init__(self, self.list, session = session)
self.createSetup("config")
self.onLayoutFinish.append(self.layoutFinished)
if not self.selectionChanged in self["config"].onSelectionChanged:
self["config"].onSelectionChanged.append(self.selectionChanged)
self.selectionChanged()
def createConfig(self):
justplay = self.timer.justplay
always_zap = self.timer.always_zap
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 >>= 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")
#.........这里部分代码省略.........
示例3: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
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["key_yellow"] = Label(_("Timer type"))
self["key_blue"] = Label()
self.createConfig()
self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions", "ColorActions"],
{
"ok": self.keySelect,
"save": self.keyGo,
"cancel": self.keyCancel,
"volumeUp": self.incrementStart,
"volumeDown": self.decrementStart,
"size+": self.incrementEnd,
"size-": self.decrementEnd,
"yellow": self.changeTimerType,
"blue": self.changeZapWakeupType
}, -2)
self.list = []
ConfigListScreen.__init__(self, self.list, session = session)
self.setTitle(_("Timer entry"))
self.createSetup("config")
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)
#.........这里部分代码省略.........
示例4: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.timer = timer
self.entryDate = None
self.entryService = None
self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
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.setTitle(_("PowerManager entry"))
self.createSetup("config")
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)
#.........这里部分代码省略.........
示例5: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
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)
#.........这里部分代码省略.........
示例6: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.setup_title = _('Timer entry')
self.timer = timer
self.entryDate = None
self.entryService = None
self['HelpWindow'] = Pixmap()
self['HelpWindow'].hide()
self['VKeyIcon'] = Boolean(False)
self['description'] = Label('')
self['oktext'] = Label(_('OK'))
self['canceltext'] = Label(_('Cancel'))
self['ok'] = Pixmap()
self['cancel'] = Pixmap()
self.createConfig()
self['actions'] = NumberActionMap(['SetupActions',
'GlobalActions',
'PiPSetupActions',
'ColorActions'], {'ok': self.keySelect,
'save': self.keyGo,
'cancel': self.keyCancel,
'volumeUp': self.incrementStart,
'volumeDown': self.decrementStart,
'size+': self.incrementEnd,
'size-': self.decrementEnd}, -2)
self['VirtualKB'] = ActionMap(['VirtualKeyboardActions'], {'showVirtualKeyboard': self.KeyText}, -2)
self['VirtualKB'].setEnabled(False)
self.onChangedEntry = []
self.list = []
ConfigListScreen.__init__(self, self.list, session=session)
self.createSetup('config')
self.onLayoutFinish.append(self.layoutFinished)
if self.selectionChanged not in self['config'].onSelectionChanged:
self['config'].onSelectionChanged.append(self.selectionChanged)
self.selectionChanged()
return
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)
#.........这里部分代码省略.........
示例7: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen, HelpableScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
HelpableScreen.__init__(self)
self.setup_title = _("Timer entry")
self.timer = timer
self.entryDate = None
self.entryService = None
self["HelpWindow"] = Pixmap()
self["HelpWindow"].hide()
self["VKeyIcon"] = Pixmap()
self["description"] = Label("")
self["key_red"] = Label(_("Cancel"))
self["key_green"] = Label(_("OK"))
self["key_yellow"] = Label()
self["key_blue"] = Label()
self.createConfig()
self["actions"] = HelpableNumberActionMap(self, ["SetupActions", "GlobalActions", "PiPSetupActions", "ColorActions"], {
"ok": (self.keySelect, _("Save the timer and exit")),
"save": (self.keyGo, "Save the timer and exit"),
"cancel": (self.keyCancel, "Cancel creation of the timer and exit"),
"volumeUp": (self.incrementStart, _("Increment start time")),
"volumeDown": (self.decrementStart, _("Decrement start time")),
"size+": (self.incrementEnd, _("Increment end time")),
"size-": (self.decrementEnd, _("Decrement end time"))
}, -2)
self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], {
"showVirtualKeyboard": self.KeyText,
}, -2)
self["VirtualKB"].setEnabled(False)
self.onChangedEntry = []
self.list = []
ConfigListScreen.__init__(self, self.list, session=session)
self.createSetup("config")
self.onLayoutFinish.append(self.layoutFinished)
if self.selectionChanged not in self["config"].onSelectionChanged:
self["config"].onSelectionChanged.append(self.selectionChanged)
self.selectionChanged()
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")
# calculate default values
day = []
weekday = 0
for x in (0, 1, 2, 3, 4, 5, 6):
day.append(0)
if self.timer.repeated: # repeated
repeat_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
repeat_type = "once"
repeated = None
weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
day[weekday] = 1
#.........这里部分代码省略.........
示例8: SkinpartSettingsView
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class SkinpartSettingsView(ConfigListScreen, Screen):
skin = """
<screen name="MyMetrixLiteOtherView" position="0,0" size="1280,720" flags="wfNoBorder" backgroundColor="transparent">
<eLabel name="new eLabel" position="40,40" zPosition="-2" size="1200,640" backgroundColor="#00000000" transparent="0" />
<widget source="titleText" position="60,55" size="590,50" render="Label" font="Regular; 40" foregroundColor="#00ffffff" backgroundColor="#00000000" valign="center" transparent="1" />
<widget name="config" position="61,124" size="590,480" backgroundColor="#00000000" foregroundColor="#00ffffff" scrollbarMode="showOnDemand" transparent="1" />
<widget source="cancelBtn" position="70,640" size="160,30" render="Label" font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#00000000" halign="left" transparent="1" />
<widget source="saveBtn" position="257,640" size="160,30" render="Label" font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#00000000" halign="left" transparent="1" />
<widget source="defaultsBtn" position="445,640" size="160,30" render="Label" font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#00000000" halign="left" transparent="1" />
<widget source="zoomBtn" position="631,640" size="360,30" render="Label" font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#00000000" halign="left" transparent="1" />
<eLabel position="55,635" size="5,40" backgroundColor="#00e61700" />
<eLabel position="242,635" size="5,40" backgroundColor="#0061e500" />
<eLabel position="430,635" size="5,40" backgroundColor="#00e5dd00" />
<eLabel position="616,635" size="5,40" backgroundColor="#000064c7" />
<widget name="helperimage" position="840,222" size="256,256" backgroundColor="#00000000" zPosition="1" transparent="1" alphatest="blend" />
<widget name="helpertext" position="800,490" size="336,160" font="Regular; 18" backgroundColor="#00000000" foregroundColor="#00ffffff" halign="center" valign="center" transparent="1"/>
</screen>
"""
def __init__(self, session, args = None):
Screen.__init__(self, session)
self.session = session
self.Scale = AVSwitch().getFramebufferScale()
self.PicLoad = ePicLoad()
self["helperimage"] = Pixmap()
self["helpertext"] = Label()
self["titleText"] = StaticText("")
self["titleText"].setText(_("Skinpart settings"))
self["cancelBtn"] = StaticText("")
self["cancelBtn"].setText(_("Cancel"))
self["saveBtn"] = StaticText("")
self["saveBtn"].setText(_("Save"))
self["defaultsBtn"] = StaticText("")
self["defaultsBtn"].setText(_("Defaults"))
self["zoomBtn"] = StaticText("")
self["zoomBtn"].setText(_("Zoom"))
initOtherConfig()
self.getSkinParts()
ConfigListScreen.__init__(
self,
self.getMenuItemList(),
session = session,
on_change = self.__selectionChanged
)
self["actions"] = ActionMap(
[
"OkCancelActions",
"DirectionActions",
"InputActions",
"ColorActions"
],
{
"left": self.keyLeft,
"down": self.keyDown,
"up": self.keyUp,
"right": self.keyRight,
"red": self.exit,
"green": self.save,
"blue": self.zoom,
"yellow": self.__defaults,
"cancel": self.exit
}, -1)
self.onLayoutFinish.append(self.UpdatePicture)
def __selectionChanged(self):
cur = self["config"].getCurrent()
cur = cur and len(cur) > 3 and cur[3]
if cur == "ENABLED":
self["config"].setList(self.getMenuItemList())
def getMenuItemList(self):
list = []
char = 150
tab = " "*10
sep = "-"
nodesc = _("No description available.")
noprev = _("\n(No preview picture available.)")
section = _("/usr/share/enigma2/MetrixHD/skinparts/[part]/[part].xml")
list.append(getConfigListEntry(section + tab + sep*(char-len(section)-len(tab)), ))
pidx = 0
for part in self.partlist:
if not self.screens[pidx]:
part.value='0'
if not path.isfile(self.parts[pidx][0][0] + self.parts[pidx][0][2] + 'xml'):
itext = _("Skinpart are not available - can't be activated.")
else:
itext = _("No screens in skinpart are available - can't be activated.")
else:
if not self.parts[pidx][0][3]:
#.........这里部分代码省略.........
示例9: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
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()
#.........这里部分代码省略.........
示例10: TimerEntry
# 需要导入模块: from Components.config import ConfigSubList [as 别名]
# 或者: from Components.config.ConfigSubList import append [as 别名]
class TimerEntry(Screen, ConfigListScreen):
def __init__(self, session, timer):
Screen.__init__(self, session)
self.timer = timer
self.entryDate = None
self.entryService = None
self['HelpWindow'] = Pixmap()
self['HelpWindow'].hide()
self['oktext'] = Label(_('OK'))
self['canceltext'] = Label(_('Cancel'))
self['ok'] = Pixmap()
self['cancel'] = Pixmap()
self['summary_description'] = StaticText('')
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,
'up': self.keyUp,
'down': self.keyDown}, -2)
self.list = []
ConfigListScreen.__init__(self, self.list, session=session)
self.setTitle(_('PowerManager entry'))
self.createSetup('config')
return
def createConfig(self):
afterevent = {AFTEREVENT.NONE: 'nothing',
AFTEREVENT.WAKEUP: 'wakeup',
AFTEREVENT.WAKEUPTOSTANDBY: 'wakeuptostandby',
AFTEREVENT.STANDBY: 'standby',
AFTEREVENT.DEEPSTANDBY: 'deepstandby'}[self.timer.afterEvent]
timertype = {TIMERTYPE.NONE: 'nothing',
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')
time_table = [(1, '1'),
(3, '3'),
(5, '5'),
(10, '10'),
(15, '15'),
(30, '30'),
(45, '45'),
(60, '60'),
(75, '75'),
(90, '90'),
(105, '105'),
(120, '120'),
(135, '135'),
(150, '150'),
(165, '165'),
(180, '180'),
(195, '195'),
(210, '210'),
(225, '225'),
(240, '240'),
(255, '255'),
(270, '270'),
(285, '285'),
(300, '300')]
traffic_table = [(10, '10'),
(50, '50'),
(100, '100'),
(500, '500'),
(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
#.........这里部分代码省略.........