2018-01-07 01:08:35 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
2019-09-09 10:46:52 +00:00
|
|
|
# CanvasImportStore.py
|
2019-09-04 14:23:59 +00:00
|
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
2018-11-26 09:35:48 +00:00
|
|
|
# This project is licensed under the terms of the MIT licence.
|
2018-01-07 01:08:35 +00:00
|
|
|
#
|
|
|
|
|
2019-09-06 08:32:54 +00:00
|
|
|
from CanvasColours import AnsiBgToMiRCARTColours, AnsiFgToMiRCARTColours, AnsiFgBoldToMiRCARTColours
|
2019-09-07 08:39:26 +00:00
|
|
|
import io, os, re, struct, sys
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
|
2019-09-03 16:58:50 +00:00
|
|
|
class CanvasImportStore():
|
2018-01-07 01:08:35 +00:00
|
|
|
class _CellState():
|
|
|
|
CS_NONE = 0x00
|
|
|
|
CS_BOLD = 0x01
|
|
|
|
CS_ITALIC = 0x02
|
|
|
|
CS_UNDERLINE = 0x04
|
|
|
|
|
2019-09-06 08:29:45 +00:00
|
|
|
def _flipCellStateBit(self, bit, cellState):
|
2019-09-04 13:52:54 +00:00
|
|
|
return cellState & ~bit if cellState & bit else cellState | bit
|
2018-01-07 03:19:38 +00:00
|
|
|
|
2019-09-07 08:39:26 +00:00
|
|
|
def importAnsiBuffer(self, inBuffer, encoding="cp437", width=None):
|
2019-09-12 08:02:41 +00:00
|
|
|
curBg, curBgAnsi, curBoldAnsi, curFg, curFgAnsi = -1, 30, False, 15, 37
|
2019-09-06 08:29:45 +00:00
|
|
|
done, outMap, outMaxCols = False, [[]], 0
|
2019-09-07 08:39:26 +00:00
|
|
|
inBufferData = inBuffer.decode(encoding)
|
|
|
|
inBufferChar, inBufferCharMax = 0, len(inBufferData)
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
while True:
|
2019-09-07 08:39:26 +00:00
|
|
|
if inBufferChar >= inBufferCharMax:
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
break
|
|
|
|
else:
|
2019-09-07 08:39:26 +00:00
|
|
|
m = re.match("\x1b\[((?:\d{1,3};?)+m|\d+[ABCDEFG])", inBufferData[inBufferChar:])
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
if m:
|
2019-09-06 08:29:45 +00:00
|
|
|
if m[1][-1] == "C":
|
|
|
|
outMap[-1] += [[curFg, curBg, self._CellState.CS_NONE, " "]] * int(m[1][:-1])
|
|
|
|
elif m[1][-1] == "m":
|
|
|
|
newBg, newFg = -1, -1
|
|
|
|
for ansiCode in [int(c) for c in m[1][:-1].split(";")]:
|
|
|
|
if ansiCode == 0:
|
2019-09-12 08:02:41 +00:00
|
|
|
curBgAnsi, curBoldAnsi, curFgAnsi, newBg, newFg = 30, False, 37, -1, 15
|
2019-09-06 08:29:45 +00:00
|
|
|
elif ansiCode == 1:
|
|
|
|
curBoldAnsi, newFg = True, AnsiFgBoldToMiRCARTColours[curFgAnsi]
|
|
|
|
elif ansiCode == 2:
|
|
|
|
curBoldAnsi, newFg = False, AnsiFgToMiRCARTColours[curFgAnsi]
|
|
|
|
elif ansiCode == 7:
|
|
|
|
curBgAnsi, curFgAnsi, newBg, newFg = curFgAnsi, curBgAnsi, curFg, curBg
|
2019-09-07 08:39:26 +00:00
|
|
|
elif (not curBoldAnsi) and (ansiCode in AnsiBgToMiRCARTColours):
|
2019-09-06 08:29:45 +00:00
|
|
|
curBgAnsi, newBg = ansiCode, AnsiBgToMiRCARTColours[ansiCode]
|
2019-09-07 08:39:26 +00:00
|
|
|
elif curBoldAnsi and (ansiCode in AnsiFgBoldToMiRCARTColours):
|
2019-09-06 08:29:45 +00:00
|
|
|
curFgAnsi, newFg = ansiCode, AnsiFgBoldToMiRCARTColours[ansiCode]
|
|
|
|
elif ansiCode in AnsiFgToMiRCARTColours:
|
|
|
|
newFg = AnsiFgBoldToMiRCARTColours[ansiCode] if curBoldAnsi else AnsiFgToMiRCARTColours[ansiCode]
|
|
|
|
curFgAnsi = ansiCode
|
|
|
|
curBg = newBg if newBg != -1 else curBg; curFg = newFg if newFg != -1 else curFg;
|
2019-09-07 08:39:26 +00:00
|
|
|
inBufferChar += len(m[0])
|
|
|
|
elif inBufferData[inBufferChar:inBufferChar + 2] == "\r\n":
|
|
|
|
done = True; inBufferChar += 2;
|
|
|
|
elif inBufferData[inBufferChar] in set("\r\n"):
|
|
|
|
done = True; inBufferChar += 1;
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
else:
|
2019-09-07 08:39:26 +00:00
|
|
|
outMap[-1].append([curFg, curBg, self._CellState.CS_NONE, inBufferData[inBufferChar]])
|
|
|
|
inBufferChar += 1
|
2019-09-06 08:29:45 +00:00
|
|
|
if done or (width == len(outMap[-1])):
|
|
|
|
done, outMaxCols, = False, max(outMaxCols, len(outMap[-1])); outMap.append([]);
|
2019-09-07 08:39:26 +00:00
|
|
|
if (len(outMap) > 1) \
|
|
|
|
or ((len(outMap) == 1) and len(outMap[0])):
|
2019-09-06 08:29:45 +00:00
|
|
|
for numRow in range(len(outMap)):
|
|
|
|
for numCol in range(len(outMap[numRow]), outMaxCols):
|
2019-09-12 08:02:41 +00:00
|
|
|
outMap[numRow].append([15, -1, self._CellState.CS_NONE, " "])
|
2019-09-06 08:29:45 +00:00
|
|
|
self.inSize, self.outMap = [outMaxCols, len(outMap)], outMap
|
|
|
|
return (True, None)
|
|
|
|
else:
|
|
|
|
return (False, "empty output map")
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-06 08:29:45 +00:00
|
|
|
def importAnsiFile(self, inPathName, encoding="cp437"):
|
2019-09-07 08:39:26 +00:00
|
|
|
return self.importAnsiBuffer(open(inPathName, "rb").read(), encoding)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-07 08:39:26 +00:00
|
|
|
def importSauceFile(self, inPathName, encoding="cp437"):
|
Implements importing from {ANSI,SAUCE} and exporting to ANSI files.
assets/tools/{MiRCARTTo{Ansi,PngFile},SAUCETo{Ansi,MiRCART}}.py: reimplemented using Canvas{Ex,Im}portStore.
libcanvas/Canvas.py: minor cleanup.
libcanvas/CanvasExportStore.py:export{Ansi,Png}File(): merged from assets/tools/MiRCARTTo{Ansi,PngFile}.py.
libcanvas/CanvasImportStore.py:import{Ansi,Sauce}File(): merged from assets/tools/SAUCETo{Ansi,MiRCART}.py.
libcanvas/Colours.py:{AnsiBgToMiRCARTColours,AnsiFgToMiRCARTColours,AnsiFgBoldToMiRCARTColours}{}: merged from assets/tools/SAUCEToMiRCART.py.
libcanvas/Colours.py:{ColourMap{Bold,Normal}}[]: merged from assets/tools/MiRCARTToPngFile.py.
libcanvas/Colours.py: minor cleanup.
libgui/GuiCanvasInterface.py:canvas{ExportAsAnsi,Import{Ansi,Sauce}}(): implemented.
libgui/GuiFrame.py: adds CID_{EXPORT_AS_{ANSI,SAUCE},IMPORT_{ANSI,SAUCE}}.
assets/text/TODO: updated.
2019-09-05 14:55:07 +00:00
|
|
|
with open(inPathName, "rb") as inFile:
|
2019-09-07 08:39:26 +00:00
|
|
|
inFileStat = os.stat(inPathName)
|
|
|
|
inFile.seek(inFileStat.st_size - 128, os.SEEK_SET); inFile.seek(94, os.SEEK_CUR);
|
2019-09-06 08:29:45 +00:00
|
|
|
if inFile.read(2) == b'\x01\x01':
|
|
|
|
width = struct.unpack("H", inFile.read(2))[0]
|
|
|
|
inFile.seek(0, 0); inFileData = inFile.read(inFileStat.st_size - 128);
|
2019-09-07 08:39:26 +00:00
|
|
|
return self.importAnsiBuffer(inFileData, encoding, width)
|
2019-09-06 08:29:45 +00:00
|
|
|
else:
|
|
|
|
return (False, "only character based ANSi SAUCE files are supported")
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-06 08:29:45 +00:00
|
|
|
def importTextBuffer(self, inFile):
|
2019-09-14 09:52:24 +00:00
|
|
|
try:
|
|
|
|
inLine, outMap, outMaxCols = inFile.readline(), [], 0
|
|
|
|
while inLine:
|
|
|
|
inCellState, inCurCol, inCurColours, inMaxCol = self._CellState.CS_NONE, 0, (15, -1), len(inLine); outMap.append([]);
|
|
|
|
while inCurCol < inMaxCol:
|
|
|
|
inChar = inLine[inCurCol]
|
|
|
|
if inChar in set("\r\n"):
|
|
|
|
inCurCol += 1
|
|
|
|
elif inChar == "\u0002":
|
|
|
|
inCellState = self._flipCellStateBit(self._CellState.CS_BOLD, inCellState); inCurCol += 1;
|
|
|
|
elif inChar == "\u0003":
|
|
|
|
m = re.match("\u0003((1[0-5]|0?[0-9])?(?:,(1[0-5]|0?[0-9]))?)", inLine[inCurCol:])
|
|
|
|
if m:
|
|
|
|
if (m[2] != None) and (m[3] != None):
|
|
|
|
inCurColours = (int(m[2]), int(m[3]))
|
|
|
|
elif (m[2] != None) and (m[3] == None):
|
|
|
|
inCurColours = (int(m[2]), int(inCurColours[1]))
|
|
|
|
else:
|
|
|
|
inCurColours = (15, -1)
|
|
|
|
inCurCol += len(m[0])
|
2018-01-20 08:17:52 +00:00
|
|
|
else:
|
2019-09-14 09:52:24 +00:00
|
|
|
inCurColours = (15, -1); inCurCol += 1;
|
|
|
|
elif inChar == "\u0006":
|
|
|
|
inCellState = self._flipCellStateBit(self._CellState.CS_ITALIC, inCellState); inCurCol += 1;
|
|
|
|
elif inChar == "\u000f":
|
|
|
|
inCellState |= self._CellState.CS_NONE; inCurColours = (15, -1); inCurCol += 1;
|
|
|
|
elif inChar == "\u0016":
|
|
|
|
inCurColours = (inCurColours[1], inCurColours[0]); inCurCol += 1;
|
|
|
|
elif inChar == "\u001f":
|
|
|
|
inCellState = self._flipCellStateBit(self._CellState.CS_UNDERLINE, inCellState); inCurCol += 1;
|
2019-09-23 17:56:10 +00:00
|
|
|
elif inChar == "\t":
|
|
|
|
for tabChar in range(8 - len(outMap[-1]) % 8):
|
|
|
|
outMap[-1].append([*inCurColours, inCellState, inChar])
|
|
|
|
inCurCol += 1
|
2018-01-07 01:08:35 +00:00
|
|
|
else:
|
2019-09-14 09:52:24 +00:00
|
|
|
outMap[-1].append([*inCurColours, inCellState, inChar]); inCurCol += 1;
|
|
|
|
inLine, outMaxCols = inFile.readline(), max(outMaxCols, len(outMap[-1]))
|
|
|
|
if (len(outMap) > 1) \
|
|
|
|
or ((len(outMap) == 1) and len(outMap[0])):
|
|
|
|
for numRow in range(len(outMap)):
|
|
|
|
for numCol in range(len(outMap[numRow]), outMaxCols):
|
|
|
|
outMap[numRow].append([15, -1, self._CellState.CS_NONE, " "])
|
|
|
|
self.inSize, self.outMap = [outMaxCols, len(outMap)], outMap
|
|
|
|
return (True, None)
|
|
|
|
else:
|
|
|
|
return (False, "empty output map")
|
|
|
|
except:
|
|
|
|
return (False, sys.exc_info()[1])
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2019-09-06 08:29:45 +00:00
|
|
|
def importTextFile(self, pathName):
|
|
|
|
with open(pathName, "r", encoding="utf-8-sig") as inFile:
|
|
|
|
return self.importTextBuffer(inFile)
|
Various bugfixes & usability improvements.
1) Add background colour toolbar beneath (foreground) colour toolbar.
2) Add colour flipping command w/ {accelerator,{menu,toolbar} item}.
3) Add {de,in}crease {brush,canvas} size accelerator.
4) Add {hide,show} assets window toolbar item.
5) Circle tool: draw outline with foreground colour.
6) Circle tool: honour transparency.
7) Fill tool: change comprehensive fill modifier key from <Shift> to <Ctrl>.
8) Fill tool: fill with {back,fore}ground colour given <[RL]MB>
9) Fix arrow keys cursor motion when scrolled down.
10 Instantly reflect {brush size,colour,tool} changes in canvas.
11) Object tool: honour transparency w/ non-external objects.
12) Object tool: update selection rectangle during <LMB> whilst dragging, set w/ release of <LMB>.
13) Rectangle tool: draw outline with foreground colour.
14) Rectangle tool: honour transparency.
15) Replace wx.ToolBar() w/ wx.lib.agw.aui.AuiToolBar() & custom wx.lib.agw.aui.AuiDefaultToolBarArt().
16) Restore scrolling position after resizing canvas.
.TODO: deleted.
assets/audio/roar{arab8,spoke11}.wav: added.
assets/text/hotkeys.txt: added to document hotkeys.
assets/text/requirements.txt, requirements.txt: moved.
assets/text/TODO: updated.
{assets/tools,lib{canvas,gui,roar,rtl,tools}}/*.py: remove Vim fold markers.
libroar/RoarCanvasCommandsFile.py:_importFile(): update wx.FileDialog() message.
libroar/RoarCanvasCommandsOperators.py:canvasOperator(): update invert colours {caption,label}.
2019-09-23 16:49:33 +00:00
|
|
|
|
2018-01-07 01:08:35 +00:00
|
|
|
#
|
2019-09-06 08:29:45 +00:00
|
|
|
# __init__(self, inFile=None): initialisation method
|
|
|
|
def __init__(self, inFile=None):
|
|
|
|
self.inSize, self.outMap = None, None
|
2018-01-07 03:19:38 +00:00
|
|
|
if inFile != None:
|
|
|
|
self.importTextFile(inFile)
|
2018-01-07 01:08:35 +00:00
|
|
|
|
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|