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 # 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. # 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. # XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author('oddluck', 'oddluck', __author__ = supybot.Author("oddluck", "oddluck", "oddluck@riseup.net")
'oddluck@riseup.net')
# This is a dictionary mapping supybot.Author instances to lists of # This is a dictionary mapping supybot.Author instances to lists of
# contributions. # contributions.
__contributors__ = {} __contributors__ = {}
# This is a url where the most recent plugin package can be downloaded. # 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 config
from . import plugin from . import plugin
from imp import reload from imp import reload
# In case we're being reloaded. # In case we're being reloaded.
reload(config) reload(config)
reload(plugin) reload(plugin)
@ -63,4 +63,3 @@ if world.testing:
Class = plugin.Class Class = plugin.Class
configure = config.configure 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.conf as conf
import supybot.registry as registry import supybot.registry as registry
try: try:
from supybot.i18n import PluginInternationalization from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('TextArt')
_ = PluginInternationalization("TextArt")
except: except:
# Placeholder that allows to run the plugin on a bot # Placeholder that allows to run the plugin on a bot
# without the i18n module # without the i18n module
@ -44,57 +46,180 @@ def configure(advanced):
# user or not. You should effect your configuration by manipulating the # user or not. You should effect your configuration by manipulating the
# registry as appropriate. # registry as appropriate.
from supybot.questions import expect, anything, something, yn 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', TextArt = conf.registerPlugin("TextArt")
registry.String('', _("""Imgur Client ID"""), private=True))
conf.registerChannelValue(TextArt, 'pasteEnable', conf.registerGlobalValue(
registry.Boolean(False, _("""Turns on and off paste.ee support"""))) TextArt, "pasteAPI", registry.String("", _("""Paste.ee API Key"""), private=True)
)
conf.registerChannelValue(TextArt, 'showStats', conf.registerGlobalValue(
registry.Boolean(False, _("""Turns on and off showing render stats."""))) TextArt, "imgurAPI", registry.String("", _("""Imgur Client ID"""), private=True)
)
conf.registerChannelValue(TextArt, 'delay', conf.registerChannelValue(
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented."""))) TextArt,
"pasteEnable",
registry.Boolean(False, _("""Turns on and off paste.ee support""")),
)
conf.registerChannelValue(TextArt, 'quantize', conf.registerChannelValue(
registry.Boolean(False, _("""Enable quantizing to 256 colors before rendering. Results in much faster rendering at a slight decrease in quality. Default: False"""))) TextArt,
"showStats",
registry.Boolean(False, _("""Turns on and off showing render stats.""")),
)
conf.registerChannelValue(TextArt, 'resize', conf.registerChannelValue(
registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming"""))) TextArt,
"delay",
registry.Float(
1.0, _("""Set the time delay betwen lines. Not currently implemented.""")
),
)
conf.registerChannelValue(TextArt, 'speed', conf.registerChannelValue(
registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference."""))) 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', conf.registerChannelValue(
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'"""))) 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', conf.registerChannelValue(
registry.Integer(100, _("""Set the default column width for ascii art images"""))) 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', conf.registerChannelValue(
registry.Integer(80, _("""Set the default column width for 1/2 and 1/4 block art images"""))) 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', conf.registerChannelValue(
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"""))) TextArt,
"asciiWidth",
registry.Integer(100, _("""Set the default column width for ascii art images""")),
)
conf.registerChannelValue(TextArt, 'fg', conf.registerChannelValue(
registry.Integer(99, _("""Set the default foreground color for ascii art images. 0-98. 99 is disabled (default)"""))) TextArt,
"blockWidth",
registry.Integer(
80, _("""
Set the default column width for 1/2 and 1/4 block art images
""")
),
)
conf.registerChannelValue(TextArt, 'bg', conf.registerChannelValue(
registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)"""))) 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', conf.registerChannelValue(
registry.Integer(20, _("""Set the maximum character length for text to figlet inputs"""))) TextArt,
"fg",
registry.Integer(
99,
_(
"""Set the default foreground color for ascii art images. 0-98.
99 is disabled (default)"""
),
),
)
conf.registerChannelValue(TextArt, 'maxWords', conf.registerChannelValue(
registry.Integer(4, _("""Set the maximum number of words for text to figlet inputs"""))) TextArt,
"bg",
registry.Integer(
99,
_(
"""
Set the default background color for ascii art images. 0-98. 99 is disabled
(default)"""
),
),
)
conf.registerGlobalValue(TextArt, 'userAgents', conf.registerChannelValue(
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"""))) 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