TextArt: cleanup formatting

This commit is contained in:
oddluck 2020-06-02 02:20:33 +00:00
parent 1b60138584
commit 7b138d501f
4 changed files with 2445 additions and 661 deletions

View File

@ -36,22 +36,22 @@ import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "2020.02.24+git"
__version__ = "2020.06.01+git"
# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author('oddluck', 'oddluck',
'oddluck@riseup.net')
__author__ = supybot.Author("oddluck", "oddluck", "oddluck@riseup.net")
# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
__url__ = "https://github.com/oddluck/limnoria-plugins/"
from . import config
from . import plugin
from imp import reload
# In case we're being reloaded.
reload(config)
reload(plugin)
@ -63,4 +63,3 @@ if world.testing:
Class = plugin.Class
configure = config.configure

1113
TextArt/colors.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,11 @@
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('TextArt')
_ = PluginInternationalization("TextArt")
except:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
@ -44,57 +46,180 @@ def configure(advanced):
# user or not. You should effect your configuration by manipulating the
# registry as appropriate.
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('TextArt', True)
TextArt = conf.registerPlugin('TextArt')
conf.registerPlugin("TextArt", True)
conf.registerGlobalValue(TextArt, 'pasteAPI',
registry.String('', _("""Paste.ee API Key"""), private=True))
conf.registerGlobalValue(TextArt, 'imgurAPI',
registry.String('', _("""Imgur Client ID"""), private=True))
TextArt = conf.registerPlugin("TextArt")
conf.registerChannelValue(TextArt, 'pasteEnable',
registry.Boolean(False, _("""Turns on and off paste.ee support""")))
conf.registerGlobalValue(
TextArt, "pasteAPI", registry.String("", _("""Paste.ee API Key"""), private=True)
)
conf.registerChannelValue(TextArt, 'showStats',
registry.Boolean(False, _("""Turns on and off showing render stats.""")))
conf.registerGlobalValue(
TextArt, "imgurAPI", registry.String("", _("""Imgur Client ID"""), private=True)
)
conf.registerChannelValue(TextArt, 'delay',
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented.""")))
conf.registerChannelValue(
TextArt,
"pasteEnable",
registry.Boolean(False, _("""Turns on and off paste.ee support""")),
)
conf.registerChannelValue(TextArt, 'quantize',
registry.Boolean(False, _("""Enable quantizing to 256 colors before rendering. Results in much faster rendering at a slight decrease in quality. Default: False""")))
conf.registerChannelValue(
TextArt,
"showStats",
registry.Boolean(False, _("""Turns on and off showing render stats.""")),
)
conf.registerChannelValue(TextArt, 'resize',
registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming""")))
conf.registerChannelValue(
TextArt,
"delay",
registry.Float(
1.0, _("""Set the time delay betwen lines. Not currently implemented.""")
),
)
conf.registerChannelValue(TextArt, 'speed',
registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference.""")))
conf.registerChannelValue(
TextArt,
"quantize",
registry.Boolean(
False,
_(
"""
Enable quantizing to 256 colors before rendering. Results in much
faster rendering at a slight decrease in quality. Default: False
"""
),
),
)
conf.registerChannelValue(TextArt, 'imgDefault',
registry.String('1/2', _("""Set the default art type for the img command. Options are 'ascii', '1/2' (default), '1/4', 'block', and 'no-color'""")))
conf.registerChannelValue(
TextArt,
"resize",
registry.Integer(
3,
_(
"""
Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 =
bicubic, 4 = box, 5 = hamming"""
),
),
)
conf.registerChannelValue(TextArt, 'asciiWidth',
registry.Integer(100, _("""Set the default column width for ascii art images""")))
conf.registerChannelValue(
TextArt,
"speed",
registry.String(
"Slow",
_(
"""
Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000
color difference. 'Fast' to use Euclidean color difference.
"""
),
),
)
conf.registerChannelValue(TextArt, 'blockWidth',
registry.Integer(80, _("""Set the default column width for 1/2 and 1/4 block art images""")))
conf.registerChannelValue(
TextArt,
"imgDefault",
registry.String(
"1/2",
_(
"""
Set the default art type for the img command. Options are 'ascii', '1/2'
(default), '1/4', 'block', and 'no-color'
"""
),
),
)
conf.registerChannelValue(TextArt, 'colors',
registry.Integer(99, _("""Set the default number of colors to use. Options are 16 for colors 0-15 only, 83 for colors 16-98 only, and 99 (default) to use all available colors""")))
conf.registerChannelValue(
TextArt,
"asciiWidth",
registry.Integer(100, _("""Set the default column width for ascii art images""")),
)
conf.registerChannelValue(TextArt, 'fg',
registry.Integer(99, _("""Set the default foreground color for ascii art images. 0-98. 99 is disabled (default)""")))
conf.registerChannelValue(
TextArt,
"blockWidth",
registry.Integer(
80, _("""
Set the default column width for 1/2 and 1/4 block art images
""")
),
)
conf.registerChannelValue(TextArt, 'bg',
registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)""")))
conf.registerChannelValue(
TextArt,
"colors",
registry.Integer(
99,
_(
"""
Set the default number of colors to use. Options are 16 for colors 0-15
only, 83 for colors 16-98 only, and 99 (default) to use all available colors
"""
),
),
)
conf.registerChannelValue(TextArt, 'maxLength',
registry.Integer(20, _("""Set the maximum character length for text to figlet inputs""")))
conf.registerChannelValue(
TextArt,
"fg",
registry.Integer(
99,
_(
"""Set the default foreground color for ascii art images. 0-98.
99 is disabled (default)"""
),
),
)
conf.registerChannelValue(TextArt, 'maxWords',
registry.Integer(4, _("""Set the maximum number of words for text to figlet inputs""")))
conf.registerChannelValue(
TextArt,
"bg",
registry.Integer(
99,
_(
"""
Set the default background color for ascii art images. 0-98. 99 is disabled
(default)"""
),
),
)
conf.registerGlobalValue(TextArt, 'userAgents',
registry.CommaSeparatedListOfStrings(["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"], _("""Reported user agent when fetching links""")))
conf.registerChannelValue(
TextArt,
"maxLength",
registry.Integer(
20, _("""Set the maximum character length for text to figlet inputs""")
),
)
conf.registerChannelValue(
TextArt,
"maxWords",
registry.Integer(
4, _("""Set the maximum number of words for text to figlet inputs""")
),
)
conf.registerGlobalValue(
TextArt,
"userAgents",
registry.CommaSeparatedListOfStrings(
[
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like"
" Gecko) Chrome/79.0.3945.130 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101"
" Firefox/73.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like"
" Gecko) Chrome/80.0.3987.122 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101"
" Firefox/74.0",
],
_("""Reported user agent when fetching links"""),
),
)

File diff suppressed because it is too large Load Diff