From 67a824779e5b146556a8794250ea3b10b1436032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 11 Jan 2018 21:28:53 +0100 Subject: [PATCH] IrcMiRCARTBot.py: include black-on-black border around map. IrcMiRCARTBot.py: normalise imported map. --- IrcMiRCARTBot.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/IrcMiRCARTBot.py b/IrcMiRCARTBot.py index 9977488..b028c43 100755 --- a/IrcMiRCARTBot.py +++ b/IrcMiRCARTBot.py @@ -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: