mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
assets/text/ImgurApiKey.py.template, lib{canvas,gui,rtl,tools}/*.py: deXXXify.
This commit is contained in:
parent
318b4436f3
commit
44e91956d1
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ImgurApiKey.py -- XXX
|
||||
# ImgurApiKey.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Canvas.py -- XXX
|
||||
# Canvas.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -9,14 +9,12 @@ from CanvasImportStore import CanvasImportStore
|
||||
from CanvasJournal import CanvasJournal
|
||||
|
||||
class Canvas():
|
||||
"""XXX"""
|
||||
|
||||
# {{{ _commitPatch(self, patch): XXX
|
||||
# {{{ _commitPatch(self, patch)
|
||||
def _commitPatch(self, patch):
|
||||
self.map[patch[1]][patch[0]] = patch[2:]
|
||||
# }}}
|
||||
|
||||
# {{{ dispatchPatch(self, isCursor, patch, commitUndo=True): XXX
|
||||
# {{{ dispatchPatch(self, isCursor, patch, commitUndo=True)
|
||||
def dispatchPatch(self, isCursor, patch, commitUndo=True):
|
||||
patchDeltaCell = self.map[patch[1]][patch[0]]; patchDelta = [*patch[0:2], *patchDeltaCell];
|
||||
if isCursor:
|
||||
@ -28,7 +26,7 @@ class Canvas():
|
||||
self.journal.updateCurrentDeltas(patch, patchDelta)
|
||||
self._commitPatch(patch)
|
||||
# }}}
|
||||
# {{{ resize(self, newSize, commitUndo=True): XXX
|
||||
# {{{ resize(self, newSize, commitUndo=True)
|
||||
def resize(self, newSize, commitUndo=True):
|
||||
if newSize != self.size:
|
||||
self.dirtyJournal = False
|
||||
@ -82,7 +80,7 @@ class Canvas():
|
||||
else:
|
||||
return False
|
||||
# }}}
|
||||
# {{{ update(self, newSize, newCanvas=None): XXX
|
||||
# {{{ update(self, newSize, newCanvas=None)
|
||||
def update(self, newSize, newCanvas=None):
|
||||
for numRow in range(self.size[1]):
|
||||
for numCol in range(self.size[0]):
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# CanvasColours.py -- XXX
|
||||
# CanvasColours.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
# {{{ AnsiBgToMiRCARTColours: XXX
|
||||
# {{{ AnsiBgToMiRCARTColours
|
||||
AnsiBgToMiRCARTColours = {
|
||||
107: 0, # Bright White
|
||||
40: 1, # Black
|
||||
@ -24,7 +24,7 @@ AnsiBgToMiRCARTColours = {
|
||||
47: 15, # Light Grey
|
||||
};
|
||||
# }}}
|
||||
# {{{ AnsiFgBoldToMiRCARTColours: XXX
|
||||
# {{{ AnsiFgBoldToMiRCARTColours
|
||||
AnsiFgBoldToMiRCARTColours = {
|
||||
97: 0, # Bright White
|
||||
30: 14, # Grey
|
||||
@ -44,7 +44,7 @@ AnsiFgBoldToMiRCARTColours = {
|
||||
37: 0, # Bright White
|
||||
};
|
||||
# }}}
|
||||
# {{{ AnsiFgToMiRCARTColours: XXX
|
||||
# {{{ AnsiFgToMiRCARTColours
|
||||
AnsiFgToMiRCARTColours = {
|
||||
97: 0, # Bright White
|
||||
30: 1, # Black
|
||||
@ -104,7 +104,7 @@ ColourMapNormal = [
|
||||
[187, 187, 187], # Light Grey
|
||||
]
|
||||
# }}}
|
||||
# {{{ MiRCARTToAnsiColours: XXX
|
||||
# {{{ MiRCARTToAnsiColours
|
||||
MiRCARTToAnsiColours = [
|
||||
97, # Bright White
|
||||
30, # Black
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# CanvasExportStore.py -- XXX
|
||||
# CanvasExportStore.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -20,7 +20,6 @@ except ImportError:
|
||||
haveUrllib = False
|
||||
|
||||
class CanvasExportStore():
|
||||
"""XXX"""
|
||||
# {{{ _CellState(): Cell state
|
||||
class _CellState():
|
||||
CS_NONE = 0x00
|
||||
@ -31,7 +30,7 @@ class CanvasExportStore():
|
||||
ImgurUploadUrl = "https://api.imgur.com/3/upload.json"
|
||||
PastebinPostUrl = "https://pastebin.com/api/api_post.php"
|
||||
|
||||
# {{{ _drawUnderline(self, curPos, fillColour, fontSize, imgDraw): XXX
|
||||
# {{{ _drawUnderline(self, curPos, fillColour, fontSize, imgDraw)
|
||||
def _drawUnderLine(self, curPos, fillColour, fontSize, imgDraw):
|
||||
imgDraw.line( \
|
||||
xy=(curPos[0], curPos[1] + (fontSize[1] - 2), \
|
||||
@ -39,7 +38,7 @@ class CanvasExportStore():
|
||||
fill=fillColour)
|
||||
# }}}
|
||||
|
||||
# {{{ exportAnsiFile(self, canvasMap, canvasSize, outFile): XXX
|
||||
# {{{ exportAnsiFile(self, canvasMap, canvasSize, outFile)
|
||||
def exportAnsiFile(self, canvasMap, canvasSize, outFile):
|
||||
outBuffer = ""
|
||||
for inCurRow in range(len(canvasMap)):
|
||||
@ -73,7 +72,7 @@ class CanvasExportStore():
|
||||
else:
|
||||
return (False, "empty buffer generated")
|
||||
# }}}
|
||||
# {{{ exportBitmapToImgur(self, apiKey, canvasBitmap, imgName, imgTitle, imgType): XXX
|
||||
# {{{ exportBitmapToImgur(self, apiKey, canvasBitmap, imgName, imgTitle, imgType)
|
||||
def exportBitmapToImgur(self, apiKey, canvasBitmap, imgName, imgTitle, imgType):
|
||||
tmpPathName = tempfile.mkstemp()
|
||||
os.close(tmpPathName[0])
|
||||
@ -96,11 +95,11 @@ class CanvasExportStore():
|
||||
os.remove(tmpPathName[1])
|
||||
return imgurResult
|
||||
# }}}
|
||||
# {{{ exportBitmapToPngFile(self, canvasBitmap, outPathName, outType): XXX
|
||||
# {{{ exportBitmapToPngFile(self, canvasBitmap, outPathName, outType)
|
||||
def exportBitmapToPngFile(self, canvasBitmap, outPathName, outType):
|
||||
return canvasBitmap.ConvertToImage().SaveFile(outPathName, outType)
|
||||
# }}}
|
||||
# {{{ exportPastebin(self, apiDevKey, canvasMap, canvasSize, pasteName="", pastePrivate=0): XXX
|
||||
# {{{ exportPastebin(self, apiDevKey, canvasMap, canvasSize, pasteName="", pastePrivate=0)
|
||||
def exportPastebin(self, apiDevKey, canvasMap, canvasSize, pasteName="", pastePrivate=0):
|
||||
if haveUrllib:
|
||||
outFile = io.StringIO()
|
||||
@ -119,7 +118,7 @@ class CanvasExportStore():
|
||||
else:
|
||||
return (False, "missing requests and/or urllib3 module(s)")
|
||||
# }}}
|
||||
# {{{ exportPngFile(self, canvasMap, fontFilePath, fontSize, outPathName): XXX
|
||||
# {{{ exportPngFile(self, canvasMap, fontFilePath, fontSize, outPathName)
|
||||
def exportPngFile(self, canvasMap, fontFilePath, fontSize, outPathName):
|
||||
if havePIL:
|
||||
inSize = (len(canvasMap[0]), len(canvasMap))
|
||||
@ -163,7 +162,7 @@ class CanvasExportStore():
|
||||
else:
|
||||
return (False, "missing PIL modules")
|
||||
# }}}
|
||||
# {{{ exportTextBuffer(self, canvasMap, canvasSize): XXX
|
||||
# {{{ exportTextBuffer(self, canvasMap, canvasSize)
|
||||
def exportTextBuffer(self, canvasMap, canvasSize):
|
||||
outBuffer = ""
|
||||
for canvasRow in range(canvasSize[1]):
|
||||
@ -202,7 +201,7 @@ class CanvasExportStore():
|
||||
else:
|
||||
return (False, "empty buffer generated")
|
||||
# }}}
|
||||
# {{{ exportTextFile(self, canvasMap, canvasSize, outFile): XXX
|
||||
# {{{ exportTextFile(self, canvasMap, canvasSize, outFile)
|
||||
def exportTextFile(self, canvasMap, canvasSize, outFile):
|
||||
rc, outBuffer = self.exportTextBuffer(canvasMap, canvasSize)
|
||||
return outFile.write(outBuffer) if rc else (rc, outBuffer)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# CanvasImportStore.py -- XXX
|
||||
# CanvasImportStore.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
@ -9,7 +9,6 @@ from CanvasColours import AnsiBgToMiRCARTColours, AnsiFgToMiRCARTColours, AnsiFg
|
||||
import io, os, re, struct, sys
|
||||
|
||||
class CanvasImportStore():
|
||||
"""XXX"""
|
||||
# {{{ _CellState(): Cell state
|
||||
class _CellState():
|
||||
CS_NONE = 0x00
|
||||
@ -18,12 +17,12 @@ class CanvasImportStore():
|
||||
CS_UNDERLINE = 0x04
|
||||
# }}}
|
||||
|
||||
# {{{ _flipCellStateBit(self, bit, cellState): XXX
|
||||
# {{{ _flipCellStateBit(self, bit, cellState)
|
||||
def _flipCellStateBit(self, bit, cellState):
|
||||
return cellState & ~bit if cellState & bit else cellState | bit
|
||||
# }}}
|
||||
|
||||
# {{{ importAnsiBuffer(self, inBuffer, encoding="cp437", width=None): XXX
|
||||
# {{{ importAnsiBuffer(self, inBuffer, encoding="cp437", width=None)
|
||||
def importAnsiBuffer(self, inBuffer, encoding="cp437", width=None):
|
||||
curBg, curBgAnsi, curBoldAnsi, curFg, curFgAnsi = 1, 30, False, 15, 37
|
||||
done, outMap, outMaxCols = False, [[]], 0
|
||||
@ -76,11 +75,11 @@ class CanvasImportStore():
|
||||
else:
|
||||
return (False, "empty output map")
|
||||
# }}}
|
||||
# {{{ importAnsiFile(self, inPathName, encoding="cp437"): XXX
|
||||
# {{{ importAnsiFile(self, inPathName, encoding="cp437")
|
||||
def importAnsiFile(self, inPathName, encoding="cp437"):
|
||||
return self.importAnsiBuffer(open(inPathName, "rb").read(), encoding)
|
||||
# }}}
|
||||
# {{{ importSauceFile(self, inPathName, encoding="cp437"): XXX
|
||||
# {{{ importSauceFile(self, inPathName, encoding="cp437")
|
||||
def importSauceFile(self, inPathName, encoding="cp437"):
|
||||
with open(inPathName, "rb") as inFile:
|
||||
inFileStat = os.stat(inPathName)
|
||||
@ -92,7 +91,7 @@ class CanvasImportStore():
|
||||
else:
|
||||
return (False, "only character based ANSi SAUCE files are supported")
|
||||
# }}}
|
||||
# {{{ importTextBuffer(self, inFile): XXX
|
||||
# {{{ importTextBuffer(self, inFile)
|
||||
def importTextBuffer(self, inFile):
|
||||
inLine, outMap, outMaxCols = inFile.readline(), [], 0
|
||||
while inLine:
|
||||
@ -133,7 +132,7 @@ class CanvasImportStore():
|
||||
else:
|
||||
return (False, "empty output map")
|
||||
# }}}
|
||||
# {{{ importTextFile(self, pathName): XXX
|
||||
# {{{ importTextFile(self, pathName)
|
||||
def importTextFile(self, pathName):
|
||||
with open(pathName, "r", encoding="utf-8-sig") as inFile:
|
||||
return self.importTextBuffer(inFile)
|
||||
|
@ -1,13 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# CanvasJournal.py -- XXX
|
||||
# CanvasJournal.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
class CanvasJournal():
|
||||
"""XXX"""
|
||||
|
||||
# {{{ popCursor(self): XXX
|
||||
# {{{ popCursor(self)
|
||||
def popCursor(self):
|
||||
if len(self.patchesCursor):
|
||||
patchesCursor = self.patchesCursor; self.patchesCursor = [];
|
||||
@ -15,7 +13,7 @@ class CanvasJournal():
|
||||
else:
|
||||
return []
|
||||
# }}}
|
||||
# {{{ popRedo(self): XXX
|
||||
# {{{ popRedo(self)
|
||||
def popRedo(self):
|
||||
if self.patchesUndoLevel > 0:
|
||||
self.patchesUndoLevel -= 1; patches = self.patchesUndo[self.patchesUndoLevel];
|
||||
@ -23,7 +21,7 @@ class CanvasJournal():
|
||||
else:
|
||||
return []
|
||||
# }}}
|
||||
# {{{ popUndo(self): XXX
|
||||
# {{{ popUndo(self)
|
||||
def popUndo(self):
|
||||
if self.patchesUndo[self.patchesUndoLevel] != None:
|
||||
patches = self.patchesUndo[self.patchesUndoLevel]; self.patchesUndoLevel += 1;
|
||||
@ -31,30 +29,30 @@ class CanvasJournal():
|
||||
else:
|
||||
return []
|
||||
# }}}
|
||||
# {{{ pushCursor(self, patches): XXX
|
||||
# {{{ pushCursor(self, patches)
|
||||
def pushCursor(self, patches):
|
||||
self.patchesCursor.append(patches)
|
||||
# }}}
|
||||
# {{{ pushDeltas(self, redoPatches, undoPatches): XXX
|
||||
# {{{ pushDeltas(self, redoPatches, undoPatches)
|
||||
def pushDeltas(self, redoPatches, undoPatches):
|
||||
if self.patchesUndoLevel > 0:
|
||||
del self.patchesUndo[0:self.patchesUndoLevel]; self.patchesUndoLevel = 0;
|
||||
deltaItem = [undoPatches, redoPatches]; self.patchesUndo.insert(0, deltaItem);
|
||||
return deltaItem
|
||||
# }}}
|
||||
# {{{ resetCursor(self): XXX
|
||||
# {{{ resetCursor(self)
|
||||
def resetCursor(self):
|
||||
if self.patchesCursor != None:
|
||||
self.patchesCursor.clear()
|
||||
self.patchesCursor = []
|
||||
# }}}
|
||||
# {{{ resetUndo(self): XXX
|
||||
# {{{ resetUndo(self)
|
||||
def resetUndo(self):
|
||||
if self.patchesUndo != None:
|
||||
self.patchesUndo.clear()
|
||||
self.patchesUndo = [None]; self.patchesUndoLevel = 0;
|
||||
# }}}
|
||||
# {{{ updateCurrentDeltas(self, redoPatches, undoPatches): XXX
|
||||
# {{{ updateCurrentDeltas(self, redoPatches, undoPatches)
|
||||
def updateCurrentDeltas(self, redoPatches, undoPatches):
|
||||
self.patchesUndo[0][0].append(undoPatches); self.patchesUndo[0][1].append(redoPatches);
|
||||
# }}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiCanvasColours.py -- XXX
|
||||
# GuiCanvasColours.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiCanvasInterface.py -- XXX
|
||||
# GuiCanvasInterface.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -25,8 +25,7 @@ from ImgurApiKey import ImgurApiKey
|
||||
import io, os, sys, wx
|
||||
|
||||
def GuiCanvasCommandDecorator(caption, label, icon, accel, initialState):
|
||||
"""XXX"""
|
||||
# {{{ GuiCanvasCommandDecoratorOuter(targetObject): XXX
|
||||
# {{{ GuiCanvasCommandDecoratorOuter(targetObject)
|
||||
def GuiCanvasCommandDecoratorOuter(targetObject):
|
||||
if callable(targetObject):
|
||||
if not hasattr(targetObject, "attrDict"):
|
||||
@ -37,8 +36,7 @@ def GuiCanvasCommandDecorator(caption, label, icon, accel, initialState):
|
||||
# }}}
|
||||
|
||||
def GuiCanvasSelectDecorator(idx, caption, label, icon, accel, initialState):
|
||||
"""XXX"""
|
||||
# {{{ GuiCanvasSelectDecoratorOuter(targetObject): XXX
|
||||
# {{{ GuiCanvasSelectDecoratorOuter(targetObject)
|
||||
def GuiCanvasSelectDecoratorOuter(targetObject):
|
||||
if callable(targetObject):
|
||||
if not hasattr(targetObject, "attrList"):
|
||||
@ -50,9 +48,7 @@ def GuiCanvasSelectDecorator(idx, caption, label, icon, accel, initialState):
|
||||
# }}}
|
||||
|
||||
class GuiCanvasInterface():
|
||||
"""XXX"""
|
||||
|
||||
# {{{ _initColourBitmaps(self): XXX
|
||||
# {{{ _initColourBitmaps(self)
|
||||
def _initColourBitmaps(self):
|
||||
for numColour in range(len(self.canvasColour.attrList)):
|
||||
if numColour < len(Colours):
|
||||
@ -76,7 +72,7 @@ class GuiCanvasInterface():
|
||||
toolBitmapDc.DrawRectangle(8, 8, 16, 16)
|
||||
self.canvasColourAlpha.attrList[0]["icon"] = ["", None, toolBitmap]
|
||||
# }}}
|
||||
# {{{ _promptSaveChanges(self): XXX
|
||||
# {{{ _promptSaveChanges(self)
|
||||
def _promptSaveChanges(self):
|
||||
if self.parentCanvas.dirty:
|
||||
with wx.MessageDialog(self.parentCanvas, \
|
||||
@ -95,12 +91,12 @@ class GuiCanvasInterface():
|
||||
return True
|
||||
# }}}
|
||||
|
||||
# {{{ canvasAbout(self, event): XXX
|
||||
# {{{ canvasAbout(self, event)
|
||||
@GuiCanvasCommandDecorator("About", "&About", None, None, True)
|
||||
def canvasAbout(self, event):
|
||||
GuiCanvasInterfaceAbout(self.parentFrame)
|
||||
# }}}
|
||||
# {{{ canvasBrush(self, f, idx): XXX
|
||||
# {{{ canvasBrush(self, f, idx)
|
||||
@GuiCanvasSelectDecorator(0, "Solid brush", "Solid brush", None, None, True)
|
||||
def canvasBrush(self, f, idx):
|
||||
def canvasBrush_(self, event):
|
||||
@ -109,7 +105,7 @@ class GuiCanvasInterface():
|
||||
setattr(canvasBrush_, "isSelect", True)
|
||||
return canvasBrush_
|
||||
# }}}
|
||||
# {{{ canvasColour(self, f, idx): XXX
|
||||
# {{{ canvasColour(self, f, idx)
|
||||
@GuiCanvasSelectDecorator(0, "Colour #00", "Colour #00 (Bright White)", None, None, False)
|
||||
@GuiCanvasSelectDecorator(1, "Colour #01", "Colour #01 (Black)", None, None, False)
|
||||
@GuiCanvasSelectDecorator(2, "Colour #02", "Colour #02 (Blue)", None, None, False)
|
||||
@ -137,7 +133,7 @@ class GuiCanvasInterface():
|
||||
setattr(canvasColour_, "isSelect", True)
|
||||
return canvasColour_
|
||||
# }}}
|
||||
# {{{ canvasColourAlpha(self, f, idx): XXX
|
||||
# {{{ canvasColourAlpha(self, f, idx)
|
||||
@GuiCanvasSelectDecorator(0, "Transparent colour", "Transparent colour", None, None, False)
|
||||
def canvasColourAlpha(self, f, idx):
|
||||
def canvasColourAlpha_(self, event):
|
||||
@ -150,28 +146,28 @@ class GuiCanvasInterface():
|
||||
setattr(canvasColourAlpha_, "isSelect", True)
|
||||
return canvasColourAlpha_
|
||||
# }}}
|
||||
# {{{ canvasCopy(self, event): XXX
|
||||
# {{{ canvasCopy(self, event)
|
||||
@GuiCanvasCommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False)
|
||||
def canvasCopy(self, event):
|
||||
pass
|
||||
# }}}
|
||||
# {{{ canvasCut(self, event): XXX
|
||||
# {{{ canvasCut(self, event)
|
||||
@GuiCanvasCommandDecorator("Cut", "Cu&t", ["", wx.ART_CUT], None, False)
|
||||
def canvasCut(self, event):
|
||||
pass
|
||||
# }}}
|
||||
# {{{ canvasDelete(self, event): XXX
|
||||
# {{{ canvasDelete(self, event)
|
||||
@GuiCanvasCommandDecorator("Delete", "De&lete", ["", wx.ART_DELETE], None, False)
|
||||
def canvasDelete(self, event):
|
||||
pass
|
||||
# }}}
|
||||
# {{{ canvasExit(self, event): XXX
|
||||
# {{{ canvasExit(self, event)
|
||||
@GuiCanvasCommandDecorator("Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None)
|
||||
def canvasExit(self, event):
|
||||
if self._promptSaveChanges():
|
||||
self.parentFrame.Close(True)
|
||||
# }}}
|
||||
# {{{ canvasNew(self, event, newCanvasSize=None): XXX
|
||||
# {{{ canvasNew(self, event, newCanvasSize=None)
|
||||
@GuiCanvasCommandDecorator("New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None)
|
||||
def canvasNew(self, event, newCanvasSize=None):
|
||||
if self._promptSaveChanges():
|
||||
@ -185,7 +181,7 @@ class GuiCanvasInterface():
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||
self.update(dirty=self.parentCanvas.dirty, pathName=self.canvasPathName, undoLevel=-1)
|
||||
# }}}
|
||||
# {{{ canvasOpen(self, event): XXX
|
||||
# {{{ canvasOpen(self, event)
|
||||
@GuiCanvasCommandDecorator("Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None)
|
||||
def canvasOpen(self, event):
|
||||
if self._promptSaveChanges():
|
||||
@ -206,18 +202,18 @@ class GuiCanvasInterface():
|
||||
print("error: {}".format(error), file=sys.stderr)
|
||||
return False
|
||||
# }}}
|
||||
# {{{ canvasPaste(self, event): XXX
|
||||
# {{{ canvasPaste(self, event)
|
||||
@GuiCanvasCommandDecorator("Paste", "&Paste", ["", wx.ART_PASTE], None, False)
|
||||
def canvasPaste(self, event):
|
||||
pass
|
||||
# }}}
|
||||
# {{{ canvasRedo(self, event): XXX
|
||||
# {{{ canvasRedo(self, event)
|
||||
@GuiCanvasCommandDecorator("Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False)
|
||||
def canvasRedo(self, event):
|
||||
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popRedo())
|
||||
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
||||
# }}}
|
||||
# {{{ canvasSave(self, event): XXX
|
||||
# {{{ canvasSave(self, event)
|
||||
@GuiCanvasCommandDecorator("Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None)
|
||||
def canvasSave(self, event):
|
||||
if self.canvasPathName == None:
|
||||
@ -234,7 +230,7 @@ class GuiCanvasInterface():
|
||||
except IOError as error:
|
||||
return False
|
||||
# }}}
|
||||
# {{{ canvasSaveAs(self, event): XXX
|
||||
# {{{ canvasSaveAs(self, event)
|
||||
@GuiCanvasCommandDecorator("Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None)
|
||||
def canvasSaveAs(self, event):
|
||||
with wx.FileDialog(self.parentCanvas, "Save As", os.getcwd(), "", "mIRC art files (*.txt)|*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
||||
@ -244,86 +240,86 @@ class GuiCanvasInterface():
|
||||
self.canvasPathName = dialog.GetPath()
|
||||
return self.canvasSave(event)
|
||||
# }}}
|
||||
# {{{ canvasUndo(self, event): XXX
|
||||
# {{{ canvasUndo(self, event)
|
||||
@GuiCanvasCommandDecorator("Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False)
|
||||
def canvasUndo(self, event):
|
||||
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popUndo())
|
||||
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
||||
# }}}
|
||||
|
||||
# {{{ canvasDecrBrushHeight(self, event): XXX
|
||||
# {{{ canvasDecrBrushHeight(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease brush height", "Decrease brush height", ["toolDecrBrushH.png"], None, None)
|
||||
def canvasDecrBrushHeight(self, event):
|
||||
if self.parentCanvas.brushSize[1] > 1:
|
||||
self.parentCanvas.brushSize[1] -= 1
|
||||
self.update(brushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasDecrBrushHeightWidth(self, event): XXX
|
||||
# {{{ canvasDecrBrushHeightWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease brush size", "Decrease brush size", ["toolDecrBrushHW.png"], None, None)
|
||||
def canvasDecrBrushHeightWidth(self, event):
|
||||
self.canvasDecrBrushHeight(event)
|
||||
self.canvasDecrBrushWidth(event)
|
||||
# }}}
|
||||
# {{{ canvasDecrBrushWidth(self, event): XXX
|
||||
# {{{ canvasDecrBrushWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease brush width", "Decrease brush width", ["toolDecrBrushW.png"], None, None)
|
||||
def canvasDecrBrushWidth(self, event):
|
||||
if self.parentCanvas.brushSize[0] > 1:
|
||||
self.parentCanvas.brushSize[0] -= 1
|
||||
self.update(brushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasDecrCanvasHeight(self, event): XXX
|
||||
# {{{ canvasDecrCanvasHeight(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease canvas height", "Decrease canvas height", ["toolDecrCanvasH.png"], None, None)
|
||||
def canvasDecrCanvasHeight(self, event):
|
||||
if self.parentCanvas.canvas.size[1] > 1:
|
||||
self.parentCanvas.resize([self.parentCanvas.canvas.size[0], self.parentCanvas.canvas.size[1] - 1])
|
||||
# }}}
|
||||
# {{{ canvasDecrCanvasHeightWidth(self, event): XXX
|
||||
# {{{ canvasDecrCanvasHeightWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease canvas size", "Decrease canvas size", ["toolDecrCanvasHW.png"], None, None)
|
||||
def canvasDecrCanvasHeightWidth(self, event):
|
||||
self.canvasDecrCanvasHeight(event)
|
||||
self.canvasDecrCanvasWidth(event)
|
||||
# }}}
|
||||
# {{{ canvasDecrCanvasWidth(self, event): XXX
|
||||
# {{{ canvasDecrCanvasWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Decrease canvas width", "Decrease canvas width", ["toolDecrCanvasW.png"], None, None)
|
||||
def canvasDecrCanvasWidth(self, event):
|
||||
if self.parentCanvas.canvas.size[0] > 1:
|
||||
self.parentCanvas.resize([self.parentCanvas.canvas.size[0] - 1, self.parentCanvas.canvas.size[1]])
|
||||
# }}}
|
||||
# {{{ canvasIncrBrushHeight(self, event): XXX
|
||||
# {{{ canvasIncrBrushHeight(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase brush height", "Increase brush height", ["toolIncrBrushH.png"], None, None)
|
||||
def canvasIncrBrushHeight(self, event):
|
||||
self.parentCanvas.brushSize[1] += 1
|
||||
self.update(brushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasIncrBrushHeightWidth(self, event): XXX
|
||||
# {{{ canvasIncrBrushHeightWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase brush size", "Increase brush size", ["toolIncrBrushHW.png"], None, None)
|
||||
def canvasIncrBrushHeightWidth(self, event):
|
||||
self.canvasIncrBrushHeight(event)
|
||||
self.canvasIncrBrushWidth(event)
|
||||
# }}}
|
||||
# {{{ canvasIncrBrushWidth(self, event): XXX
|
||||
# {{{ canvasIncrBrushWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase brush width", "Increase brush width", ["toolIncrBrushW.png"], None, None)
|
||||
def canvasIncrBrushWidth(self, event):
|
||||
self.parentCanvas.brushSize[0] += 1
|
||||
self.update(brushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasHeight(self, event): XXX
|
||||
# {{{ canvasIncrCanvasHeight(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase canvas height", "Increase canvas height", ["toolIncrCanvasH.png"], None, None)
|
||||
def canvasIncrCanvasHeight(self, event):
|
||||
self.parentCanvas.resize([self.parentCanvas.canvas.size[0], self.parentCanvas.canvas.size[1] + 1])
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasHeightWidth(self, event): XXX
|
||||
# {{{ canvasIncrCanvasHeightWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase canvas size", "Increase canvas size", ["toolIncrCanvasHW.png"], None, None)
|
||||
def canvasIncrCanvasHeightWidth(self, event):
|
||||
self.canvasIncrCanvasHeight(event)
|
||||
self.canvasIncrCanvasWidth(event)
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasWidth(self, event): XXX
|
||||
# {{{ canvasIncrCanvasWidth(self, event)
|
||||
@GuiCanvasCommandDecorator("Increase canvas width", "Increase canvas width", ["toolIncrCanvasW.png"], None, None)
|
||||
def canvasIncrCanvasWidth(self, event):
|
||||
self.parentCanvas.resize([self.parentCanvas.canvas.size[0] + 1, self.parentCanvas.canvas.size[1]])
|
||||
# }}}
|
||||
# {{{ canvasTool(self, f, idx): XXX
|
||||
# {{{ canvasTool(self, f, idx)
|
||||
@GuiCanvasSelectDecorator(0, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False)
|
||||
@GuiCanvasSelectDecorator(1, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False)
|
||||
@GuiCanvasSelectDecorator(2, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False)
|
||||
@ -343,7 +339,7 @@ class GuiCanvasInterface():
|
||||
return canvasTool_
|
||||
# }}}
|
||||
|
||||
# {{{ canvasExportAsAnsi(self, event): XXX
|
||||
# {{{ canvasExportAsAnsi(self, event)
|
||||
@GuiCanvasCommandDecorator("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:
|
||||
@ -357,7 +353,7 @@ class GuiCanvasInterface():
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||
return True
|
||||
# }}}
|
||||
# {{{ canvasExportAsPng(self, event): XXX
|
||||
# {{{ canvasExportAsPng(self, event)
|
||||
@GuiCanvasCommandDecorator("Export as PNG...", "Export as PN&G...", None, None, None)
|
||||
def canvasExportAsPng(self, event):
|
||||
with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "PNG (*.png)|*.png|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
||||
@ -370,7 +366,7 @@ class GuiCanvasInterface():
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||
return True
|
||||
# }}}
|
||||
# {{{ canvasExportImgur(self, event): XXX
|
||||
# {{{ canvasExportImgur(self, event)
|
||||
@GuiCanvasCommandDecorator("Export to Imgur...", "Export to I&mgur...", None, None, haveUrllib)
|
||||
def canvasExportImgur(self, event):
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||
@ -383,7 +379,7 @@ class GuiCanvasInterface():
|
||||
else:
|
||||
wx.MessageBox("Failed to export to Imgur: {}".format(result), "Export to Imgur", wx.ICON_EXCLAMATION | wx.OK)
|
||||
# }}}
|
||||
# {{{ canvasExportPastebin(self, event): XXX
|
||||
# {{{ canvasExportPastebin(self, event)
|
||||
@GuiCanvasCommandDecorator("Export to Pastebin...", "Export to Pasteb&in...", None, None, haveUrllib)
|
||||
def canvasExportPastebin(self, event):
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||
@ -398,7 +394,7 @@ class GuiCanvasInterface():
|
||||
else:
|
||||
wx.MessageBox("Failed to export to Pastebin: " + pasteResult, "Export to Pastebin", wx.OK|wx.ICON_EXCLAMATION)
|
||||
# }}}
|
||||
# {{{ canvasExportToClipboard(self, event): XXX
|
||||
# {{{ canvasExportToClipboard(self, event)
|
||||
@GuiCanvasCommandDecorator("Export to clipboard", "&Export to clipboard", None, None, None)
|
||||
def canvasExportToClipboard(self, event):
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||
@ -409,7 +405,7 @@ class GuiCanvasInterface():
|
||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||
return True
|
||||
# }}}
|
||||
# {{{ canvasImportAnsi(self, event): XXX
|
||||
# {{{ canvasImportAnsi(self, event)
|
||||
@GuiCanvasCommandDecorator("Import ANSI...", "Import ANSI...", None, None, None)
|
||||
def canvasImportAnsi(self, event):
|
||||
with wx.FileDialog(self.parentCanvas, "Open", os.getcwd(), "", "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*", wx.FD_OPEN) as dialog:
|
||||
@ -430,7 +426,7 @@ class GuiCanvasInterface():
|
||||
print("error: {}".format(error), file=sys.stderr)
|
||||
return False
|
||||
# }}}
|
||||
# {{{ canvasImportFromClipboard(self, event): XXX
|
||||
# {{{ canvasImportFromClipboard(self, event)
|
||||
@GuiCanvasCommandDecorator("Import from clipboard", "&Import from clipboard", None, None, None)
|
||||
def canvasImportFromClipboard(self, event):
|
||||
rc = False
|
||||
@ -454,7 +450,7 @@ class GuiCanvasInterface():
|
||||
with wx.MessageDialog(self.parentCanvas, "Clipboard does not contain text data and/or cannot be opened", "", wx.ICON_QUESTION | wx.OK | wx.OK_DEFAULT) as dialog:
|
||||
dialog.ShowModal()
|
||||
# }}}
|
||||
# {{{ canvasImportSauce(self, event): XXX
|
||||
# {{{ canvasImportSauce(self, event)
|
||||
@GuiCanvasCommandDecorator("Import SAUCE...", "Import SAUCE...", None, None, None)
|
||||
def canvasImportSauce(self, event):
|
||||
with wx.FileDialog(self.parentCanvas, "Open", os.getcwd(), "", "SAUCE files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*", wx.FD_OPEN) as dialog:
|
||||
@ -476,7 +472,7 @@ class GuiCanvasInterface():
|
||||
return False
|
||||
# }}}
|
||||
|
||||
# {{{ update(self, **kwargs): XXX
|
||||
# {{{ update(self, **kwargs)
|
||||
def update(self, **kwargs):
|
||||
self.lastPanelState.update(kwargs); textItems = [];
|
||||
if "cellPos" in self.lastPanelState:
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiCanvasInterfaceAbout.py -- XXX
|
||||
# GuiCanvasInterfaceAbout.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -8,15 +8,13 @@ from glob import glob
|
||||
import os, random, wx, wx.adv
|
||||
|
||||
class GuiCanvasInterfaceAbout(wx.Dialog):
|
||||
"""XXX"""
|
||||
|
||||
# {{{ onButtonRoar(self, event): XXX
|
||||
# {{{ onButtonRoar(self, event)
|
||||
def onButtonRoar(self, event):
|
||||
self.Destroy()
|
||||
# }}}
|
||||
|
||||
#
|
||||
# __init__(self, parent, size=(320, 240), title="About roar"): XXX
|
||||
# __init__(self, parent, size=(320, 240), title="About roar")
|
||||
def __init__(self, parent, size=(320, 240), title="About roar"):
|
||||
super(GuiCanvasInterfaceAbout, self).__init__(parent, size=size, title=title)
|
||||
self.panel, self.sizer, self.sizerH1, self.sizerH2 = wx.Panel(self), wx.BoxSizer(wx.VERTICAL), wx.BoxSizer(wx.HORIZONTAL), wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
@ -1,15 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiCanvasPanel.py -- XXX
|
||||
# GuiCanvasPanel.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
import wx
|
||||
|
||||
class GuiCanvasPanel(wx.Panel):
|
||||
"""XXX"""
|
||||
|
||||
# {{{ _drawPatch(self, eventDc, isCursor, patch): XXX
|
||||
# {{{ _drawPatch(self, eventDc, isCursor, patch)
|
||||
def _drawPatch(self, eventDc, isCursor, patch):
|
||||
if not self.canvas.dirtyCursor:
|
||||
self.backend.drawCursorMaskWithJournal(self.canvas.journal, eventDc)
|
||||
@ -20,7 +18,7 @@ class GuiCanvasPanel(wx.Panel):
|
||||
self.canvas.journal.pushCursor(patchDelta)
|
||||
# }}}
|
||||
|
||||
# {{{ dispatchDeltaPatches(self, deltaPatches): XXX
|
||||
# {{{ dispatchDeltaPatches(self, deltaPatches)
|
||||
def dispatchDeltaPatches(self, deltaPatches):
|
||||
eventDc = self.backend.getDeviceContext(self)
|
||||
for patch in deltaPatches:
|
||||
@ -31,12 +29,12 @@ class GuiCanvasPanel(wx.Panel):
|
||||
else:
|
||||
self.canvas._commitPatch(patch); self.backend.drawPatch(eventDc, patch);
|
||||
# }}}
|
||||
# {{{ dispatchPatch(self, eventDc, isCursor, patch): XXX
|
||||
# {{{ dispatchPatch(self, eventDc, isCursor, patch)
|
||||
def dispatchPatch(self, eventDc, isCursor, patch):
|
||||
self.canvas.dispatchPatch(isCursor, patch, False if isCursor else True)
|
||||
self._drawPatch(eventDc, isCursor, patch)
|
||||
# }}}
|
||||
# {{{ resize(self, newSize, commitUndo=True): XXX
|
||||
# {{{ resize(self, newSize, commitUndo=True)
|
||||
def resize(self, newSize, commitUndo=True):
|
||||
oldSize = [0, 0] if self.canvas.map == None else self.canvas.size
|
||||
deltaSize = [b - a for a, b in zip(oldSize, newSize)]
|
||||
@ -59,7 +57,7 @@ class GuiCanvasPanel(wx.Panel):
|
||||
del eventDc; wx.SafeYield();
|
||||
self.interface.update(size=newSize, undoLevel=self.canvas.journal.patchesUndoLevel)
|
||||
# }}}
|
||||
# {{{ update(self, newSize, commitUndo=True, newCanvas=None): XXX
|
||||
# {{{ update(self, newSize, commitUndo=True, newCanvas=None)
|
||||
def update(self, newSize, commitUndo=True, newCanvas=None):
|
||||
self.resize(newSize, commitUndo)
|
||||
self.canvas.update(newSize, newCanvas)
|
||||
@ -70,15 +68,15 @@ class GuiCanvasPanel(wx.Panel):
|
||||
wx.SafeYield()
|
||||
# }}}
|
||||
|
||||
# {{{ onPanelClose(self, event): XXX
|
||||
# {{{ onPanelClose(self, event)
|
||||
def onPanelClose(self, event):
|
||||
self.Destroy()
|
||||
# }}}
|
||||
# {{{ onPanelEnterWindow(self, event): XXX
|
||||
# {{{ onPanelEnterWindow(self, event)
|
||||
def onPanelEnterWindow(self, event):
|
||||
self.parentFrame.SetFocus()
|
||||
# }}}
|
||||
# {{{ onPanelInput(self, event): XXX
|
||||
# {{{ onPanelInput(self, event)
|
||||
def onPanelInput(self, event):
|
||||
self.canvas.dirtyJournal, self.canvas.dirtyCursor = False, False
|
||||
eventDc, eventType, tool = self.backend.getDeviceContext(self), event.GetEventType(), self.interface.currentTool
|
||||
@ -103,12 +101,12 @@ class GuiCanvasPanel(wx.Panel):
|
||||
if eventType == wx.wxEVT_MOTION:
|
||||
self.interface.update(cellPos=mapPoint)
|
||||
# }}}
|
||||
# {{{ onPanelLeaveWindow(self, event): XXX
|
||||
# {{{ onPanelLeaveWindow(self, event)
|
||||
def onPanelLeaveWindow(self, event):
|
||||
eventDc = self.backend.getDeviceContext(self)
|
||||
self.backend.drawCursorMaskWithJournal(self.canvas.journal, eventDc)
|
||||
# }}}
|
||||
# {{{ onPanelPaint(self, event): XXX
|
||||
# {{{ onPanelPaint(self, event)
|
||||
def onPanelPaint(self, event):
|
||||
self.backend.onPanelPaintEvent(event, self)
|
||||
# }}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiCanvasWxBackend.py -- XXX
|
||||
# GuiCanvasWxBackend.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -8,16 +8,14 @@ from GuiCanvasColours import Colours
|
||||
import wx
|
||||
|
||||
class GuiCanvasWxBackend():
|
||||
"""XXX"""
|
||||
|
||||
# {{{ _drawBrushPatch(self, eventDc, patch): XXX
|
||||
# {{{ _drawBrushPatch(self, eventDc, patch)
|
||||
def _drawBrushPatch(self, eventDc, patch):
|
||||
absPoint = self._xlatePoint(patch)
|
||||
brushBg, brushFg, pen = self._getBrushPatchColours(patch)
|
||||
self._setBrushDc(brushBg, brushFg, eventDc, pen)
|
||||
eventDc.DrawRectangle(*absPoint, *self.cellSize)
|
||||
# }}}
|
||||
# {{{ _drawCharPatch(self, eventDc, patch): XXX
|
||||
# {{{ _drawCharPatch(self, eventDc, patch)
|
||||
def _drawCharPatch(self, eventDc, patch):
|
||||
absPoint, fontBitmap = self._xlatePoint(patch), wx.Bitmap(*self.cellSize)
|
||||
brushBg, brushFg, pen = self._getCharPatchColours(patch)
|
||||
@ -29,13 +27,13 @@ class GuiCanvasWxBackend():
|
||||
fontDc.DrawRectangle(0, 0, *self.cellSize); fontDc.DrawText(patch[5], 0, 0);
|
||||
eventDc.Blit(*absPoint, *self.cellSize, fontDc, 0, 0)
|
||||
# }}}
|
||||
# {{{ _finiBrushesAndPens(self): XXX
|
||||
# {{{ _finiBrushesAndPens(self)
|
||||
def _finiBrushesAndPens(self):
|
||||
[brush.Destroy() for brush in self._brushes or []]
|
||||
[pen.Destroy() for pen in self._pens or []]
|
||||
self._brushes, self._lastBrushBg, self._lastBrushFg, self._lastPen, self._pens = None, None, None, None, None
|
||||
# }}}
|
||||
# {{{ _getBrushPatchColours(self, patch): XXX
|
||||
# {{{ _getBrushPatchColours(self, patch)
|
||||
def _getBrushPatchColours(self, patch):
|
||||
if (patch[2] != -1) and (patch[3] != -1):
|
||||
brushBg, brushFg, pen = self._brushes[patch[2]], self._brushes[patch[3]], self._pens[patch[3]]
|
||||
@ -47,7 +45,7 @@ class GuiCanvasWxBackend():
|
||||
brushBg, brushFg, pen = self._brushes[1], self._brushes[patch[2]], self._pens[1]
|
||||
return (brushBg, brushFg, pen)
|
||||
# }}}
|
||||
# {{{ _getCharPatchColours(self, patch): XXX
|
||||
# {{{ _getCharPatchColours(self, patch)
|
||||
def _getCharPatchColours(self, patch):
|
||||
if (patch[2] != -1) and (patch[3] != -1):
|
||||
brushBg, brushFg, pen = self._brushes[patch[3]], self._brushes[patch[2]], self._pens[patch[3]]
|
||||
@ -59,7 +57,7 @@ class GuiCanvasWxBackend():
|
||||
brushBg, brushFg, pen = self._brushes[1], self._brushes[patch[2]], self._pens[1]
|
||||
return (brushBg, brushFg, pen)
|
||||
# }}}
|
||||
# {{{ _initBrushesAndPens(self): XXX
|
||||
# {{{ _initBrushesAndPens(self)
|
||||
def _initBrushesAndPens(self):
|
||||
self._brushes, self._pens = [None for x in range(len(Colours))], [None for x in range(len(Colours))]
|
||||
for mircColour in range(len(Colours)):
|
||||
@ -67,7 +65,7 @@ class GuiCanvasWxBackend():
|
||||
self._pens[mircColour] = wx.Pen(wx.Colour(Colours[mircColour][:4]), 1)
|
||||
self._lastBrushBg, self._lastBrushFg, self._lastPen = None, None, None
|
||||
# }}}
|
||||
# {{{ _setBrushDc(self, brushBg, brushFg, dc, pen): XXX
|
||||
# {{{ _setBrushDc(self, brushBg, brushFg, dc, pen)
|
||||
def _setBrushDc(self, brushBg, brushFg, dc, pen):
|
||||
if self._lastBrushBg != brushBg:
|
||||
dc.SetBackground(brushBg); self._lastBrushBg = brushBg;
|
||||
@ -76,16 +74,16 @@ class GuiCanvasWxBackend():
|
||||
if self._lastPen != pen:
|
||||
dc.SetPen(pen); self._lastPen = pen;
|
||||
# }}}
|
||||
# {{{ _xlatePoint(self, patch): XXX
|
||||
# {{{ _xlatePoint(self, patch)
|
||||
def _xlatePoint(self, patch):
|
||||
return [a * b for a, b in zip(patch[:2], self.cellSize)]
|
||||
# }}}
|
||||
|
||||
# {{{ drawCursorMaskWithJournal(self, canvasJournal, eventDc): XXX
|
||||
# {{{ drawCursorMaskWithJournal(self, canvasJournal, eventDc)
|
||||
def drawCursorMaskWithJournal(self, canvasJournal, eventDc):
|
||||
[self.drawPatch(eventDc, patch) for patch in canvasJournal.popCursor()]
|
||||
# }}}
|
||||
# {{{ drawPatch(self, eventDc, patch): XXX
|
||||
# {{{ drawPatch(self, eventDc, patch)
|
||||
def drawPatch(self, eventDc, patch):
|
||||
if ((patch[0] >= 0) and (patch[0] < self.canvasSize[0])) \
|
||||
and ((patch[1] >= 0) and (patch[1] < self.canvasSize[1])):
|
||||
@ -94,13 +92,13 @@ class GuiCanvasWxBackend():
|
||||
else:
|
||||
return False
|
||||
# }}}
|
||||
# {{{ getDeviceContext(self, parentWindow): XXX
|
||||
# {{{ getDeviceContext(self, parentWindow)
|
||||
def getDeviceContext(self, parentWindow):
|
||||
eventDc = wx.BufferedDC(wx.ClientDC(parentWindow), self.canvasBitmap)
|
||||
self._lastBrushBg, self._lastBrushFg, self._lastPen = None, None, None
|
||||
return eventDc
|
||||
# }}}
|
||||
# {{{ onPanelPaintEvent(self, panelEvent, panelWindow): XXX
|
||||
# {{{ onPanelPaintEvent(self, panelEvent, panelWindow)
|
||||
def onPanelPaintEvent(self, panelEvent, panelWindow):
|
||||
if self.canvasBitmap != None:
|
||||
eventDc = wx.BufferedPaintDC(panelWindow, self.canvasBitmap)
|
||||
@ -123,7 +121,7 @@ class GuiCanvasWxBackend():
|
||||
self.canvasSize, self.cellSize = canvasSize, cellSize
|
||||
self._font = wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
||||
# }}}
|
||||
# {{{ xlateEventPoint(self, event, eventDc): XXX
|
||||
# {{{ xlateEventPoint(self, event, eventDc)
|
||||
def xlateEventPoint(self, event, eventDc):
|
||||
eventPoint = event.GetLogicalPosition(eventDc)
|
||||
rectX, rectY = eventPoint.x - (eventPoint.x % self.cellSize[0]), eventPoint.y - (eventPoint.y % self.cellSize[1])
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GuiFrame.py -- XXX
|
||||
# GuiFrame.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -18,9 +18,7 @@ NID_MENU_SEP = 0xf000
|
||||
NID_TOOLBAR_HSEP = 0xf001
|
||||
|
||||
class GuiFrame(wx.Frame):
|
||||
"""XXX"""
|
||||
|
||||
# {{{ _initAccelTable(self, accels): XXX
|
||||
# {{{ _initAccelTable(self, accels)
|
||||
def _initAccelTable(self, accels):
|
||||
accelTableEntries = []
|
||||
for accel in accels:
|
||||
@ -34,13 +32,13 @@ class GuiFrame(wx.Frame):
|
||||
self.Bind(wx.EVT_MENU, self.onInput, id=accel.attrDict["id"])
|
||||
self.SetAcceleratorTable(wx.AcceleratorTable(accelTableEntries))
|
||||
# }}}
|
||||
# {{{ _initIcon(self): XXX
|
||||
# {{{ _initIcon(self)
|
||||
def _initIcon(self):
|
||||
iconPathNames = glob(os.path.join("assets", "images", "logo*.bmp"))
|
||||
iconPathName = iconPathNames[random.randint(0, len(iconPathNames) - 1)]
|
||||
icon = wx.Icon(); icon.CopyFromBitmap(wx.Bitmap(iconPathName, wx.BITMAP_TYPE_ANY)); self.SetIcon(icon);
|
||||
# }}}
|
||||
# {{{ _initMenus(self, menus): XXX
|
||||
# {{{ _initMenus(self, menus)
|
||||
def _initMenus(self, menus):
|
||||
menuBar = wx.MenuBar()
|
||||
for menu in menus:
|
||||
@ -68,11 +66,11 @@ class GuiFrame(wx.Frame):
|
||||
menuBar.Append(menuWindow, menu[0])
|
||||
self.SetMenuBar(menuBar)
|
||||
# }}}
|
||||
# {{{ _initStatusBar(self): XXX
|
||||
# {{{ _initStatusBar(self)
|
||||
def _initStatusBar(self):
|
||||
self.statusBar = self.CreateStatusBar()
|
||||
# }}}
|
||||
# {{{ _initToolBars(self, toolBars, panelSkin): XXX
|
||||
# {{{ _initToolBars(self, toolBars, panelSkin)
|
||||
def _initToolBars(self, toolBars, panelSkin):
|
||||
for toolBar in toolBars:
|
||||
self.toolBars.append(wx.ToolBar(panelSkin, -1, style=wx.TB_FLAT | wx.HORIZONTAL | wx.TB_NODIVIDER))
|
||||
@ -100,7 +98,7 @@ class GuiFrame(wx.Frame):
|
||||
self.sizerSkin.Add(toolBar, 0, wx.ALIGN_LEFT | wx.ALL, 3)
|
||||
toolBar.Realize(); toolBar.Fit();
|
||||
# }}}
|
||||
# {{{ _initToolBitmaps(self, toolBars): XXX
|
||||
# {{{ _initToolBitmaps(self, toolBars)
|
||||
def _initToolBitmaps(self, toolBars):
|
||||
for toolBar in toolBars:
|
||||
for toolBarItem in toolBar:
|
||||
@ -122,7 +120,7 @@ class GuiFrame(wx.Frame):
|
||||
toolBarItem.attrDict["icon"] = ["", None, toolBitmap]
|
||||
# }}}
|
||||
|
||||
# {{{ onInput(self, event): XXX
|
||||
# {{{ onInput(self, event)
|
||||
def onInput(self, event):
|
||||
eventId = event.GetId(); self.itemsById[eventId](self.canvasPanel.interface, event);
|
||||
# }}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# IrcClient.py -- XXX
|
||||
# IrcClient.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
|
@ -1,18 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Tool.py -- XXX
|
||||
# Tool.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
class Tool():
|
||||
"""XXX"""
|
||||
parentCanvas = None
|
||||
|
||||
# {{{ onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc):
|
||||
def onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc):
|
||||
return True
|
||||
# }}}
|
||||
# {{{ onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# {{{ onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
return ()
|
||||
# }}}
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolCircle.py -- XXX
|
||||
# ToolCircle.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
|
||||
class ToolCircle(Tool):
|
||||
"""XXX"""
|
||||
name = "Circle"
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
brushColours = brushColours.copy()
|
||||
if isLeftDown:
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolFill.py -- XXX
|
||||
# ToolFill.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
|
||||
class ToolFill(Tool):
|
||||
"""XXX"""
|
||||
name = "Fill"
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
pointStack, pointsDone = [list(atPoint)], []
|
||||
testColour = self.parentCanvas.canvas.map[atPoint[1]][atPoint[0]][0:2]
|
||||
|
@ -1,18 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolLine.py -- XXX
|
||||
# ToolLine.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
|
||||
class ToolLine(Tool):
|
||||
"""XXX"""
|
||||
name = "Line"
|
||||
TS_NONE = 0
|
||||
TS_ORIGIN = 1
|
||||
|
||||
# {{{ _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint): XXX
|
||||
# {{{ _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint)
|
||||
def _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint):
|
||||
originPoint, targetPoint = originPoint.copy(), targetPoint.copy()
|
||||
pointDelta = self._pointDelta(originPoint, targetPoint)
|
||||
@ -38,17 +37,17 @@ class ToolLine(Tool):
|
||||
lineD -= pointDelta[0]; lineY += 1;
|
||||
lineD += pointDelta[1]
|
||||
# }}}
|
||||
# {{{ _pointDelta(self, a, b): XXX
|
||||
# {{{ _pointDelta(self, a, b)
|
||||
def _pointDelta(self, a, b):
|
||||
return [a2 - a1 for a1, a2 in zip(a, b)]
|
||||
# }}}
|
||||
# {{{ _pointSwap(self, a, b): XXX
|
||||
# {{{ _pointSwap(self, a, b)
|
||||
def _pointSwap(self, a, b):
|
||||
return [b, a]
|
||||
# }}}
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
brushColours = brushColours.copy()
|
||||
if isLeftDown:
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolRect.py -- XXX
|
||||
# ToolRect.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
|
||||
class ToolRect(Tool):
|
||||
"""XXX"""
|
||||
name = "Rectangle"
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
brushColours = brushColours.copy()
|
||||
if isLeftDown:
|
||||
|
@ -1,19 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolSelect.py -- XXX
|
||||
# ToolSelect.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from Tool import Tool
|
||||
|
||||
class ToolSelect(Tool):
|
||||
"""XXX"""
|
||||
TS_NONE = 0
|
||||
TS_ORIGIN = 1
|
||||
TS_SELECT = 2
|
||||
TS_TARGET = 3
|
||||
|
||||
# {{{ _dispatchSelectEvent(self, atPoint, dispatchFn, eventDc, isLeftDown, isRightDown, selectRect): XXX
|
||||
# {{{ _dispatchSelectEvent(self, atPoint, dispatchFn, eventDc, isLeftDown, isRightDown, selectRect)
|
||||
def _dispatchSelectEvent(self, atPoint, dispatchFn, eventDc, isLeftDown, isRightDown, selectRect):
|
||||
if isLeftDown:
|
||||
disp, isCursor = [atPoint[m] - self.lastAtPoint[m] for m in [0, 1]], True
|
||||
@ -27,7 +26,7 @@ class ToolSelect(Tool):
|
||||
self._drawSelectRect(newTargetRect, dispatchFn, eventDc)
|
||||
self.targetRect = newTargetRect
|
||||
# }}}
|
||||
# {{{ _drawSelectRect(self, rect, dispatchFn, eventDc): XXX
|
||||
# {{{ _drawSelectRect(self, rect, dispatchFn, eventDc)
|
||||
def _drawSelectRect(self, rect, dispatchFn, eventDc):
|
||||
rectFrame = [[rect[m[0]][n] + m[1] for n in [0, 1]] for m in [[0, -1], [1, +1]]]
|
||||
if rectFrame[0][0] > rectFrame[1][0]:
|
||||
@ -44,14 +43,14 @@ class ToolSelect(Tool):
|
||||
dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "])
|
||||
dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "])
|
||||
# }}}
|
||||
# {{{ _mouseEventTsNone(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown): XXX
|
||||
# {{{ _mouseEventTsNone(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
def _mouseEventTsNone(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown):
|
||||
if isLeftDown:
|
||||
self.targetRect, self.toolState = [list(atPoint), []], self.TS_ORIGIN
|
||||
else:
|
||||
dispatchFn(eventDc, True, [*atPoint, *brushColours, 0, " "])
|
||||
# }}}
|
||||
# {{{ _mouseEventTsOrigin(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown): XXX
|
||||
# {{{ _mouseEventTsOrigin(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
def _mouseEventTsOrigin(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown):
|
||||
if isLeftDown:
|
||||
self.targetRect[1] = list(atPoint)
|
||||
@ -72,7 +71,7 @@ class ToolSelect(Tool):
|
||||
self.targetRect[1] = list(atPoint)
|
||||
self._drawSelectRect(self.targetRect, dispatchFn, eventDc)
|
||||
# }}}
|
||||
# {{{ _mouseEventTsSelect(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown): XXX
|
||||
# {{{ _mouseEventTsSelect(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
def _mouseEventTsSelect(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown):
|
||||
if isLeftDown \
|
||||
and (atPoint[0] >= (self.targetRect[0][0] - 1)) \
|
||||
@ -86,7 +85,7 @@ class ToolSelect(Tool):
|
||||
else:
|
||||
self._dispatchSelectEvent(atPoint, dispatchFn, eventDc, isLeftDown, isRightDown, self.targetRect)
|
||||
# }}}
|
||||
# {{{ _mouseEventTsTarget(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown): XXX
|
||||
# {{{ _mouseEventTsTarget(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
def _mouseEventTsTarget(self, atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown):
|
||||
if isLeftDown:
|
||||
self.toolState = self.TS_TARGET
|
||||
@ -99,7 +98,7 @@ class ToolSelect(Tool):
|
||||
# }}}
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
if self.toolState == self.TS_NONE:
|
||||
self._mouseEventTsNone(atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
@ -111,7 +110,7 @@ class ToolSelect(Tool):
|
||||
self._mouseEventTsTarget(atPoint, brushColours, dispatchFn, eventDc, isDragging, isLeftDown, isRightDown)
|
||||
|
||||
#
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newTargetRect, selectRect): XXX
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newTargetRect, selectRect)
|
||||
def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newTargetRect, selectRect):
|
||||
pass
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolSelectClone.py -- XXX
|
||||
# ToolSelectClone.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from ToolSelect import ToolSelect
|
||||
|
||||
class ToolSelectClone(ToolSelect):
|
||||
"""XXX"""
|
||||
name = "Clone selection"
|
||||
|
||||
#
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect): XXX
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect)
|
||||
def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect):
|
||||
for numRow in range(len(self.toolSelectMap)):
|
||||
for numCol in range(len(self.toolSelectMap[numRow])):
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolSelectMove.py -- XXX
|
||||
# ToolSelectMove.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from ToolSelect import ToolSelect
|
||||
|
||||
class ToolSelectMove(ToolSelect):
|
||||
"""XXX"""
|
||||
name = "Move selection"
|
||||
|
||||
#
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect): XXX
|
||||
# onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect)
|
||||
def onSelectEvent(self, disp, dispatchFn, eventDc, isCursor, newToolRect, selectRect):
|
||||
for numRow in range(len(self.toolSelectMap)):
|
||||
for numCol in range(len(self.toolSelectMap[numRow])):
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# ToolText.py -- XXX
|
||||
# ToolText.py
|
||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
@ -8,11 +8,10 @@ from Tool import Tool
|
||||
import wx
|
||||
|
||||
class ToolText(Tool):
|
||||
"""XXX"""
|
||||
name = "Text"
|
||||
|
||||
#
|
||||
# onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc): XXX
|
||||
# onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc)
|
||||
def onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc):
|
||||
keyModifiers = event.GetModifiers()
|
||||
if keyModifiers != wx.MOD_NONE \
|
||||
@ -31,7 +30,7 @@ class ToolText(Tool):
|
||||
return False
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc)
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
if isLeftDown or isRightDown:
|
||||
self.textPos = list(atPoint)
|
||||
|
Loading…
Reference in New Issue
Block a user