diff --git a/assets/tools/IrcMiRCARTBot.py b/assets/tools/IrcMiRCARTBot.py index a1dd705..6b5483c 100755 --- a/assets/tools/IrcMiRCARTBot.py +++ b/assets/tools/IrcMiRCARTBot.py @@ -231,7 +231,6 @@ class IrcMiRCARTBot(IrcClient): elif serverMessage[1] == "PRIVMSG": self._dispatchPrivmsg(serverMessage) - # # __init__(self, serverHname, serverPort="6667", clientNick="pngbot", clientIdent="pngbot", clientGecos="pngbot", clientChannel="#MiRCART"): initialisation method def __init__(self, serverHname, serverPort="6667", clientNick="pngbot", clientIdent="pngbot", clientGecos="pngbot", clientChannel="#MiRCART"): @@ -262,12 +261,12 @@ if __name__ == "__main__": optlist, argv = getopt(sys.argv[1:], "46l:") optdict = dict(optlist) if len(argv) < 1 or len(argv) > 6: - print("usage: {} [-4|-6] [-l ] " \ - " " \ - "[] " \ - "[] " \ - "[] " \ - "[] " \ + print("usage: {} [-4|-6] [-l ] " \ + " " \ + "[] " \ + "[] " \ + "[] " \ + "[] " \ "[] ".format(sys.argv[0]), file=sys.stderr) else: main(optdict, *argv) diff --git a/libcanvas/Canvas.py b/libcanvas/Canvas.py index 2b8065c..4b61f1e 100644 --- a/libcanvas/Canvas.py +++ b/libcanvas/Canvas.py @@ -12,7 +12,6 @@ class Canvas(): def _commitPatch(self, patch): self.map[patch[1]][patch[0]] = patch[2:] - def dispatchPatch(self, isCursor, patch, commitUndo=True): if (patch[0] >= self.size[0]) or (patch[1] >= self.size[1]): return False @@ -92,7 +91,6 @@ class Canvas(): and (numCol < len(newCanvas[numRow])): self._commitPatch([numCol, numRow, *newCanvas[numRow][numCol]]) - # # __init__(self, size): initialisation method def __init__(self, size): diff --git a/libcanvas/CanvasColours.py b/libcanvas/CanvasColours.py index 21f876f..87a9b33 100644 --- a/libcanvas/CanvasColours.py +++ b/libcanvas/CanvasColours.py @@ -118,5 +118,4 @@ MiRCARTToAnsiColours = [ 37, # Light Grey ]; - # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libcanvas/CanvasExportStore.py b/libcanvas/CanvasExportStore.py index 9e1b413..ddae872 100644 --- a/libcanvas/CanvasExportStore.py +++ b/libcanvas/CanvasExportStore.py @@ -35,7 +35,6 @@ class CanvasExportStore(): curPos[0] + fontSize[0], curPos[1] + (fontSize[1] - 2)), \ fill=fillColour) - def exportAnsiFile(self, canvasMap, canvasSize, outFile): outBuffer = "" for inCurRow in range(len(canvasMap)): @@ -210,5 +209,4 @@ class CanvasExportStore(): rc, outBuffer = self.exportTextBuffer(canvasMap, canvasSize) return outFile.write(outBuffer) if rc else (rc, outBuffer) - # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libcanvas/CanvasImportStore.py b/libcanvas/CanvasImportStore.py index ba5bd99..d8afb3b 100644 --- a/libcanvas/CanvasImportStore.py +++ b/libcanvas/CanvasImportStore.py @@ -15,11 +15,9 @@ class CanvasImportStore(): CS_ITALIC = 0x02 CS_UNDERLINE = 0x04 - def _flipCellStateBit(self, bit, cellState): return cellState & ~bit if cellState & bit else cellState | bit - def importAnsiBuffer(self, inBuffer, encoding="cp437", width=None): curBg, curBgAnsi, curBoldAnsi, curFg, curFgAnsi = -1, 30, False, 15, 37 done, outMap, outMaxCols = False, [[]], 0 @@ -136,7 +134,6 @@ class CanvasImportStore(): with open(pathName, "r", encoding="utf-8-sig") as inFile: return self.importTextBuffer(inFile) - # # __init__(self, inFile=None): initialisation method def __init__(self, inFile=None): diff --git a/libcanvas/CanvasJournal.py b/libcanvas/CanvasJournal.py index 9934b7e..3c4356b 100644 --- a/libcanvas/CanvasJournal.py +++ b/libcanvas/CanvasJournal.py @@ -53,11 +53,9 @@ class CanvasJournal(): self.patchesUndo[self.patchesUndoLevel][0].append(undoPatches) self.patchesUndo[self.patchesUndoLevel][1].append(redoPatches) - def __del__(self): self.resetCursor(); self.resetUndo(); - # # __init__(self): initialisation method def __init__(self): diff --git a/libgui/GuiCanvasWxBackend.py b/libgui/GuiCanvasWxBackend.py index 3b94456..d5b54bc 100644 --- a/libgui/GuiCanvasWxBackend.py +++ b/libgui/GuiCanvasWxBackend.py @@ -23,7 +23,6 @@ class GuiBufferedDC(wx.MemoryDC): self.SelectObject(buffer); self.SetDeviceOrigin(*viewRect); self.dc, self.viewRect, self.viewSize = dc, viewRect, viewSize - class GuiCanvasWxBackend(): arabicShapes = { u'\u0621': (u'\uFE80'), @@ -71,7 +70,6 @@ class GuiCanvasWxBackend(): CS_ITALIC = 0x02 CS_UNDERLINE = 0x04 - def _drawBrushPatch(self, eventDc, patch, point): absPoint = self._xlatePoint(point) brushBg, brushFg, pen = self._getBrushPatchColours(patch) @@ -174,7 +172,6 @@ class GuiCanvasWxBackend(): def _xlatePoint(self, point): return [a * b for a, b in zip(point, self.cellSize)] - def drawCursorMaskWithJournal(self, canvas, canvasJournal, eventDc): [self.drawPatch(canvas, eventDc, patch) for patch in canvasJournal.popCursor()] @@ -235,13 +232,11 @@ class GuiCanvasWxBackend(): mapX, mapY = int(rectX / self.cellSize[0] if rectX else 0), int(rectY / self.cellSize[1] if rectY else 0) return [m + n for m, n in zip((mapX, mapY), viewRect)] - def __del__(self): if self.canvasBitmap != None: self.canvasBitmap.Destroy(); self.canvasBitmap = None; self._finiBrushesAndPens() - # # __init__(self, canvasSize, cellSize, fontName="Dejavu Sans Mono", fontPathName=os.path.join("assets", "fonts", "DejaVuSansMono.ttf")): initialisation method def __init__(self, canvasSize, cellSize, fontName="Dejavu Sans Mono", fontPathName=os.path.join("assets", "fonts", "DejaVuSansMono.ttf")): diff --git a/libgui/GuiFrame.py b/libgui/GuiFrame.py index 394888f..074c41a 100644 --- a/libgui/GuiFrame.py +++ b/libgui/GuiFrame.py @@ -46,7 +46,6 @@ def GuiSubMenuDecorator(caption, label, icon, accel, initialState): return targetObject return GuiSubMenuDecoratorOuter - class GuiToolBarArtProvider(wx.lib.agw.aui.AuiDefaultToolBarArt): def DrawBackground(self, dc, wnd, _rect, horizontal=True): dc.SetBrush(wx.Brush(wx.Colour(240, 240, 240, 0), wx.BRUSHSTYLE_SOLID)); dc.SetPen(wx.Pen(wx.Colour(240, 240, 240, 0), 1)); @@ -94,7 +93,6 @@ class GuiFrame(wx.Frame): else: menuItemWindow.Enable(menuItem.attrDict["initialState"]) - def loadAccels(self, accelsIn, menus, toolBars): def loadAccels_(accels): nonlocal accelTableEntries @@ -193,7 +191,6 @@ class GuiFrame(wx.Frame): def onMouseWheel(self, event): event.Skip() - # # __init__(self, iconPathName, size, parent=None, title=""): initialisation method def __init__(self, iconPathName, size, parent=None, title=""): diff --git a/libgui/GuiWindow.py b/libgui/GuiWindow.py index 9ed5f20..6829307 100644 --- a/libgui/GuiWindow.py +++ b/libgui/GuiWindow.py @@ -16,7 +16,6 @@ class GuiWindow(wx.ScrolledWindow): and ((self.size[0] <= clientSize[0]) or (self.size[1] <= clientSize[1])): self.scrollFlag = False; super().SetVirtualSize((0, 0)); - def onClose(self, event): self.Destroy() @@ -48,7 +47,6 @@ class GuiWindow(wx.ScrolledWindow): while curWindow != None: curWindow.Layout(); curWindow = curWindow.GetParent(); - # # __init__(self, parent, pos, scrollStep, style=0): initialisation method def __init__(self, parent, pos, scrollStep, style=0): diff --git a/libroar/RoarAssetsWindow.py b/libroar/RoarAssetsWindow.py index 37e21ab..24cdc99 100644 --- a/libroar/RoarAssetsWindow.py +++ b/libroar/RoarAssetsWindow.py @@ -95,7 +95,6 @@ class RoarAssetsWindow(GuiMiniFrame): and ((panelSize[0] <= clientSize[0]) or (panelSize[1] <= clientSize[1])): self.scrollFlag = False; super(wx.ScrolledWindow, self.panelCanvas).SetVirtualSize((0, 0)); - def drawCanvas(self, canvas): panelSize = [a * b for a, b in zip(canvas.size, self.cellSize)] self.panelCanvas.SetMinSize(panelSize); self.panelCanvas.SetSize(wx.DefaultCoord, wx.DefaultCoord, *panelSize); @@ -161,7 +160,6 @@ class RoarAssetsWindow(GuiMiniFrame): self.backend.drawPatch(canvas, eventDc, [numCol, numRow, *canvas.map[numRow][numCol]]) eventDc.SetDeviceOrigin(*eventDcOrigin) - def onImportAnsi(self, event): event.Skip() @@ -231,7 +229,6 @@ class RoarAssetsWindow(GuiMiniFrame): if dialogChoice == wx.ID_CANCEL: break - # {{{ onLoadList(self, event) def onLoadList(self, event): rc = True with wx.FileDialog(self, "Load from list...", os.getcwd(), "", "List files (*.lst)|*.lst|Text files (*.txt)|*.txt|All Files (*.*)|*.*", wx.FD_OPEN) as dialog: @@ -278,7 +275,6 @@ class RoarAssetsWindow(GuiMiniFrame): with wx.MessageDialog(self, "Error: {}".format(error), "", wx.OK | wx.OK_DEFAULT) as dialog: dialogChoice = dialog.ShowModal() - # # __init__(self, backend, cellSize, parent, pos=None, size=(400, 400), title="Assets"): initialisation method def __init__(self, backend, cellSize, parent, pos=None, size=(400, 400), title="Assets"): diff --git a/libroar/RoarCanvasCommands.py b/libroar/RoarCanvasCommands.py index ef8772f..eb50996 100644 --- a/libroar/RoarCanvasCommands.py +++ b/libroar/RoarCanvasCommands.py @@ -40,7 +40,6 @@ class RoarCanvasCommands(RoarCanvasCommandsFile, RoarCanvasCommandsEdit, RoarCan _initColourBitmaps_(RoarCanvasCommandsEdit.canvasColour, RoarCanvasCommandsEdit.canvasColourAlpha, 1.0) _initColourBitmaps_(RoarCanvasCommandsEdit.canvasColourBackground, RoarCanvasCommandsEdit.canvasColourAlphaBackground, 0.5) - def update(self, **kwargs): self.lastPanelState.update(kwargs); textItems = []; if "cellPos" in self.lastPanelState: @@ -109,7 +108,6 @@ class RoarCanvasCommands(RoarCanvasCommandsFile, RoarCanvasCommandsEdit, RoarCan toolBar = self.parentFrame.toolBarItemsById[self.canvasRedo.attrDict["id"]][0] toolBar.EnableTool(self.canvasRedo.attrDict["id"], False); toolBar.Refresh(); - # # __init__(self, parentCanvas, parentFrame): def __init__(self, parentCanvas, parentFrame): diff --git a/libroar/RoarCanvasCommandsEdit.py b/libroar/RoarCanvasCommandsEdit.py index 677e640..d8b497d 100644 --- a/libroar/RoarCanvasCommandsEdit.py +++ b/libroar/RoarCanvasCommandsEdit.py @@ -176,8 +176,6 @@ class RoarCanvasCommandsEdit(): eventDc = self.parentCanvas.backend.getDeviceContext(self.parentCanvas.GetClientSize(), self.parentCanvas, viewRect) self.parentCanvas.applyTool(eventDc, True, None, None, None, self.parentCanvas.brushPos, False, False, False, self.currentTool, viewRect, force=True) - - @GuiCommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False) def canvasCopy(self, event): pass @@ -204,7 +202,6 @@ class RoarCanvasCommandsEdit(): self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popUndo()) self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel) - # # __init__(self) def __init__(self): diff --git a/libroar/RoarCanvasCommandsFile.py b/libroar/RoarCanvasCommandsFile.py index 0e51535..4189f72 100644 --- a/libroar/RoarCanvasCommandsFile.py +++ b/libroar/RoarCanvasCommandsFile.py @@ -91,13 +91,11 @@ class RoarCanvasCommandsFile(): for lastFile in [l["pathName"] for l in self.lastFiles]: print(lastFile, file=outFile) - @GuiCommandDecorator("Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None) def canvasExit(self, event): if self._promptSaveChanges(): self.parentFrame.Close(True) - @GuiCommandDecorator("Export as ANSI...", "Export as &ANSI...", None, None, None) def canvasExportAsAnsi(self, event): with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog: @@ -163,7 +161,6 @@ class RoarCanvasCommandsFile(): self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor)) return True - @GuiCommandDecorator("Import ANSI...", "Import &ANSI...", None, None, None) def canvasImportAnsi(self, event): def canvasImportAnsi_(pathName): @@ -194,7 +191,6 @@ class RoarCanvasCommandsFile(): return (rc, error, self.parentCanvas.canvas.importStore.outMap, pathName, self.parentCanvas.canvas.importStore.inSize) self._importFile(canvasImportSauce_, True, "SAUCE files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*") - @GuiCommandDecorator("New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None) def canvasNew(self, event, newCanvasSize=None): def canvasImportEmpty(pathName): @@ -251,7 +247,6 @@ class RoarCanvasCommandsFile(): if self.canvasSave(event, newDirty=True): self._pushRecent(self.canvasPathName) - # # __init__(self) def __init__(self): diff --git a/libroar/RoarCanvasCommandsHelp.py b/libroar/RoarCanvasCommandsHelp.py index 7066bdd..ff80f11 100644 --- a/libroar/RoarCanvasCommandsHelp.py +++ b/libroar/RoarCanvasCommandsHelp.py @@ -12,7 +12,6 @@ class RoarCanvasCommandsHelp(): def canvasAbout(self, event): RoarWindowAbout(self.parentFrame) - # # __init__(self) def __init__(self): diff --git a/libroar/RoarCanvasCommandsOperators.py b/libroar/RoarCanvasCommandsOperators.py index a13014d..66c9183 100644 --- a/libroar/RoarCanvasCommandsOperators.py +++ b/libroar/RoarCanvasCommandsOperators.py @@ -27,7 +27,6 @@ class RoarCanvasCommandsOperators(): setattr(canvasOperator_, "attrDict", f.attrList[idx]) return canvasOperator_ - # # __init__(self) def __init__(self): diff --git a/libroar/RoarCanvasCommandsTools.py b/libroar/RoarCanvasCommandsTools.py index d13c7bd..3343296 100644 --- a/libroar/RoarCanvasCommandsTools.py +++ b/libroar/RoarCanvasCommandsTools.py @@ -45,7 +45,6 @@ class RoarCanvasCommandsTools(): setattr(canvasTool_, "isSelect", True) return canvasTool_ - # # __init__(self) def __init__(self): diff --git a/libroar/RoarCanvasWindow.py b/libroar/RoarCanvasWindow.py index fb097d3..2f8b36e 100644 --- a/libroar/RoarCanvasWindow.py +++ b/libroar/RoarCanvasWindow.py @@ -39,7 +39,6 @@ class RoarCanvasWindowDropTarget(wx.TextDropTarget): def __init__(self, parent): super().__init__(); self.inProgress, self.parent = False, parent; - class RoarCanvasWindow(GuiWindow): def _drawPatch(self, eventDc, isCursor, patch): if not self.canvas.dirtyCursor: @@ -49,7 +48,6 @@ class RoarCanvasWindow(GuiWindow): patchDeltaCell = self.canvas.map[patch[1]][patch[0]]; patchDelta = [*patch[0:2], *patchDeltaCell]; self.canvas.journal.pushCursor(patchDelta) - def applyOperator(self, currentTool, mapPoint, mouseLeftDown, mousePoint, operator, viewRect): self.canvas.dirtyCursor = False if (currentTool.__class__ == ToolObject) \ @@ -191,7 +189,6 @@ class RoarCanvasWindow(GuiWindow): self.backend.drawPatch(self.canvas, eventDc, [numCol, numRow, *self.canvas.map[numRow][numCol]]) eventDc.SetDeviceOrigin(*eventDcOrigin) - def onKeyboardInput(self, event): keyCode, keyModifiers = event.GetKeyCode(), event.GetModifiers() viewRect = self.GetViewStart(); eventDc = self.backend.getDeviceContext(self.GetClientSize(), self, viewRect); @@ -286,7 +283,6 @@ class RoarCanvasWindow(GuiWindow): eventDc.SetDeviceOrigin(*eventDcOrigin) self.backend.onPaint(self.GetClientSize(), self, self.GetViewStart()) - # # __init__(self, backend, canvas, cellSize, commands, parent, parentFrame, pos, scrollStep, size): initialisation method def __init__(self, backend, canvas, cellSize, commands, parent, parentFrame, pos, scrollStep, size): diff --git a/libroar/RoarClient.py b/libroar/RoarClient.py index 23774d0..3b2f1b9 100644 --- a/libroar/RoarClient.py +++ b/libroar/RoarClient.py @@ -25,14 +25,12 @@ class RoarClient(GuiFrame): for toolBarItem in [i for i in toolBar if i != NID_TOOLBAR_HSEP]: toolBarItem.attrDict["icon"] = self.loadBitmap(basePathName, toolBarItem.attrDict["icon"]) - def onChar(self, event): self.canvasPanel.onKeyboardInput(event) def onMouseWheel(self, event): self.canvasPanel.GetEventHandler().ProcessEvent(event) - # # __init__(self, parent, defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14), size=(840, 630), title=""): initialisation method def __init__(self, parent, defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14), size=(840, 630), title=""): diff --git a/libroar/RoarWindowAbout.py b/libroar/RoarWindowAbout.py index f6217fe..987707e 100644 --- a/libroar/RoarWindowAbout.py +++ b/libroar/RoarWindowAbout.py @@ -11,7 +11,6 @@ class RoarWindowAbout(wx.Dialog): def onButtonRoar(self, event): self.Destroy() - # # __init__(self, parent, minSize=(320, 300), title="About roar") def __init__(self, parent, minSize=(320, 300), title="About roar"): diff --git a/librtl/IrcClient.py b/librtl/IrcClient.py index 7f1cec4..051ab3e 100644 --- a/librtl/IrcClient.py +++ b/librtl/IrcClient.py @@ -107,7 +107,6 @@ class IrcClient: del self.clientQueue[0] return True - # # __init__(self, serverHname, serverPort, clientNick, clientIdent, clientGecos): initialisation method def __init__(self, serverHname, serverPort, clientNick, clientIdent, clientGecos): diff --git a/librtl/RtlPlatform.py b/librtl/RtlPlatform.py index b2e4d96..f7afb00 100644 --- a/librtl/RtlPlatform.py +++ b/librtl/RtlPlatform.py @@ -11,5 +11,4 @@ def getLocalConfPathName(*args): vname = "LOCALAPPDATA" if platform.system() == "Windows" else "HOME" return os.path.join(os.getenv(vname), "roar", *args) - # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libtools/Tool.py b/libtools/Tool.py index 56801b2..0e0c631 100644 --- a/libtools/Tool.py +++ b/libtools/Tool.py @@ -11,5 +11,4 @@ class Tool(object): def onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown): return False, False - # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libtools/ToolLine.py b/libtools/ToolLine.py index 298cbe1..52ee5a2 100644 --- a/libtools/ToolLine.py +++ b/libtools/ToolLine.py @@ -46,7 +46,6 @@ class ToolLine(Tool): def _pointSwap(self, a, b): return [b, a] - # # onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown) def onMouseEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyModifiers, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown): diff --git a/libtools/ToolObject.py b/libtools/ToolObject.py index 012fe76..0637fa4 100644 --- a/libtools/ToolObject.py +++ b/libtools/ToolObject.py @@ -97,7 +97,6 @@ class ToolObject(Tool): self.toolState = self.TS_SELECT return dirty - def getRegion(self, canvas): return self.objectMap @@ -169,7 +168,6 @@ class ToolObject(Tool): self.srcRect = self.targetRect self.objectMap, self.objectSize = objectMap, objectSize - # __init__(self, *args): initialisation method def __init__(self, *args): super().__init__(*args) diff --git a/libtools/ToolText.py b/libtools/ToolText.py index d87d7b0..7abd3ab 100644 --- a/libtools/ToolText.py +++ b/libtools/ToolText.py @@ -65,7 +65,6 @@ class ToolText(Tool): rc, dirty = False, False return rc, dirty - # # onKeyboardEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyChar, keyCode, keyModifiers, mapPoint) def onKeyboardEvent(self, atPoint, brushColours, brushPos, brushSize, canvas, dispatchFn, eventDc, keyChar, keyCode, keyModifiers, mapPoint):