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 485d97ff99
commit 67a824779e

View File

@ -142,6 +142,17 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
return return
canvasStore = MiRCARTCanvasImportStore(inFile=asciiTmpFilePath) 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) MiRCARTToPngFile(canvasStore.outMap, "DejaVuSansMono.ttf", 11).export(imgTmpFilePath)
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", "c9a6efb3d7932fd") imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", "c9a6efb3d7932fd")
if imgurResponse[0] == 200: if imgurResponse[0] == 200: