mirror of https://github.com/Mikaela/Limnoria.git
Made a showDefault configuration option for deciding whether or not to write the default to the registry, and made registerPlugin set it to False (who needs to know what the default is for that stuff?)
This commit is contained in:
parent
20285ae546
commit
d6f79c4a56
|
@ -59,7 +59,7 @@ supybot.setName('supybot')
|
|||
|
||||
def registerPlugin(name, currentValue=None):
|
||||
supybot.plugins.register(name, registry.Boolean(False, """Determines
|
||||
whether this plugin is loaded by default."""))
|
||||
whether this plugin is loaded by default.""", showDefault=False))
|
||||
if currentValue is not None:
|
||||
supybot.plugins.get(name).setValue(currentValue)
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
|
|||
lines.insert(0, '\n')
|
||||
if hasattr(value, 'value'):
|
||||
lines.append('#\n')
|
||||
if value.showDefault:
|
||||
try:
|
||||
original = value.value
|
||||
value.value = value.default
|
||||
|
@ -190,9 +191,10 @@ class Group(object):
|
|||
|
||||
|
||||
class Value(Group):
|
||||
def __init__(self, default, help, **kwargs):
|
||||
def __init__(self, default, help, showDefault=True, **kwargs):
|
||||
Group.__init__(self, **kwargs)
|
||||
self.default = default
|
||||
self.showDefault = showDefault
|
||||
self.help = utils.normalizeWhitespace(help.strip())
|
||||
self.setValue(default)
|
||||
|
||||
|
|
Loading…
Reference in New Issue