TextArt: Add cacheColors config.

This commit is contained in:
oddluck 2020-07-18 03:27:15 +00:00
parent d131d966f3
commit 26066b55e6
2 changed files with 7 additions and 1 deletions

View File

@ -66,6 +66,10 @@ conf.registerChannelValue(
registry.Boolean(False, _("""Turns on and off paste.ee support""")),
)
conf.registerGlobalValue(
TextArt, "cacheColors", registry.Boolean(True, _("""Cache color calculations""")),
)
conf.registerChannelValue(
TextArt,
"showStats",

View File

@ -83,6 +83,7 @@ class TextArt(callbacks.Plugin):
self.old_color = None
self.source_colors = 0
self.agents = self.registryValue("userAgents")
self.matches = {}
def doPrivmsg(self, irc, msg):
channel = msg.args[0]
@ -798,8 +799,9 @@ class TextArt(callbacks.Plugin):
image2 = image2.quantize(dither=None)
image2 = image2.convert("RGB")
colormap = np.array(image2)
self.matches = {}
self.labmatches = {}
if not self.registryValue("cacheColors"):
self.matches = {}
# ascii image is a list of character strings
aimg = []
if type == "1/2":