当前位置: 首页>>代码示例>>Python>>正文


Python ConfigSubsection.level方法代码示例

本文整理汇总了Python中Components.config.ConfigSubsection.level方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigSubsection.level方法的具体用法?Python ConfigSubsection.level怎么用?Python ConfigSubsection.level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Components.config.ConfigSubsection的用法示例。


在下文中一共展示了ConfigSubsection.level方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addHost

# 需要导入模块: from Components.config import ConfigSubsection [as 别名]
# 或者: from Components.config.ConfigSubsection import level [as 别名]
def addHost(name):
    s = ConfigSubsection()
    s.name = ConfigText(default=name, fixed_size=False)
    s.enable_incoming = ConfigYesNo(default=False)
    s.enable_outgoing = ConfigYesNo(default=False)
    s.address = ConfigText(fixed_size=False)
    s.password = ConfigPassword()
    s.protocol = ConfigSelection(
        default="growl",
        choices=[
            ("growl", "Growl"),
            ("gntp", "GNTP"),
            ("snarl", "Snarl"),
            ("prowl", "Prowl"),
            ("syslog", "Syslog UDP"),
        ],
    )
    s.level = ConfigSelection(
        default="-1",
        choices=[
            ("-1", _("Low (Yes/No)")),
            ("0", _("Normal (Information)")),
            ("1", _("High (Warning)")),
            ("2", _("Highest (Emergency)")),
        ],
    )
    s.blacklist = ConfigSet(choices=[])
    config.plugins.growlee.hosts.append(s)
    return s
开发者ID:Roxy1139,项目名称:enigma2-plugins,代码行数:31,代码来源:plugin.py

示例2: ConfigYesNo

# 需要导入模块: from Components.config import ConfigSubsection [as 别名]
# 或者: from Components.config.ConfigSubsection import level [as 别名]
# since internally we assume to have at least 1 host configured
if growlee.hostcount.value == 0:
    growlee.enable_outgoing = ConfigYesNo(default=False)
    growlee.enable_incoming = ConfigYesNo(default=False)
    growlee.address = ConfigText(fixed_size=False)
    growlee.password = ConfigPassword()
    password = growlee.password.value
    growlee.prowl_api_key = ConfigText()
    growlee.protocol = ConfigSelection(
        default="growl", choices=[("growl", "Growl"), ("snarl", "Snarl"), ("prowl", "Prowl")]
    )
    growlee.level = ConfigSelection(
        default="-1",
        choices=[
            ("-1", _("Low (Yes/No)")),
            ("0", _("Normal (Information)")),
            ("1", _("High (Warning)")),
            ("2", _("Highest (Emergency)")),
        ],
    )
    growlee.blacklist = ConfigSet(choices=[])
    if growlee.protocol.value == "prowl":
        password = growlee.prowl_api_key.value

    s = addHost(_("Converted connection"))
    s.enable_incoming.value = growlee.enable_incoming.value
    s.enable_outgoing.value = growlee.enable_outgoing.value
    s.address.value = growlee.address.value
    s.password.value = password
    s.protocol.value = growlee.protocol.value
    s.level.value = growlee.level.value
开发者ID:Roxy1139,项目名称:enigma2-plugins,代码行数:33,代码来源:plugin.py


注:本文中的Components.config.ConfigSubsection.level方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。