本文整理汇总了Python中Components.config.ConfigSubsection类的典型用法代码示例。如果您正苦于以下问题:Python ConfigSubsection类的具体用法?Python ConfigSubsection怎么用?Python ConfigSubsection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigSubsection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initWeatherPluginEntryConfig
def initWeatherPluginEntryConfig():
s = ConfigSubsection()
s.city = ConfigText(default = "Heidelberg", visible_width = 100, fixed_size = False)
s.degreetype = ConfigSelection(choices = [("C", _("metric system")), ("F", _("imperial system"))], default = "C")
s.weatherlocationcode = ConfigText(default = "", visible_width = 100, fixed_size = False)
config.plugins.WeatherPlugin.Entry.append(s)
return s
示例2: ftpserverFromURI
def ftpserverFromURI(uri, name = "", save = True):
scheme, host, port, path, username, password = _parse(uri, defaultPort = 21)
newServer = ConfigSubsection()
if save:
config.plugins.ftpbrowser.server.append(newServer)
newServer.name = ConfigText(fixed_size = False)
newServer.name.value = name or host
newServer.address = ConfigText(fixed_size = False)
newServer.address.value = host
newServer.username = ConfigText(fixed_size = False)
newServer.username.value = username
newServer.password = ConfigPassword()
newServer.password.value = password
newServer.port = ConfigInteger(0, (0, 65535))
newServer.port.value = port
newServer.passive = ConfigYesNo(False)
newServer.connectiontype = ConfigYesNo(False)
if save:
newServer.save()
config.plugins.ftpbrowser.servercount.value += 1
config.plugins.ftpbrowser.servercount.save()
return FTPServer(newServer)
示例3: initWeatherPluginEntryConfig
def initWeatherPluginEntryConfig():
s = ConfigSubsection()
s.city = ConfigText(default='Heidelberg', visible_width=100, fixed_size=False)
s.degreetype = ConfigSelection(choices=[('C', _('metric system')), ('F', _('imperial system'))], default='C')
s.weatherlocationcode = ConfigText(default='', visible_width=100, fixed_size=False)
config.plugins.WeatherPlugin.Entry.append(s)
return s
示例4: new
def new(self):
l = config.plugins.simpleRSS.feed
s = ConfigSubsection()
s.uri = ConfigText(default="http://", fixed_size = False)
s.autoupdate = ConfigOnOff(default=True)
id = len(l)
l.append(s)
self.session.openWithCallback(self.conditionalNew, RSSFeedEdit, id)
示例5: createPage
def createPage():
""" Create and return a configuration page object """
s = ConfigSubsection()
s.uri = ConfigText(default="http://", fixed_size=False)
s.title = ConfigText(
default = "Page #" + str(len(config.plugins.CurlyTx.pages) + 1),
fixed_size = False
)
s.fontSize = ConfigInteger(20, (1, 100))
return s
示例6: addHost
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
示例7: new
def new(self):
newUserConfigSubsection = ConfigSubsection()
config.plugins.youtubeplayer.users.append(newUserConfigSubsection)
newUserConfigSubsection.name = ConfigText("User " + str(self.__getUserCount()), False)
if newUserConfigSubsection.name.value == newUserConfigSubsection.name.default:
newUserConfigSubsection.name.default = ""
newUserConfigSubsection.email = ConfigText("", False)
newUserConfigSubsection.password = ConfigText("", False)
newUser = YouTubeUser(newUserConfigSubsection)
self.userlist.append(newUser)
return newUser
示例8: addFeed
def addFeed(address, auto = False):
l = config.plugins.simpleRSS.feed
# Create new Item
s = ConfigSubsection()
s.uri = ConfigText(default="http://", fixed_size = False)
s.autoupdate = ConfigOnOff(default=True)
# Set values
s.uri.value = address
s.autoupdate.value = auto
# Save
l.append(s)
l.save()
示例9: createConfig
def createConfig(self):
def setVlt(fancontrol, fanid, configElement):
fancontrol.setVoltage(fanid, configElement.value)
def setPWM(fancontrol, fanid, configElement):
fancontrol.setPWM(fanid, configElement.value)
config.fans = ConfigSubList()
for fanid in range(self.getFanCount()):
fan = ConfigSubsection()
fan.vlt = ConfigSlider(default = 15, increment = 5, limits = (0, 255))
fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
fan.vlt_standby = ConfigSlider(default = 5, increment = 5, limits = (0, 255))
fan.pwm_standby = ConfigSlider(default = 0, increment = 5, limits = (0, 255))
fan.vlt.addNotifier(boundFunction(setVlt, self, fanid))
fan.pwm.addNotifier(boundFunction(setPWM, self, fanid))
config.fans.append(fan)
示例10: __init__
def __init__(self, session, args = 0):
self.session = session
self.setup_title = _("Movie List Configuration")
Screen.__init__(self, session)
cfg = ConfigSubsection()
self.cfg = cfg
# this kludge is needed because ConfigSelection only takes numbers
# and someone appears to be fascinated by 'enums'.
cfg.moviesort = ConfigSelection(default=str(config.movielist.moviesort.value), choices = [
(str(MovieList.SORT_RECORDED), _("sort by date")),
(str(MovieList.SORT_ALPHANUMERIC), _("alphabetic sort")),
(str(MovieList.SHUFFLE), _("shuffle"))])
cfg.listtype = ConfigSelection(default=str(config.movielist.listtype.value), choices = [
(str(MovieList.LISTTYPE_ORIGINAL), _("list style default")),
(str(MovieList.LISTTYPE_COMPACT_DESCRIPTION), _("list style compact with description")),
(str(MovieList.LISTTYPE_COMPACT), _("list style compact")),
(str(MovieList.LISTTYPE_MINIMAL), _("list style single line"))])
cfg.description = ConfigYesNo(default=(config.movielist.description.value != MovieList.HIDE_DESCRIPTION))
configList = [
getConfigListEntry(_("Sort"), cfg.moviesort),
getConfigListEntry(_("show extended description"), cfg.description),
getConfigListEntry(_("Type"), cfg.listtype),
getConfigListEntry(_("Load Length of Movies in Movielist"), config.usage.load_length_of_movies_in_moviellist),
getConfigListEntry(_("Show status icons in Movielist"), config.usage.show_icons_in_movielist),
getConfigListEntry(_("Show icon for new/unseen items"), config.usage.movielist_unseen),
getConfigListEntry(_("Play audio in background"), config.movielist.play_audio_internal),
]
for k,v in userDefinedButtons.items():
configList.append(getConfigListEntry(_(k), v))
ConfigListScreen.__init__(self, configList, session=session, on_change = self.changedEntry)
self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Ok"))
self["key_yellow"] = Button("")
self["key_blue"] = Button("")
self["statusbar"] = Label()
self["status"] = Label()
self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
{
"red": self.cancel,
"green": self.save,
"save": self.save,
"cancel": self.cancel,
"ok": self.save,
}, -2)
self.onChangedEntry = []
示例11: createConfig
def createConfig(self, foo):
global tuning
if not tuning:
tuning = ConfigSubsection()
tuning.type = ConfigSelection(
default = "manual_transponder",
choices = { "manual_transponder" : _("Manual transponder"),
"predefined_transponder" : _("Predefined transponder") } )
tuning.sat = ConfigSatlist(list=nimmanager.getRotorSatListForNim(self.feid))
tuning.sat.addNotifier(self.tuningSatChanged)
self.updateTransponders()
orb_pos = self.fe_data.get("orbital_position", None)
if orb_pos is not None:
for x in nimmanager.getRotorSatListForNim(self.feid):
opos = str(orb_pos)
if x[0] == orb_pos and tuning.sat.value != opos:
tuning.sat.value = opos
del self.fe_data["orbital_position"]
ScanSetup.createConfig(self, self.fe_data)
示例12: add
def add(self):
newServer = ConfigSubsection()
config.plugins.ftpbrowser.server.append(newServer)
newServer.name = ConfigText("Name", fixed_size = False)
newServer.address = ConfigText("192.168.2.12", fixed_size = False)
newServer.username = ConfigText("root", fixed_size = False)
newServer.password = ConfigPassword("dreambox")
newServer.port = ConfigInteger(21, (1, 65535))
newServer.passive = ConfigYesNo(False)
newServer.connectiontype = ConfigYesNo(False)
config.plugins.ftpbrowser.servercount.value += 1
config.plugins.ftpbrowser.servercount.save()
self.updateServerList()
self.changed = True
示例13: __init__
def __init__(self):
self.titles = [ ]
self.target = None
self.settings = ConfigSubsection()
self.settings.name = ConfigText(fixed_size = False, visible_width = 40)
self.settings.authormode = ConfigSelection(choices = [("menu_linked", _("Linked titles with a DVD menu")), ("just_linked", _("Direct playback of linked titles without menu")), ("menu_seperate", _("Seperate titles with a main menu")), ("data_ts", _("Dreambox format data DVD (HDTV compatible)"))])
self.settings.titlesetmode = ConfigSelection(choices = [("single", _("Simple titleset (compatibility for legacy players)")), ("multi", _("Complex (allows mixing audio tracks and aspects)"))], default="multi")
self.settings.output = ConfigSelection(choices = [("iso", _("Create DVD-ISO")), ("dvd", _("Burn DVD"))])
self.settings.isopath = ConfigText(fixed_size = False, visible_width = 40)
self.settings.dataformat = ConfigSelection(choices = [("iso9660_1", ("ISO9660 Level 1")), ("iso9660_4", ("ISO9660 version 2")), ("udf", ("UDF"))])
self.settings.menutemplate = ConfigFilename()
self.settings.vmgm = ConfigFilename()
self.filekeys = ["vmgm", "isopath", "menutemplate"]
self.menutemplate = MenuTemplate()
示例14: saveconfig
def saveconfig(self):
nim_config_list = []
if self.initial_state != config.clientmode.enabled.value and self.initial_state == False: # switching to client mode
# save normal mode config so it can be reinsated when returning to normal mode
nim_config_list = []
for x in config.Nims:
nim_config_list.append(x.getSavedValue())
import json
config.clientmode.nim_cache.value = json.dumps(nim_config_list)
config.clientmode.remote_fallback_enabled_cache.value = config.usage.remote_fallback_enabled.value
config.clientmode.remote_fallback_cache.value = config.usage.remote_fallback.value
# normal mode config values saved
if config.clientmode.enabled.value:
config.usage.remote_fallback_enabled.value = True
config.usage.remote_fallback.value = "http://%s:%d" % (self.getRemoteAddress(), config.clientmode.serverStreamingPort.value)
elif self.initial_state != config.clientmode.enabled.value: # switching back to normal mode
# load nim config from config.clientmode.nimcache
import json
nim_config_list = json.loads(config.clientmode.nim_cache.value)
config.clientmode.nim_cache.value = ""
config.Nims = ConfigSubList()
for x in nim_config_list:
tuner = ConfigSubsection()
tuner.setSavedValue(x)
config.Nims.append(tuner)
config.Nims.save()
# nim config loaded... but needs restart
# reinstate normal mode values
config.usage.remote_fallback_enabled.value = config.clientmode.remote_fallback_enabled_cache.value
config.usage.remote_fallback.value = config.clientmode.remote_fallback_cache.value
# reset some client mode settings
config.clientmode.remote_fallback_enabled_cache.value = False
config.clientmode.remote_fallback_cache.value = ""
config.usage.save()
config.clientmode.save()
configfile.save()
示例15: InitVcsProfile
def InitVcsProfile(profile=None, name=""):
if profile is None:
profile = ConfigSubsection()
profile.name = ConfigText("", fixed_size=False)
if not profile.name.value and name:
profile.name.value = name
profile.name.save()
profile.enabled = ConfigYesNo(default=True)
profile.stretch = ConfigSelection([("0",_("no")), ("1", _("yes"))], default="0")
profile.aspect = ConfigInteger(2)
profile.cliprect = ConfigPosition([0,0,720,576], (719,575,720,576))
return profile