Make configure() do something for all plugins, also fix a couple of things from r197-203

This commit is contained in:
Terence Simpson
2010-05-29 14:36:43 +01:00
parent 3676ea1efd
commit 55ca23f755
7 changed files with 112 additions and 14 deletions

View File

@ -17,14 +17,35 @@ import supybot.conf as conf
import supybot.registry as registry
def configure(advanced):
from supybot.questions import expect, something, yn
from supybot.questions import expect, something, yn, output
def anything(prompt, default=None):
"""Because supybot is pure fail"""
from supybot.questions import expect
return expect(prompt, [], default=default)
conf.registerPlugin('Webcal', True)
Webcal = conf.registerPlugin('Webcal', True)
output("Every option, except for the default channel and URL to a list of time zones, is channel-specific.")
output("The values you enter here will be the defaults unless overridden by a channel-specific value")
doTopic = yn("Manage the topic for all channels?", default=Webcal.doTopic._default)
url = anything("What is the default URL to the iCal feed, for all channels?", default=Webcal.url._default)
defaultChannel = anything("What channel should be default when none is given?", default=Webcal.defaultChannel._default)
tzUrl = anything("What is the URL to the list of available time zonez?", default=Webcal.tzUrl._default)
if advanced:
filter = anything("What should the filter be for the iCal feed, for all channels?", default=Webcal.filter._default)
topic = anything("What template should be used for the topic, for all channels", default=Webcal.topic._default)
else:
filter = Webcal.filter._default
topic = Webcal.topic._default
Webcal.doTopic.setValue(doTopic)
Webcal.url.setValue(url)
Webcal.defaultChannel.setValue(defaultChannel)
Webcal.tzUrl.setValue(tzUrl)
Webcal.filter.setValue(filter)
Webcal.topic.setValue(topic)
Webcal = conf.registerPlugin('Webcal')
conf.registerChannelValue(conf.supybot.plugins.Webcal, 'url',
@ -38,4 +59,4 @@ conf.registerChannelValue(conf.supybot.plugins.Webcal, 'doTopic',
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'defaultChannel',
registry.String('',"""Default channel to determine schedule for /msg replies"""))
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'tzUrl',
registry.String('', """URL to the list of timezones supported by the Webcal plugin"""))
registry.String('http://ubottu.com/timezones.html', """URL to the list of timezones supported by the Webcal plugin"""))