IrcMiRCARTBot.py: include black-on-black border around map.

IrcMiRCARTBot.py: normalise imported map.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-01-11 21:28:53 +01:00
parent 9eee59b501
commit d79ea00164

View File

@ -142,6 +142,17 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
return
canvasStore = MiRCARTCanvasImportStore(inFile=asciiTmpFilePath)
numRowCols = 0
for numRow in range(len(canvasStore.outMap)):
numRowCols = max(numRowCols, len(canvasStore.outMap[numRow]))
for numRow in range(len(canvasStore.outMap)):
if len(canvasStore.outMap[numRow]) != numRowCols:
for numColOff in range(numRowCols - len(canvasStore.outMap[numRow])):
canvasStore.outMap[numRow].append([[1, 1], 0, " "])
canvasStore.outMap[numRow].insert(0, [[1, 1], 0, " "])
canvasStore.outMap[numRow].append([[1, 1], 0, " "])
canvasStore.outMap.insert(0, [[[1, 1], 0, " "]] * len(canvasStore.outMap[0]))
canvasStore.outMap.append([[[1, 1], 0, " "]] * len(canvasStore.outMap[0]))
MiRCARTToPngFile(canvasStore.outMap, "DejaVuSansMono.ttf", 11).export(imgTmpFilePath)
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", "c9a6efb3d7932fd")
if imgurResponse[0] == 200: