ROAR!
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.sw[op]
|
*.sw[op]
|
||||||
__pycache__/
|
__pycache__/
|
||||||
MiRCARTImgurApiKey.py
|
librtl/ImgurApiKey.py
|
||||||
|
releases/
|
||||||
|
BIN
assets/audio/roararab1.wav
Normal file
BIN
assets/audio/roararab2.wav
Normal file
BIN
assets/audio/roararab3.wav
Normal file
BIN
assets/audio/roararab4.wav
Normal file
BIN
assets/audio/roararab5.wav
Normal file
BIN
assets/audio/roarspoke1.wav
Normal file
BIN
assets/audio/roarspoke2.wav
Normal file
BIN
assets/audio/roarspoke3.wav
Normal file
BIN
assets/audio/roarspoke4.wav
Normal file
BIN
assets/audio/roarspoke5.wav
Normal file
BIN
assets/audio/roarspoke6.wav
Normal file
BIN
assets/audio/roarspoke7.wav
Normal file
BIN
assets/audio/roarspoke8.wav
Normal file
Before Width: | Height: | Size: 51 KiB |
BIN
assets/images/logo1.bmp
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
assets/images/logo2.bmp
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
assets/images/logo3.bmp
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/images/logo4.bmp
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/images/logo5.bmp
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
assets/images/logo6.bmp
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
assets/images/logo7.bmp
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
assets/images/logo8.bmp
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
assets/images/logo9.bmp
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
assets/images/roar.png
Normal file
After Width: | Height: | Size: 62 KiB |
@ -1,17 +1,9 @@
|
|||||||
# MiRCART.py -- mIRC art editor for Windows & Linux (WIP)
|
# roar.py -- mIRC art editor for Windows & Linux (WIP)
|
||||||
* Prerequisites on Windows: install Python v3.6.x[1] and script dependencies w/ the following elevated command prompt command line:
|
* Prerequisites on Windows: install Python v3.6.x[1] and script dependencies w/ the following elevated command prompt command line:
|
||||||
`pip install requests urllib3 wxPython`
|
`pip install requests urllib3 wxPython`
|
||||||
* Prerequisites on Linux: python3 && python-wx{gtk2.8,tools} on Debian-family Linux distributions
|
* Prerequisites on Linux: python3 && python-wx{gtk2.8,tools} on Debian-family Linux distributions
|
||||||
* Screenshot:
|
* Screenshot:
|
||||||
![Screenshot](https://github.com/lalbornoz/MiRCARTools/raw/master/assets/images/MiRCART.png "Screenshot")
|
![Screenshot](https://github.com/lalbornoz/roar/raw/master/assets/images/roar.png "Screenshot")
|
||||||
|
|
||||||
# IrcMiRCARTBot.py -- IRC<->MiRC2png bot (for EFnet #MiRCART) (pending cleanup)
|
|
||||||
* Prerequisites: python3 && python3-{json,requests,urllib3} on Debian-family Linux distributions
|
|
||||||
* IrcMiRCARTBot.py usage: IrcMiRCARTBot.py `<IRC server hostname>` [`<IRC server port; defaults to 6667>`] [`<IRC bot nick name; defaults to pngbot>`] [`<IRC bot user name; defaults to pngbot>`] [`<IRC bot real name; defaults to pngbot>`] [`<IRC bot channel name; defaults to #MiRCART>`]
|
|
||||||
|
|
||||||
# MiRCARTToPngFile.py -- convert ASCII w/ mIRC control codes to monospaced PNG (pending cleanup)
|
|
||||||
* Prerequisites: python3 && python3-pil on Debian-family Linux distributions
|
|
||||||
* MiRC2png.py usage: MiRC2png.py `<MiRCART input file pathname>` `<PNG image output file pathname>` [`<Font file pathname; defaults to DejaVuSansMono.ttf>`] [`<Font size; defaults to 11>`]
|
|
||||||
|
|
||||||
References:
|
References:
|
||||||
Fri, 05 Jan 2018 17:01:47 +0100 [1] Python Releases for Windows | Python.org <https://www.python.org/downloads/windows/>
|
Fri, 05 Jan 2018 17:01:47 +0100 [1] Python Releases for Windows | Python.org <https://www.python.org/downloads/windows/>
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
1) {Copy to,Paste from} clipboard
|
1) Scrollbar
|
||||||
2) Incremental auto{load,save} & {backup,restore}
|
2) Allow {un,re}doing resizing
|
||||||
3) Open and toggle a reference image in the background
|
3) {Copy to,Paste from} clipboard
|
||||||
4) Client-Server or Peer-to-Peer realtime collaboration
|
4) Incremental auto{load,save} & {backup,restore}
|
||||||
5) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.)
|
5) Open and toggle a reference image in the background
|
||||||
6) Hotkey & graphical interfaces to {composed,parametrised} tools
|
6) Client-Server or Peer-to-Peer realtime collaboration
|
||||||
7) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits
|
7) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.)
|
||||||
8) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc.
|
8) Hotkey & graphical interfaces to {composed,parametrised} tools
|
||||||
9) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers
|
9) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits
|
||||||
10) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...)
|
10) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc.
|
||||||
11) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools:
|
11) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers
|
||||||
|
12) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...)
|
||||||
|
13) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools:
|
||||||
a) geometric primitives (arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star)
|
a) geometric primitives (arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star)
|
||||||
b) regions (crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate)
|
b) regions (crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate)
|
||||||
c) text (edit, Unicode sets)
|
c) text (edit, Unicode sets)
|
||||||
|
@ -5,19 +5,19 @@
|
|||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||||
|
|
||||||
|
import base64, json, requests, socket, time, urllib.request
|
||||||
from getopt import getopt, GetoptError
|
from getopt import getopt, GetoptError
|
||||||
import base64
|
from CanvasImportStore import CanvasImportStore
|
||||||
import os, socket, sys, time
|
from ImgurApiKey import ImgurApiKey
|
||||||
import json
|
from IrcClient import IrcClient
|
||||||
import IrcClient
|
|
||||||
import requests, urllib.request
|
|
||||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
|
||||||
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
|
|
||||||
from MiRCARTToPngFile import MiRCARTToPngFile
|
from MiRCARTToPngFile import MiRCARTToPngFile
|
||||||
|
|
||||||
class IrcMiRCARTBot(IrcClient.IrcClient):
|
class IrcMiRCARTBot(IrcClient):
|
||||||
"""IRC<->MiRC2png bot"""
|
"""IRC<->MiRC2png bot"""
|
||||||
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
|
imgurApiKey = ImgurApiKey.imgurApiKey
|
||||||
|
|
||||||
# {{{ ContentTooLargeException(Exception): Raised by _urlretrieveReportHook() given download size > 1 MB
|
# {{{ ContentTooLargeException(Exception): Raised by _urlretrieveReportHook() given download size > 1 MB
|
||||||
class ContentTooLargeException(Exception):
|
class ContentTooLargeException(Exception):
|
||||||
@ -125,7 +125,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
|||||||
self.queue("PRIVMSG", message[2], "4/!\\ Unknown URL type specified!")
|
self.queue("PRIVMSG", message[2], "4/!\\ Unknown URL type specified!")
|
||||||
return
|
return
|
||||||
|
|
||||||
canvasStore = MiRCARTCanvasImportStore(inFile=asciiTmpFilePath)
|
canvasStore = CanvasImportStore(inFile=asciiTmpFilePath)
|
||||||
numRowCols = 0
|
numRowCols = 0
|
||||||
for numRow in range(len(canvasStore.outMap)):
|
for numRow in range(len(canvasStore.outMap)):
|
||||||
numRowCols = max(numRowCols, len(canvasStore.outMap[numRow]))
|
numRowCols = max(numRowCols, len(canvasStore.outMap[numRow]))
|
||||||
@ -137,7 +137,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
|||||||
canvasStore.outMap[numRow].append([1, 1, 0, " "])
|
canvasStore.outMap[numRow].append([1, 1, 0, " "])
|
||||||
canvasStore.outMap.insert(0, [[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
canvasStore.outMap.insert(0, [[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
||||||
canvasStore.outMap.append([[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
canvasStore.outMap.append([[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
||||||
MiRCARTToPngFile(canvasStore.outMap, "DejaVuSansMono.ttf", 11).export(imgTmpFilePath)
|
MiRCARTToPngFile(canvasStore.outMap, os.path.join("..", "fonts", "DejaVuSansMono.ttf"), 11).export(imgTmpFilePath)
|
||||||
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", self.imgurApiKey)
|
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", self.imgurApiKey)
|
||||||
if imgurResponse[0] == None:
|
if imgurResponse[0] == None:
|
||||||
self._log("Upload failed with exception `{}'".format(imgurResponse[1]))
|
self._log("Upload failed with exception `{}'".format(imgurResponse[1]))
|
||||||
|
@ -5,22 +5,23 @@
|
|||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
import os, sys
|
||||||
import sys
|
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||||
|
|
||||||
|
from CanvasImportStore import CanvasImportStore
|
||||||
|
|
||||||
def canonicalise(inPathName):
|
def canonicalise(inPathName):
|
||||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
canvasStore = CanvasImportStore(inPathName)
|
||||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||||
with open(inPathName, "w+") as outFile:
|
with open(inPathName, "w+") as outFile:
|
||||||
for inCurRow in range(len(inMap)):
|
for inCurRow in range(len(inMap)):
|
||||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
lastAttribs, lastColours = CanvasImportStore._CellState.CS_NONE, None
|
||||||
lastColours = None
|
|
||||||
for inCurCol in range(len(inMap[inCurRow])):
|
for inCurCol in range(len(inMap[inCurRow])):
|
||||||
inCurCell = inMap[inCurRow][inCurCol]
|
inCurCell = inMap[inCurRow][inCurCol]
|
||||||
if lastAttribs != inCurCell[2]:
|
if lastAttribs != inCurCell[2]:
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||||
print("\u0002", end="", file=outFile)
|
print("\u0002", end="", file=outFile)
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||||
print("\u001f", end="", file=outFile)
|
print("\u001f", end="", file=outFile)
|
||||||
lastAttribs = inCurCell[2]
|
lastAttribs = inCurCell[2]
|
||||||
if lastColours == None or lastColours != inCurCell[:2]:
|
if lastColours == None or lastColours != inCurCell[:2]:
|
||||||
|
@ -5,22 +5,24 @@
|
|||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
import os, sys
|
||||||
|
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||||
|
|
||||||
|
from CanvasImportStore import CanvasImportStore
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def reduce(inPathName):
|
def reduce(inPathName):
|
||||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
canvasStore = CanvasImportStore(inPathName)
|
||||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||||
with open(inPathName, "w+") as outFile:
|
with open(inPathName, "w+") as outFile:
|
||||||
for inCurRow in range(len(inMap)):
|
for inCurRow in range(len(inMap)):
|
||||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
lastAttribs, lastColours = CanvasImportStore._CellState.CS_NONE, None
|
||||||
lastColours = None
|
|
||||||
for inCurCol in range(len(inMap[inCurRow])):
|
for inCurCol in range(len(inMap[inCurRow])):
|
||||||
inCurCell = inMap[inCurRow][inCurCol]
|
inCurCell = inMap[inCurRow][inCurCol]
|
||||||
if lastAttribs != inCurCell[2]:
|
if lastAttribs != inCurCell[2]:
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||||
print("\u0002", end="", file=outFile)
|
print("\u0002", end="", file=outFile)
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||||
print("\u001f", end="", file=outFile)
|
print("\u001f", end="", file=outFile)
|
||||||
lastAttribs = inCurCell[2]
|
lastAttribs = inCurCell[2]
|
||||||
if lastColours == None \
|
if lastColours == None \
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
import os, sys
|
||||||
import sys
|
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||||
|
|
||||||
|
from CanvasImportStore import CanvasImportStore
|
||||||
|
|
||||||
MiRCARTToAnsiColours = [
|
MiRCARTToAnsiColours = [
|
||||||
97, # Bright White
|
97, # Bright White
|
||||||
@ -28,18 +30,18 @@ MiRCARTToAnsiColours = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
def ToAnsi(inPathName):
|
def ToAnsi(inPathName):
|
||||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
canvasStore = CanvasImportStore(inPathName)
|
||||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||||
with open(inPathName, "w+") as outFile:
|
with open(inPathName, "w+") as outFile:
|
||||||
for inCurRow in range(len(inMap)):
|
for inCurRow in range(len(inMap)):
|
||||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
lastAttribs = CanvasImportStore._CellState.CS_NONE
|
||||||
lastColours = None
|
lastColours = None
|
||||||
for inCurCol in range(len(inMap[inCurRow])):
|
for inCurCol in range(len(inMap[inCurRow])):
|
||||||
inCurCell = inMap[inCurRow][inCurCol]
|
inCurCell = inMap[inCurRow][inCurCol]
|
||||||
if lastAttribs != inCurCell[2]:
|
if lastAttribs != inCurCell[2]:
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||||
print("\u001b[1m", end="", file=outFile)
|
print("\u001b[1m", end="", file=outFile)
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||||
print("\u001b[4m", end="", file=outFile)
|
print("\u001b[4m", end="", file=outFile)
|
||||||
lastAttribs = inCurCell[2]
|
lastAttribs = inCurCell[2]
|
||||||
if lastColours == None or lastColours != inCurCell[:2]:
|
if lastColours == None or lastColours != inCurCell[:2]:
|
||||||
|
@ -5,9 +5,12 @@
|
|||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
import MiRCARTCanvasImportStore
|
import os, sys
|
||||||
|
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl", "libtools"]]
|
||||||
|
|
||||||
|
from CanvasImportStore import CanvasImportStore
|
||||||
|
from getopt import getopt, GetoptError
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
import sys
|
|
||||||
|
|
||||||
class MiRCARTToPngFile:
|
class MiRCARTToPngFile:
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
@ -73,7 +76,7 @@ class MiRCARTToPngFile:
|
|||||||
for inCurCol in range(len(self.inCanvasMap[inCurRow])):
|
for inCurCol in range(len(self.inCanvasMap[inCurRow])):
|
||||||
inCurCell = self.inCanvasMap[inCurRow][inCurCol]
|
inCurCell = self.inCanvasMap[inCurRow][inCurCol]
|
||||||
outColours = [0, 0]
|
outColours = [0, 0]
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore.MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||||
if inCurCell[3] != " ":
|
if inCurCell[3] != " ":
|
||||||
if inCurCell[3] == "█":
|
if inCurCell[3] == "█":
|
||||||
outColours[1] = self._ColourMapNormal[inCurCell[0]]
|
outColours[1] = self._ColourMapNormal[inCurCell[0]]
|
||||||
@ -100,7 +103,7 @@ class MiRCARTToPngFile:
|
|||||||
# XXX implement italic
|
# XXX implement italic
|
||||||
outImgDraw.text(outCurPos, \
|
outImgDraw.text(outCurPos, \
|
||||||
inCurCell[3], (*outColours[0], 255), self.outImgFont)
|
inCurCell[3], (*outColours[0], 255), self.outImgFont)
|
||||||
if inCurCell[2] & MiRCARTCanvasImportStore.MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||||
outColours[0] = self._ColourMapNormal[inCurCell[0]]
|
outColours[0] = self._ColourMapNormal[inCurCell[0]]
|
||||||
self._drawUnderLine(outCurPos, \
|
self._drawUnderLine(outCurPos, \
|
||||||
self.outImgFontSize, \
|
self.outImgFontSize, \
|
||||||
@ -112,29 +115,31 @@ class MiRCARTToPngFile:
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
#
|
#
|
||||||
# __init__(self, inCanvasMap, fontFilePath="DejaVuSansMono.ttf", fontSize=11): initialisation method
|
# __init__(self, inCanvasMap, fontFilePath, fontSize): initialisation method
|
||||||
def __init__(self, inCanvasMap, fontFilePath="DejaVuSansMono.ttf", fontSize=11):
|
def __init__(self, inCanvasMap, fontFilePath, fontSize):
|
||||||
self.inCanvasMap = inCanvasMap
|
self.inCanvasMap = inCanvasMap
|
||||||
self.outFontFilePath = fontFilePath; self.outFontSize = int(fontSize);
|
self.outFontFilePath, self.outFontSize = fontFilePath, fontSize
|
||||||
self.outImgFont = ImageFont.truetype( \
|
self.outImgFont = ImageFont.truetype(self.outFontFilePath, self.outFontSize)
|
||||||
self.outFontFilePath, self.outFontSize)
|
|
||||||
self.outImgFontSize = [*self.outImgFont.getsize(" ")]
|
self.outImgFontSize = [*self.outImgFont.getsize(" ")]
|
||||||
self.outImgFontSize[1] += 3
|
self.outImgFontSize[1] += 3
|
||||||
|
|
||||||
#
|
#
|
||||||
# Entry point
|
# Entry point
|
||||||
def main(*argv):
|
def main(*argv):
|
||||||
canvasStore = MiRCARTCanvasImportStore.MiRCARTCanvasImportStore(inFile=argv[1])
|
argv0 = argv[0]; optlist, argv = getopt(argv[1:], "f:hs:"); optdict = dict(optlist);
|
||||||
MiRCARTToPngFile(canvasStore.outMap, *argv[3:]).export(argv[2])
|
if len(argv) < 1:
|
||||||
if __name__ == "__main__":
|
print("""usage: {} [-f fname] [-h] [-s size] fname...
|
||||||
if ((len(sys.argv) - 1) < 2)\
|
-h.........: show this screen
|
||||||
or ((len(sys.argv) - 1) > 4):
|
-f fname...: font file pathname (defaults to: ../fonts/DejaVuSansMono.ttf)
|
||||||
print("usage: {} " \
|
-s size....: font size (defaults to: 11)""".format(argv0), file=sys.stderr)
|
||||||
"<MiRCART input file pathname> " \
|
|
||||||
"<PNG image output file pathname> " \
|
|
||||||
"[<Font file pathname; defaults to DejaVuSansMono.ttf>] " \
|
|
||||||
"[<Font size; defaults to 11>]".format(sys.argv[0]), file=sys.stderr)
|
|
||||||
else:
|
else:
|
||||||
|
if not "-f" in optdict:
|
||||||
|
optdict["-f"] = os.path.join("..", "fonts", "DejaVuSansMono.ttf")
|
||||||
|
optdict["-s"] = 11 if not "-s" in optdict else int(optdict["-s"])
|
||||||
|
for inFile in argv:
|
||||||
|
canvasStore, outFile = CanvasImportStore(inFile=inFile), os.path.splitext(inFile)[0] + ".png"
|
||||||
|
MiRCARTToPngFile(canvasStore.outMap, fontFilePath=optdict["-f"], fontSize=optdict["-s"]).export(outFile)
|
||||||
|
if __name__ == "__main__":
|
||||||
main(*sys.argv)
|
main(*sys.argv)
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# MiRCARTToPngFiles.sh -- convert ASCII(s) w/ mIRC control codes to monospaced PNG(s) (for EFnet #MiRCART)
|
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
||||||
# This project is licensed under the terms of the MIT licence.
|
|
||||||
#
|
|
||||||
|
|
||||||
for FNAME in "${@}"; do
|
|
||||||
./MiRCARTToPngFile.py "${FNAME}" "${FNAME%.txt}.png";
|
|
||||||
done;
|
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
|
@ -1,50 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
|
|
||||||
RELEASE_DEPS="rsync sed";
|
|
||||||
|
|
||||||
rc() {
|
|
||||||
local _cmd="${1}"; shift;
|
|
||||||
printf "%s >>> %s %s\n" "$(date +"%d-%^b-%Y %H:%M:%S")" "${_cmd}" "${*}";
|
|
||||||
"${_cmd}" "${@}";
|
|
||||||
};
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "usage: ${0} [-h] old_version new_version" >&2;
|
|
||||||
echo " -h.........: show this screen" >&2;
|
|
||||||
};
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local _opt="" _version_new="" _version_new_code="" _version_old="";
|
|
||||||
while getopts hv _opt; do
|
|
||||||
case "${_opt}" in
|
|
||||||
h) usage; exit 0; ;;
|
|
||||||
*) usage; exit 1; ;;
|
|
||||||
esac; done;
|
|
||||||
shift $((${OPTIND}-1));
|
|
||||||
if [ -z "${1}" ]; then
|
|
||||||
echo "error: empty or missing old version number argument" >&2; usage; exit 1;
|
|
||||||
elif [ -z "${2}" ]; then
|
|
||||||
echo "error: empty or missing new version number argument" >&2; usage; exit 1;
|
|
||||||
else
|
|
||||||
_version_old="${1}"; _version_new="${2}";
|
|
||||||
_version_new_code="$(echo "${_version_new}" | sed -e 's,\.,,g' -e 's/^[0-9]/&00/')";
|
|
||||||
fi;
|
|
||||||
for _cmd in ${RELEASE_DEPS_CMD}; do
|
|
||||||
if ! which "${_cmd}" >/dev/null; then
|
|
||||||
echo "error: missing prerequisite command \`${_cmd}'";
|
|
||||||
exit 1;
|
|
||||||
fi;
|
|
||||||
done;
|
|
||||||
rc sed -i"" '/"version":/s/\("version":\s*\)"'"${_version_old}"'"/\1"'"${_version_new}"'"/' \
|
|
||||||
MiRCART-nw/package.json \
|
|
||||||
MiRCART-nw/package-lock.json;
|
|
||||||
rc sed -i"" '/<title>[^<]\+ v/s/\(<title>[^<]\+ v\)'"${_version_old}"'\(.*<\)/\1'"${_version_new}"'\2/' \
|
|
||||||
assets/html/help.html assets/html/index.html;
|
|
||||||
rc git commit -avm "Bump to v${_version_new}.";
|
|
||||||
};
|
|
||||||
|
|
||||||
set -o errexit -o noglob;
|
|
||||||
main "${@}";
|
|
||||||
|
|
||||||
# vim:foldmethod=marker sw=8 ts=8 tw=120
|
|
@ -1,40 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
|
|
||||||
msgf() {
|
|
||||||
local _fmt="${1}"; shift;
|
|
||||||
printf "%s >>> ${_fmt}\n" "$(date +"%d-%^b-%Y %H:%M:%S")" "${@}";
|
|
||||||
};
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "usage: ${0} [-h] [-v]" >&2;
|
|
||||||
echo " -h.........: show this screen" >&2;
|
|
||||||
echo " -v.........: be verbose" >&2;
|
|
||||||
};
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local _cmd="" _build="" _opt="" _vflag=0;
|
|
||||||
while getopts hv _opt; do
|
|
||||||
case "${_opt}" in
|
|
||||||
h) usage; exit 0; ;;
|
|
||||||
v) _vflag=1; ;;
|
|
||||||
*) usage; exit 1; ;;
|
|
||||||
esac; done;
|
|
||||||
shift $((${OPTIND}-1));
|
|
||||||
for _build in nw www; do
|
|
||||||
msgf "Deploying ${_build}...";
|
|
||||||
cd "MiRCART-${_build}";
|
|
||||||
if [ "${_vflag:-0}" -eq 0 ]; then
|
|
||||||
./deploy.sh "${@}";
|
|
||||||
else
|
|
||||||
./deploy.sh -v "${@}";
|
|
||||||
fi;
|
|
||||||
cd "${OLDPWD}";
|
|
||||||
msgf "Deployed ${_build}.";
|
|
||||||
done;
|
|
||||||
};
|
|
||||||
|
|
||||||
set -o errexit -o noglob;
|
|
||||||
main "${@}";
|
|
||||||
|
|
||||||
# vim:foldmethod=marker sw=8 ts=8 tw=120
|
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
|
|
||||||
PACKAGE_NAME="MiRCART-www";
|
PACKAGE_NAME="roar-python";
|
||||||
RELEASE_DEPS="cpio find rm sed zip";
|
RELEASE_DEPS="cpio find rm sed zip";
|
||||||
RELEASES_DNAME="releases";
|
RELEASES_DNAME="releases";
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ msgf() {
|
|||||||
deploy() {
|
deploy() {
|
||||||
local _vflag="${1}" _release_fname="" _release_dname="" _release_version="";
|
local _vflag="${1}" _release_fname="" _release_dname="" _release_version="";
|
||||||
|
|
||||||
_release_version="$(sed -n '/^\s*<title>/s/^\s*<title>MiRCART v\([0-9.]\+\)<\/title>\s*$/\1/p' index.html)";
|
_release_version="$(git rev-parse --short HEAD)";
|
||||||
_release_dname="${RELEASES_DNAME}/${PACKAGE_NAME}-${_release_version}";
|
_release_dname="${RELEASES_DNAME}/${PACKAGE_NAME}-${_release_version}";
|
||||||
_release_fname="${_release_dname}.zip";
|
_release_fname="${_release_dname}.zip";
|
||||||
|
|
||||||
@ -21,9 +21,12 @@ deploy() {
|
|||||||
-mindepth 1 \
|
-mindepth 1 \
|
||||||
-not -path "./${RELEASES_DNAME}/*" \
|
-not -path "./${RELEASES_DNAME}/*" \
|
||||||
-not -path "./${RELEASES_DNAME}" \
|
-not -path "./${RELEASES_DNAME}" \
|
||||||
|
-not -path "./.git/*" \
|
||||||
|
-not -path "./.git" \
|
||||||
-not -name '*.sw*' \
|
-not -name '*.sw*' \
|
||||||
-not -name "${0##*/}" |\
|
-not -name "${0##*/}" |\
|
||||||
cpio --quiet -dLmp "${_release_dname}";
|
cpio --quiet -dLmp "${_release_dname}";
|
||||||
|
sed -i"" "s/__ROAR_RELEASE_GIT_SHORT_REV__/${_release_version}/" "${_release_dname}/libcanvas/CanvasInterface.py";
|
||||||
cd "${RELEASES_DNAME}";
|
cd "${RELEASES_DNAME}";
|
||||||
if [ "${_vflag:-0}" -eq 0 ]; then
|
if [ "${_vflag:-0}" -eq 0 ]; then
|
||||||
zip -9 -r "${_release_fname##${RELEASES_DNAME}/}" "${_release_dname##${RELEASES_DNAME}/}" >/dev/null;
|
zip -9 -r "${_release_fname##${RELEASES_DNAME}/}" "${_release_dname##${RELEASES_DNAME}/}" >/dev/null;
|
@ -1,18 +1,18 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvas.py -- XXX
|
# Canvas.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTCanvasBackend import MiRCARTCanvasBackend
|
from CanvasBackend import CanvasBackend
|
||||||
from MiRCARTCanvasJournal import MiRCARTCanvasJournal
|
from CanvasJournal import CanvasJournal
|
||||||
from MiRCARTCanvasExportStore import MiRCARTCanvasExportStore, haveMiRCARTToPngFile, haveUrllib
|
from CanvasExportStore import CanvasExportStore, haveToPngFile, haveUrllib
|
||||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
from CanvasImportStore import CanvasImportStore
|
||||||
from MiRCARTCanvasInterface import MiRCARTCanvasInterface
|
from CanvasInterface import CanvasInterface
|
||||||
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
|
from ImgurApiKey import ImgurApiKey
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
class MiRCARTCanvas(wx.Panel):
|
class Canvas(wx.Panel):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
parentFrame = None
|
parentFrame = None
|
||||||
defaultCanvasPos = defaultCanvasSize = defaultCellSize = None
|
defaultCanvasPos = defaultCanvasSize = defaultCellSize = None
|
||||||
@ -21,7 +21,7 @@ class MiRCARTCanvas(wx.Panel):
|
|||||||
canvasBackend = canvasJournal = None
|
canvasBackend = canvasJournal = None
|
||||||
canvasExportStore = canvasImportStore = None
|
canvasExportStore = canvasImportStore = None
|
||||||
canvasInterface = None
|
canvasInterface = None
|
||||||
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
|
imgurApiKey = ImgurApiKey.imgurApiKey
|
||||||
|
|
||||||
# {{{ _commitPatch(self, patch): XXX
|
# {{{ _commitPatch(self, patch): XXX
|
||||||
def _commitPatch(self, patch):
|
def _commitPatch(self, patch):
|
||||||
@ -124,9 +124,9 @@ class MiRCARTCanvas(wx.Panel):
|
|||||||
self.canvasMap = []; oldCanvasSize = [0, 0];
|
self.canvasMap = []; oldCanvasSize = [0, 0];
|
||||||
else:
|
else:
|
||||||
oldCanvasSize = self.canvasSize
|
oldCanvasSize = self.canvasSize
|
||||||
deltaCanvasSize = [b-a for a,b in zip(oldCanvasSize, newCanvasSize)]
|
deltaCanvasSize = [b - a for a, b in zip(oldCanvasSize, newCanvasSize)]
|
||||||
|
|
||||||
newWinSize = [a*b for a,b in zip(newCanvasSize, self.canvasBackend.cellSize)]
|
newWinSize = [a * b for a, b in zip(newCanvasSize, self.canvasBackend.cellSize)]
|
||||||
self.SetMinSize(newWinSize)
|
self.SetMinSize(newWinSize)
|
||||||
self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *newWinSize)
|
self.SetSize(wx.DefaultCoord, wx.DefaultCoord, *newWinSize)
|
||||||
curWindow = self
|
curWindow = self
|
||||||
@ -175,7 +175,7 @@ class MiRCARTCanvas(wx.Panel):
|
|||||||
# __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method
|
# __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method
|
||||||
def __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize):
|
def __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize):
|
||||||
super().__init__(parent, pos=defaultCanvasPos, \
|
super().__init__(parent, pos=defaultCanvasPos, \
|
||||||
size=[w*h for w,h in zip(defaultCanvasSize, defaultCellSize)])
|
size=[w * h for w, h in zip(defaultCanvasSize, defaultCellSize)])
|
||||||
|
|
||||||
self.parentFrame = parentFrame
|
self.parentFrame = parentFrame
|
||||||
self.canvasMap = None
|
self.canvasMap = None
|
||||||
@ -184,11 +184,11 @@ class MiRCARTCanvas(wx.Panel):
|
|||||||
self.brushColours = [4, 1]; self.brushPos = [0, 0]; self.brushSize = [1, 1];
|
self.brushColours = [4, 1]; self.brushPos = [0, 0]; self.brushSize = [1, 1];
|
||||||
self.parentFrame.onCanvasUpdate( \
|
self.parentFrame.onCanvasUpdate( \
|
||||||
brushSize=self.brushSize, colours=self.brushColours)
|
brushSize=self.brushSize, colours=self.brushColours)
|
||||||
self.canvasBackend = MiRCARTCanvasBackend(defaultCanvasSize, defaultCellSize)
|
self.canvasBackend = CanvasBackend(defaultCanvasSize, defaultCellSize)
|
||||||
self.canvasJournal = MiRCARTCanvasJournal()
|
self.canvasJournal = CanvasJournal()
|
||||||
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)
|
self.canvasExportStore = CanvasExportStore(parentCanvas=self)
|
||||||
self.canvasImportStore = MiRCARTCanvasImportStore(parentCanvas=self)
|
self.canvasImportStore = CanvasImportStore(parentCanvas=self)
|
||||||
self.canvasInterface = MiRCARTCanvasInterface(self, parentFrame)
|
self.canvasInterface = CanvasInterface(self, parentFrame)
|
||||||
|
|
||||||
# Bind event handlers
|
# Bind event handlers
|
||||||
self.Bind(wx.EVT_CLOSE, self.onPanelClose)
|
self.Bind(wx.EVT_CLOSE, self.onPanelClose)
|
@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvasBackend.py -- XXX
|
# CanvasBackend.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTColours import MiRCARTColours
|
from Colours import Colours
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
class MiRCARTCanvasBackend():
|
class CanvasBackend():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
_font = _brushes = _pens = None
|
_font = _brushes = _pens = None
|
||||||
_lastBrush = _lastPen = None
|
_lastBrush = _lastPen = None
|
||||||
@ -30,8 +30,8 @@ class MiRCARTCanvasBackend():
|
|||||||
pen = self._pens[patch[3]]
|
pen = self._pens[patch[3]]
|
||||||
fontBitmap = wx.Bitmap(*self.cellSize)
|
fontBitmap = wx.Bitmap(*self.cellSize)
|
||||||
fontDc = wx.MemoryDC(); fontDc.SelectObject(fontBitmap);
|
fontDc = wx.MemoryDC(); fontDc.SelectObject(fontBitmap);
|
||||||
fontDc.SetTextForeground(wx.Colour(MiRCARTColours[patch[2]][0:4]))
|
fontDc.SetTextForeground(wx.Colour(Colours[patch[2]][0:4]))
|
||||||
fontDc.SetTextBackground(wx.Colour(MiRCARTColours[patch[3]][0:4]))
|
fontDc.SetTextBackground(wx.Colour(Colours[patch[3]][0:4]))
|
||||||
fontDc.SetBrush(brushBg); fontDc.SetBackground(brushBg); fontDc.SetPen(pen);
|
fontDc.SetBrush(brushBg); fontDc.SetBackground(brushBg); fontDc.SetPen(pen);
|
||||||
fontDc.SetFont(self._font)
|
fontDc.SetFont(self._font)
|
||||||
fontDc.DrawRectangle(0, 0, *self.cellSize)
|
fontDc.DrawRectangle(0, 0, *self.cellSize)
|
||||||
@ -50,13 +50,13 @@ class MiRCARTCanvasBackend():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ _initBrushesAndPens(self): XXX
|
# {{{ _initBrushesAndPens(self): XXX
|
||||||
def _initBrushesAndPens(self):
|
def _initBrushesAndPens(self):
|
||||||
self._brushes = [None for x in range(len(MiRCARTColours))]
|
self._brushes = [None for x in range(len(Colours))]
|
||||||
self._pens = [None for x in range(len(MiRCARTColours))]
|
self._pens = [None for x in range(len(Colours))]
|
||||||
for mircColour in range(len(MiRCARTColours)):
|
for mircColour in range(len(Colours)):
|
||||||
self._brushes[mircColour] = wx.Brush( \
|
self._brushes[mircColour] = wx.Brush( \
|
||||||
wx.Colour(MiRCARTColours[mircColour][0:4]), wx.BRUSHSTYLE_SOLID)
|
wx.Colour(Colours[mircColour][0:4]), wx.BRUSHSTYLE_SOLID)
|
||||||
self._pens[mircColour] = wx.Pen( \
|
self._pens[mircColour] = wx.Pen( \
|
||||||
wx.Colour(MiRCARTColours[mircColour][0:4]), 1)
|
wx.Colour(Colours[mircColour][0:4]), 1)
|
||||||
self._lastBrushBg = self._lastBrushFg = self._lastPen = None;
|
self._lastBrushBg = self._lastBrushFg = self._lastPen = None;
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ _setBrushDc(self, brushBg, brushFg, dc, pen): XXX
|
# {{{ _setBrushDc(self, brushBg, brushFg, dc, pen): XXX
|
||||||
@ -73,7 +73,7 @@ class MiRCARTCanvasBackend():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ _xlatePoint(self, patch): XXX
|
# {{{ _xlatePoint(self, patch): XXX
|
||||||
def _xlatePoint(self, patch):
|
def _xlatePoint(self, patch):
|
||||||
return [a*b for a,b in zip(patch[0:2], self.cellSize)]
|
return [a * b for a, b in zip(patch[0:2], self.cellSize)]
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# {{{ drawPatch(self, eventDc, patch): XXX
|
# {{{ drawPatch(self, eventDc, patch): XXX
|
||||||
@ -113,7 +113,7 @@ class MiRCARTCanvasBackend():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ resize(self, canvasSize, cellSize):
|
# {{{ resize(self, canvasSize, cellSize):
|
||||||
def resize(self, canvasSize, cellSize):
|
def resize(self, canvasSize, cellSize):
|
||||||
winSize = [a*b for a,b in zip(canvasSize, cellSize)]
|
winSize = [a * b for a, b in zip(canvasSize, cellSize)]
|
||||||
if self.canvasBitmap == None:
|
if self.canvasBitmap == None:
|
||||||
self.canvasBitmap = wx.Bitmap(winSize)
|
self.canvasBitmap = wx.Bitmap(winSize)
|
||||||
else:
|
else:
|
@ -1,16 +1,16 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvasExportStore.py -- XXX
|
# CanvasExportStore.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
import io, os, tempfile
|
import io, os, tempfile
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from MiRCARTToPngFile import MiRCARTToPngFile
|
from ToPngFile import ToPngFile
|
||||||
haveMiRCARTToPngFile = True
|
haveToPngFile = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
haveMiRCARTToPngFile = False
|
haveToPngFile = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import base64, json, requests, urllib.request
|
import base64, json, requests, urllib.request
|
||||||
@ -18,7 +18,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
haveUrllib = False
|
haveUrllib = False
|
||||||
|
|
||||||
class MiRCARTCanvasExportStore():
|
class CanvasExportStore():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
parentCanvas = None
|
parentCanvas = None
|
||||||
|
|
||||||
@ -81,8 +81,8 @@ class MiRCARTCanvasExportStore():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ exportPngFile(self, canvasMap, outPathName): XXX
|
# {{{ exportPngFile(self, canvasMap, outPathName): XXX
|
||||||
def exportPngFile(self, canvasMap, outPathName):
|
def exportPngFile(self, canvasMap, outPathName):
|
||||||
if haveMiRCARTToPngFile:
|
if haveToPngFile:
|
||||||
MiRCARTToPngFile(canvasMap).export(outPathName)
|
ToPngFile(canvasMap).export(outPathName)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvasImportStore.py -- XXX
|
# CanvasImportStore.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
# This project is licensed under the terms of the MIT licence.
|
# This project is licensed under the terms of the MIT licence.
|
||||||
#
|
#
|
||||||
|
|
||||||
class MiRCARTCanvasImportStore():
|
class CanvasImportStore():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
inFile = inSize = outMap = None
|
inFile = inSize = outMap = None
|
||||||
parentCanvas = None
|
parentCanvas = None
|
@ -1,20 +1,62 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvasInterface.py -- XXX
|
# CanvasInterface.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTToolCircle import MiRCARTToolCircle
|
from ToolCircle import ToolCircle
|
||||||
from MiRCARTToolFill import MiRCARTToolFill
|
from ToolFill import ToolFill
|
||||||
from MiRCARTToolLine import MiRCARTToolLine
|
from ToolLine import ToolLine
|
||||||
from MiRCARTToolSelectClone import MiRCARTToolSelectClone
|
from ToolSelectClone import ToolSelectClone
|
||||||
from MiRCARTToolSelectMove import MiRCARTToolSelectMove
|
from ToolSelectMove import ToolSelectMove
|
||||||
from MiRCARTToolRect import MiRCARTToolRect
|
from ToolRect import ToolRect
|
||||||
from MiRCARTToolText import MiRCARTToolText
|
from ToolText import ToolText
|
||||||
|
|
||||||
import os, wx
|
from glob import glob
|
||||||
|
import os, random, wx, wx.adv
|
||||||
|
|
||||||
class MiRCARTCanvasInterface():
|
class CanvasInterfaceAbout(wx.Dialog):
|
||||||
|
"""XXX"""
|
||||||
|
|
||||||
|
# {{{ onButtonRoar(self, event): XXX
|
||||||
|
def onButtonRoar(self, event):
|
||||||
|
self.Destroy()
|
||||||
|
# }}}
|
||||||
|
# {{{ __init__(self, parent, size=(320, 240), title="About roar"): XXX
|
||||||
|
def __init__(self, parent, size=(320, 240), title="About roar"):
|
||||||
|
super(CanvasInterfaceAbout, 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)
|
||||||
|
|
||||||
|
logoPathNames = glob(os.path.join("assets", "images", "logo*.bmp"))
|
||||||
|
logoPathName = logoPathNames[random.randint(0, len(logoPathNames) - 1)]
|
||||||
|
self.logo = wx.StaticBitmap(self, -1, wx.Bitmap(logoPathName))
|
||||||
|
self.sizerH1.Add(self.logo, 0, wx.CENTER)
|
||||||
|
|
||||||
|
self.title = wx.StaticText(self.panel, label="roar -- mIRC art editor for Windows & Linux (Git revision __ROAR_RELEASE_GIT_SHORT_REV__)\nhttps://www.github.com/lalbornoz/roar/\nCopyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>", style=wx.ALIGN_CENTER)
|
||||||
|
self.title.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=False))
|
||||||
|
self.sizer.Add(self.title)
|
||||||
|
|
||||||
|
labelsText = ["roar!", "ROAR!", "roaaaaaaar!", "ROAROARAOR", "_ROAR_"]
|
||||||
|
labelText = labelsText[random.randint(0, len(labelsText) - 1)]
|
||||||
|
self.buttonRoar = wx.Button(self.panel, label=labelText, pos=(75, 10))
|
||||||
|
self.buttonRoar.Bind(wx.EVT_BUTTON, self.onButtonRoar)
|
||||||
|
self.sizerH2.Add(self.buttonRoar, 0, wx.CENTER)
|
||||||
|
|
||||||
|
self.sizer.Add(self.sizerH1, 0, wx.CENTER)
|
||||||
|
self.sizer.Add(self.sizerH2, 0, wx.CENTER)
|
||||||
|
self.SetSizer(self.sizer); self.sizer.Fit(self.panel);
|
||||||
|
self.SetSize(size); self.SetTitle(title); self.Center();
|
||||||
|
|
||||||
|
soundBitePathNames = glob(os.path.join("assets", "audio", "roar*.wav"))
|
||||||
|
soundBitePathName = soundBitePathNames[random.randint(0, len(logoPathNames) - 1)]
|
||||||
|
self.soundBite = wx.adv.Sound(soundBitePathName)
|
||||||
|
if self.soundBite.IsOk():
|
||||||
|
self.soundBite.Play(wx.adv.SOUND_ASYNC)
|
||||||
|
|
||||||
|
self.ShowModal()
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
class CanvasInterface():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
imgurApiKey = None
|
imgurApiKey = None
|
||||||
parentCanvas = parentFrame = canvasPathName = canvasTool = None
|
parentCanvas = parentFrame = canvasPathName = canvasTool = None
|
||||||
@ -23,12 +65,16 @@ class MiRCARTCanvasInterface():
|
|||||||
def _dialogSaveChanges(self):
|
def _dialogSaveChanges(self):
|
||||||
with wx.MessageDialog(self.parentCanvas, \
|
with wx.MessageDialog(self.parentCanvas, \
|
||||||
"Do you want to save changes to {}?".format( \
|
"Do you want to save changes to {}?".format( \
|
||||||
self.canvasPathName), "MiRCART", \
|
self.canvasPathName), "", \
|
||||||
wx.CANCEL|wx.CANCEL_DEFAULT|wx.ICON_QUESTION|wx.YES_NO) as dialog:
|
wx.CANCEL|wx.CANCEL_DEFAULT|wx.ICON_QUESTION|wx.YES_NO) as dialog:
|
||||||
dialogChoice = dialog.ShowModal()
|
dialogChoice = dialog.ShowModal()
|
||||||
return dialogChoice
|
return dialogChoice
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
# {{{ canvasAbout(self, event): XXX
|
||||||
|
def canvasAbout(self, event):
|
||||||
|
CanvasInterfaceAbout(self.parentFrame)
|
||||||
|
# }}}
|
||||||
# {{{ canvasBrushSolid(self, event): XXX
|
# {{{ canvasBrushSolid(self, event): XXX
|
||||||
def canvasBrushSolid(self, event):
|
def canvasBrushSolid(self, event):
|
||||||
pass
|
pass
|
||||||
@ -173,7 +219,7 @@ class MiRCARTCanvasInterface():
|
|||||||
def canvasIncrCanvasHeight(self, event):
|
def canvasIncrCanvasHeight(self, event):
|
||||||
self.parentCanvas.resize([ \
|
self.parentCanvas.resize([ \
|
||||||
self.parentCanvas.canvasSize[0], \
|
self.parentCanvas.canvasSize[0], \
|
||||||
self.parentCanvas.canvasSize[1]+1])
|
self.parentCanvas.canvasSize[1] + 1])
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasIncrCanvasHeightWidth(self, event): XXX
|
# {{{ canvasIncrCanvasHeightWidth(self, event): XXX
|
||||||
def canvasIncrCanvasHeightWidth(self, event):
|
def canvasIncrCanvasHeightWidth(self, event):
|
||||||
@ -183,7 +229,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# {{{ canvasIncrCanvasWidth(self, event): XXX
|
# {{{ canvasIncrCanvasWidth(self, event): XXX
|
||||||
def canvasIncrCanvasWidth(self, event):
|
def canvasIncrCanvasWidth(self, event):
|
||||||
self.parentCanvas.resize([ \
|
self.parentCanvas.resize([ \
|
||||||
self.parentCanvas.canvasSize[0]+1, \
|
self.parentCanvas.canvasSize[0] + 1, \
|
||||||
self.parentCanvas.canvasSize[1]])
|
self.parentCanvas.canvasSize[1]])
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasNew(self, event, newCanvasSize=None): XXX
|
# {{{ canvasNew(self, event, newCanvasSize=None): XXX
|
||||||
@ -265,7 +311,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolCircle(self, event): XXX
|
# {{{ canvasToolCircle(self, event): XXX
|
||||||
def canvasToolCircle(self, event):
|
def canvasToolCircle(self, event):
|
||||||
self.canvasTool = MiRCARTToolCircle(self.parentCanvas)
|
self.canvasTool = ToolCircle(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_CIRCLE[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_CIRCLE[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CIRCLE[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CIRCLE[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_CIRCLE[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_CIRCLE[0], True)
|
||||||
@ -273,7 +319,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolFill(self, event): XXX
|
# {{{ canvasToolFill(self, event): XXX
|
||||||
def canvasToolFill(self, event):
|
def canvasToolFill(self, event):
|
||||||
self.canvasTool = MiRCARTToolFill(self.parentCanvas)
|
self.canvasTool = ToolFill(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_FILL[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_FILL[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_FILL[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_FILL[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_FILL[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_FILL[0], True)
|
||||||
@ -281,7 +327,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolLine(self, event): XXX
|
# {{{ canvasToolLine(self, event): XXX
|
||||||
def canvasToolLine(self, event):
|
def canvasToolLine(self, event):
|
||||||
self.canvasTool = MiRCARTToolLine(self.parentCanvas)
|
self.canvasTool = ToolLine(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_LINE[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_LINE[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_LINE[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_LINE[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_LINE[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_LINE[0], True)
|
||||||
@ -289,7 +335,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolSelectClone(self, event): XXX
|
# {{{ canvasToolSelectClone(self, event): XXX
|
||||||
def canvasToolSelectClone(self, event):
|
def canvasToolSelectClone(self, event):
|
||||||
self.canvasTool = MiRCARTToolSelectClone(self.parentCanvas)
|
self.canvasTool = ToolSelectClone(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_CLONE_SELECT[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_CLONE_SELECT[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CLONE_SELECT[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CLONE_SELECT[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_CLONE_SELECT[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_CLONE_SELECT[0], True)
|
||||||
@ -297,7 +343,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolSelectMove(self, event): XXX
|
# {{{ canvasToolSelectMove(self, event): XXX
|
||||||
def canvasToolSelectMove(self, event):
|
def canvasToolSelectMove(self, event):
|
||||||
self.canvasTool = MiRCARTToolSelectMove(self.parentCanvas)
|
self.canvasTool = ToolSelectMove(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_MOVE_SELECT[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_MOVE_SELECT[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_MOVE_SELECT[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_MOVE_SELECT[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_MOVE_SELECT[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_MOVE_SELECT[0], True)
|
||||||
@ -305,7 +351,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolRect(self, event): XXX
|
# {{{ canvasToolRect(self, event): XXX
|
||||||
def canvasToolRect(self, event):
|
def canvasToolRect(self, event):
|
||||||
self.canvasTool = MiRCARTToolRect(self.parentCanvas)
|
self.canvasTool = ToolRect(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_RECT[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_RECT[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_RECT[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_RECT[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_RECT[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_RECT[0], True)
|
||||||
@ -313,7 +359,7 @@ class MiRCARTCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasToolText(self, event): XXX
|
# {{{ canvasToolText(self, event): XXX
|
||||||
def canvasToolText(self, event):
|
def canvasToolText(self, event):
|
||||||
self.canvasTool = MiRCARTToolText(self.parentCanvas)
|
self.canvasTool = ToolText(self.parentCanvas)
|
||||||
self.parentFrame.menuItemsById[self.parentFrame.CID_TEXT[0]].Check(True)
|
self.parentFrame.menuItemsById[self.parentFrame.CID_TEXT[0]].Check(True)
|
||||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_TEXT[0]].GetToolBar()
|
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_TEXT[0]].GetToolBar()
|
||||||
toolBar.ToggleTool(self.parentFrame.CID_TEXT[0], True)
|
toolBar.ToggleTool(self.parentFrame.CID_TEXT[0], True)
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTCanvasJournal.py -- XXX
|
# CanvasJournal.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
class MiRCARTCanvasJournal():
|
class CanvasJournal():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
patchesCursor = patchesUndo = patchesUndoLevel = None
|
patchesCursor = patchesUndo = patchesUndoLevel = None
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTColours.py -- XXX
|
# Colours.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# MiRCARTColours: mIRC colour number to RGBA map given none of ^[BFV_] (bold, italic, reverse, underline],
|
# Colours: mIRC colour number to RGBA map given none of ^[BFV_] (bold, italic, reverse, underline],
|
||||||
#
|
#
|
||||||
MiRCARTColours = [
|
Colours = [
|
||||||
[255, 255, 255, 255, "White"],
|
[255, 255, 255, 255, "White"],
|
||||||
[0, 0, 0, 255, "Black"],
|
[0, 0, 0, 255, "Black"],
|
||||||
[0, 0, 187, 255, "Blue"],
|
[0, 0, 187, 255, "Blue"],
|
@ -1,91 +1,94 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTFrame.py -- XXX
|
# GuiFrame.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTCanvas import MiRCARTCanvas, haveUrllib
|
from Canvas import Canvas, haveUrllib
|
||||||
from MiRCARTCanvasInterface import MiRCARTCanvasInterface
|
from CanvasInterface import CanvasInterface
|
||||||
from MiRCARTColours import MiRCARTColours
|
from Colours import Colours
|
||||||
from MiRCARTGeneralFrame import MiRCARTGeneralFrame, \
|
from GuiGeneralFrame import GuiGeneralFrame, \
|
||||||
TID_ACCELS, TID_COMMAND, TID_LIST, TID_MENU, TID_NOTHING, TID_SELECT, TID_TOOLBAR, \
|
TID_ACCELS, TID_COMMAND, TID_LIST, TID_MENU, TID_NOTHING, TID_SELECT, TID_TOOLBAR, \
|
||||||
NID_MENU_SEP, NID_TOOLBAR_HSEP, NID_TOOLBAR_VSEP
|
NID_MENU_SEP, NID_TOOLBAR_HSEP, NID_TOOLBAR_VSEP
|
||||||
|
|
||||||
import os, wx
|
from glob import glob
|
||||||
|
import os, random, wx
|
||||||
|
|
||||||
class MiRCARTFrame(MiRCARTGeneralFrame):
|
class GuiFrame(GuiGeneralFrame):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
panelCanvas = None; lastPanelState = {};
|
panelCanvas = None; lastPanelState = {};
|
||||||
|
|
||||||
# {{{ Commands
|
# {{{ Commands
|
||||||
# Id Type Id Labels Icon bitmap Accelerator [Initial state]
|
# Id Type Id Labels Icon bitmap Accelerator [Initial state]
|
||||||
CID_NEW = [0x100, TID_COMMAND, "New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None, MiRCARTCanvasInterface.canvasNew]
|
CID_NEW = [0x100, TID_COMMAND, "New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None, CanvasInterface.canvasNew]
|
||||||
CID_OPEN = [0x101, TID_COMMAND, "Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None, MiRCARTCanvasInterface.canvasOpen]
|
CID_OPEN = [0x101, TID_COMMAND, "Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None, CanvasInterface.canvasOpen]
|
||||||
CID_SAVE = [0x102, TID_COMMAND, "Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None, MiRCARTCanvasInterface.canvasSave]
|
CID_SAVE = [0x102, TID_COMMAND, "Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None, CanvasInterface.canvasSave]
|
||||||
CID_SAVEAS = [0x103, TID_COMMAND, "Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None, MiRCARTCanvasInterface.canvasSaveAs]
|
CID_SAVEAS = [0x103, TID_COMMAND, "Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None, CanvasInterface.canvasSaveAs]
|
||||||
CID_EXPORT_AS_PNG = [0x104, TID_COMMAND, "Export as PNG...", \
|
CID_EXPORT_AS_PNG = [0x104, TID_COMMAND, "Export as PNG...", \
|
||||||
"Export as PN&G...", None, None, None, MiRCARTCanvasInterface.canvasExportAsPng]
|
"Export as PN&G...", None, None, None, CanvasInterface.canvasExportAsPng]
|
||||||
CID_EXPORT_IMGUR = [0x105, TID_COMMAND, "Export to Imgur...", \
|
CID_EXPORT_IMGUR = [0x105, TID_COMMAND, "Export to Imgur...", \
|
||||||
"Export to I&mgur...", None, None, haveUrllib, MiRCARTCanvasInterface.canvasExportImgur]
|
"Export to I&mgur...", None, None, haveUrllib, CanvasInterface.canvasExportImgur]
|
||||||
CID_EXPORT_PASTEBIN = [0x106, TID_COMMAND, "Export to Pastebin...", \
|
CID_EXPORT_PASTEBIN = [0x106, TID_COMMAND, "Export to Pastebin...", \
|
||||||
"Export to Pasteb&in...", None, None, haveUrllib, MiRCARTCanvasInterface.canvasExportPastebin]
|
"Export to Pasteb&in...", None, None, haveUrllib, CanvasInterface.canvasExportPastebin]
|
||||||
CID_EXIT = [0x107, TID_COMMAND, "Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None, MiRCARTCanvasInterface.canvasExit]
|
CID_EXIT = [0x107, TID_COMMAND, "Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None, CanvasInterface.canvasExit]
|
||||||
CID_UNDO = [0x108, TID_COMMAND, "Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False, MiRCARTCanvasInterface.canvasUndo]
|
CID_UNDO = [0x108, TID_COMMAND, "Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False, CanvasInterface.canvasUndo]
|
||||||
CID_REDO = [0x109, TID_COMMAND, "Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False, MiRCARTCanvasInterface.canvasRedo]
|
CID_REDO = [0x109, TID_COMMAND, "Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False, CanvasInterface.canvasRedo]
|
||||||
CID_CUT = [0x10a, TID_COMMAND, "Cut", "Cu&t", ["", wx.ART_CUT], None, False, MiRCARTCanvasInterface.canvasCut]
|
CID_CUT = [0x10a, TID_COMMAND, "Cut", "Cu&t", ["", wx.ART_CUT], None, False, CanvasInterface.canvasCut]
|
||||||
CID_COPY = [0x10b, TID_COMMAND, "Copy", "&Copy", ["", wx.ART_COPY], None, False, MiRCARTCanvasInterface.canvasCopy]
|
CID_COPY = [0x10b, TID_COMMAND, "Copy", "&Copy", ["", wx.ART_COPY], None, False, CanvasInterface.canvasCopy]
|
||||||
CID_PASTE = [0x10c, TID_COMMAND, "Paste", "&Paste", ["", wx.ART_PASTE], None, False, MiRCARTCanvasInterface.canvasPaste]
|
CID_PASTE = [0x10c, TID_COMMAND, "Paste", "&Paste", ["", wx.ART_PASTE], None, False, CanvasInterface.canvasPaste]
|
||||||
CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, MiRCARTCanvasInterface.canvasDelete]
|
CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, CanvasInterface.canvasDelete]
|
||||||
CID_INCRW_CANVAS = [0x10e, TID_COMMAND, "Increase canvas width", \
|
CID_INCRW_CANVAS = [0x10e, TID_COMMAND, "Increase canvas width", \
|
||||||
"Increase canvas width", ["toolIncrCanvasW.png"], None, None, MiRCARTCanvasInterface.canvasIncrCanvasWidth]
|
"Increase canvas width", ["toolIncrCanvasW.png"], None, None, CanvasInterface.canvasIncrCanvasWidth]
|
||||||
CID_DECRW_CANVAS = [0x10f, TID_COMMAND, "Decrease canvas width", \
|
CID_DECRW_CANVAS = [0x10f, TID_COMMAND, "Decrease canvas width", \
|
||||||
"Decrease canvas width", ["toolDecrCanvasW.png"], None, None, MiRCARTCanvasInterface.canvasDecrCanvasWidth]
|
"Decrease canvas width", ["toolDecrCanvasW.png"], None, None, CanvasInterface.canvasDecrCanvasWidth]
|
||||||
CID_INCRH_CANVAS = [0x110, TID_COMMAND, "Increase canvas height", \
|
CID_INCRH_CANVAS = [0x110, TID_COMMAND, "Increase canvas height", \
|
||||||
"Increase canvas height", ["toolIncrCanvasH.png"], None, None, MiRCARTCanvasInterface.canvasIncrCanvasHeight]
|
"Increase canvas height", ["toolIncrCanvasH.png"], None, None, CanvasInterface.canvasIncrCanvasHeight]
|
||||||
CID_DECRH_CANVAS = [0x111, TID_COMMAND, "Decrease canvas height", \
|
CID_DECRH_CANVAS = [0x111, TID_COMMAND, "Decrease canvas height", \
|
||||||
"Decrease canvas height", ["toolDecrCanvasH.png"], None, None, MiRCARTCanvasInterface.canvasDecrCanvasHeight]
|
"Decrease canvas height", ["toolDecrCanvasH.png"], None, None, CanvasInterface.canvasDecrCanvasHeight]
|
||||||
CID_INCRHW_CANVAS = [0x112, TID_COMMAND, "Increase canvas size", \
|
CID_INCRHW_CANVAS = [0x112, TID_COMMAND, "Increase canvas size", \
|
||||||
"Increase canvas size", ["toolIncrCanvasHW.png"], None, None, MiRCARTCanvasInterface.canvasIncrCanvasHeightWidth]
|
"Increase canvas size", ["toolIncrCanvasHW.png"], None, None, CanvasInterface.canvasIncrCanvasHeightWidth]
|
||||||
CID_DECRHW_CANVAS = [0x113, TID_COMMAND, "Decrease canvas size", \
|
CID_DECRHW_CANVAS = [0x113, TID_COMMAND, "Decrease canvas size", \
|
||||||
"Decrease canvas size", ["toolDecrCanvasHW.png"], None, None, MiRCARTCanvasInterface.canvasDecrCanvasHeightWidth]
|
"Decrease canvas size", ["toolDecrCanvasHW.png"], None, None, CanvasInterface.canvasDecrCanvasHeightWidth]
|
||||||
CID_INCRW_BRUSH = [0x114, TID_COMMAND, "Increase brush width", \
|
CID_INCRW_BRUSH = [0x114, TID_COMMAND, "Increase brush width", \
|
||||||
"Increase brush width", ["toolIncrBrushW.png"], None, None, MiRCARTCanvasInterface.canvasIncrBrushWidth]
|
"Increase brush width", ["toolIncrBrushW.png"], None, None, CanvasInterface.canvasIncrBrushWidth]
|
||||||
CID_DECRW_BRUSH = [0x115, TID_COMMAND, "Decrease brush width", \
|
CID_DECRW_BRUSH = [0x115, TID_COMMAND, "Decrease brush width", \
|
||||||
"Decrease brush width", ["toolDecrBrushW.png"], None, None, MiRCARTCanvasInterface.canvasDecrBrushWidth]
|
"Decrease brush width", ["toolDecrBrushW.png"], None, None, CanvasInterface.canvasDecrBrushWidth]
|
||||||
CID_INCRH_BRUSH = [0x116, TID_COMMAND, "Increase brush height", \
|
CID_INCRH_BRUSH = [0x116, TID_COMMAND, "Increase brush height", \
|
||||||
"Increase brush height", ["toolIncrBrushH.png"], None, None, MiRCARTCanvasInterface.canvasIncrBrushHeight]
|
"Increase brush height", ["toolIncrBrushH.png"], None, None, CanvasInterface.canvasIncrBrushHeight]
|
||||||
CID_DECRH_BRUSH = [0x117, TID_COMMAND, "Decrease brush height", \
|
CID_DECRH_BRUSH = [0x117, TID_COMMAND, "Decrease brush height", \
|
||||||
"Decrease brush height", ["toolDecrBrushH.png"], None, None, MiRCARTCanvasInterface.canvasDecrBrushHeight]
|
"Decrease brush height", ["toolDecrBrushH.png"], None, None, CanvasInterface.canvasDecrBrushHeight]
|
||||||
CID_INCRHW_BRUSH = [0x118, TID_COMMAND, "Increase brush size", \
|
CID_INCRHW_BRUSH = [0x118, TID_COMMAND, "Increase brush size", \
|
||||||
"Increase brush size", ["toolIncrBrushHW.png"], None, None, MiRCARTCanvasInterface.canvasIncrBrushHeightWidth]
|
"Increase brush size", ["toolIncrBrushHW.png"], None, None, CanvasInterface.canvasIncrBrushHeightWidth]
|
||||||
CID_DECRHW_BRUSH = [0x119, TID_COMMAND, "Decrease brush size", \
|
CID_DECRHW_BRUSH = [0x119, TID_COMMAND, "Decrease brush size", \
|
||||||
"Decrease brush size", ["toolDecrBrushHW.png"], None, None, MiRCARTCanvasInterface.canvasDecrBrushHeightWidth]
|
"Decrease brush size", ["toolDecrBrushHW.png"], None, None, CanvasInterface.canvasDecrBrushHeightWidth]
|
||||||
CID_SOLID_BRUSH = [0x11a, TID_SELECT, "Solid brush", "Solid brush", None, None, True, MiRCARTCanvasInterface.canvasBrushSolid]
|
CID_SOLID_BRUSH = [0x11a, TID_SELECT, "Solid brush", "Solid brush", None, None, True, CanvasInterface.canvasBrushSolid]
|
||||||
|
|
||||||
CID_RECT = [0x150, TID_SELECT, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True, MiRCARTCanvasInterface.canvasToolRect]
|
CID_RECT = [0x150, TID_SELECT, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True, CanvasInterface.canvasToolRect]
|
||||||
CID_CIRCLE = [0x151, TID_SELECT, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False, MiRCARTCanvasInterface.canvasToolCircle]
|
CID_CIRCLE = [0x151, TID_SELECT, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False, CanvasInterface.canvasToolCircle]
|
||||||
CID_FILL = [0x152, TID_SELECT, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False, MiRCARTCanvasInterface.canvasToolFill]
|
CID_FILL = [0x152, TID_SELECT, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False, CanvasInterface.canvasToolFill]
|
||||||
CID_LINE = [0x153, TID_SELECT, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False, MiRCARTCanvasInterface.canvasToolLine]
|
CID_LINE = [0x153, TID_SELECT, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False, CanvasInterface.canvasToolLine]
|
||||||
CID_TEXT = [0x154, TID_SELECT, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False, MiRCARTCanvasInterface.canvasToolText]
|
CID_TEXT = [0x154, TID_SELECT, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False, CanvasInterface.canvasToolText]
|
||||||
CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, MiRCARTCanvasInterface.canvasToolSelectClone]
|
CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, CanvasInterface.canvasToolSelectClone]
|
||||||
CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, MiRCARTCanvasInterface.canvasToolSelectMove]
|
CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, CanvasInterface.canvasToolSelectMove]
|
||||||
|
|
||||||
CID_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, True, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, True, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, CanvasInterface.canvasColour]
|
||||||
CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, CanvasInterface.canvasColour]
|
||||||
|
|
||||||
|
CID_ABOUT = [0x1b0, TID_COMMAND, "About", "&About", None, None, True, CanvasInterface.canvasAbout]
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Menus
|
# {{{ Menus
|
||||||
MID_FILE = (0x300, TID_MENU, "File", "&File", ( \
|
MID_FILE = (0x300, TID_MENU, "File", "&File", ( \
|
||||||
@ -102,6 +105,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
CID_SOLID_BRUSH))
|
CID_SOLID_BRUSH))
|
||||||
MID_TOOLS = (0x302, TID_MENU, "Tools", "&Tools", ( \
|
MID_TOOLS = (0x302, TID_MENU, "Tools", "&Tools", ( \
|
||||||
CID_RECT, CID_CIRCLE, CID_FILL, CID_LINE, CID_TEXT, CID_CLONE_SELECT, CID_MOVE_SELECT))
|
CID_RECT, CID_CIRCLE, CID_FILL, CID_LINE, CID_TEXT, CID_CLONE_SELECT, CID_MOVE_SELECT))
|
||||||
|
MID_ABOUT = (0x303, TID_MENU, "Help", "&Help", ( \
|
||||||
|
CID_ABOUT,))
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Toolbars
|
# {{{ Toolbars
|
||||||
BID_TOOLBAR = (0x400, TID_TOOLBAR, ( \
|
BID_TOOLBAR = (0x400, TID_TOOLBAR, ( \
|
||||||
@ -126,7 +131,7 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ Lists
|
# {{{ Lists
|
||||||
LID_ACCELS = (0x600, TID_LIST, (AID_EDIT))
|
LID_ACCELS = (0x600, TID_LIST, (AID_EDIT))
|
||||||
LID_MENUS = (0x601, TID_LIST, (MID_FILE, MID_EDIT, MID_TOOLS))
|
LID_MENUS = (0x601, TID_LIST, (MID_FILE, MID_EDIT, MID_TOOLS, MID_ABOUT))
|
||||||
LID_TOOLBARS = (0x602, TID_LIST, (BID_TOOLBAR))
|
LID_TOOLBARS = (0x602, TID_LIST, (BID_TOOLBAR))
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@ -138,7 +143,7 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
self.CID_COLOUR10, self.CID_COLOUR11, self.CID_COLOUR12, self.CID_COLOUR13, self.CID_COLOUR14, \
|
self.CID_COLOUR10, self.CID_COLOUR11, self.CID_COLOUR12, self.CID_COLOUR13, self.CID_COLOUR14, \
|
||||||
self.CID_COLOUR15)
|
self.CID_COLOUR15)
|
||||||
for numColour in range(len(paletteDescr)):
|
for numColour in range(len(paletteDescr)):
|
||||||
toolBitmapColour = MiRCARTColours[numColour][0:4]
|
toolBitmapColour = Colours[numColour][0:4]
|
||||||
toolBitmap = wx.Bitmap((16,16))
|
toolBitmap = wx.Bitmap((16,16))
|
||||||
toolBitmapDc = wx.MemoryDC(); toolBitmapDc.SelectObject(toolBitmap);
|
toolBitmapDc = wx.MemoryDC(); toolBitmapDc.SelectObject(toolBitmap);
|
||||||
toolBitmapBrush = wx.Brush( \
|
toolBitmapBrush = wx.Brush( \
|
||||||
@ -177,15 +182,15 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
textItems.append("FG: {:02d}, BG: {:02d}".format( \
|
textItems.append("FG: {:02d}, BG: {:02d}".format( \
|
||||||
*self.lastPanelState["colours"]))
|
*self.lastPanelState["colours"]))
|
||||||
textItems.append("{} on {}".format( \
|
textItems.append("{} on {}".format( \
|
||||||
MiRCARTColours[self.lastPanelState["colours"][0]][4], \
|
Colours[self.lastPanelState["colours"][0]][4], \
|
||||||
MiRCARTColours[self.lastPanelState["colours"][1]][4]))
|
Colours[self.lastPanelState["colours"][1]][4]))
|
||||||
if "pathName" in self.lastPanelState:
|
if "pathName" in self.lastPanelState:
|
||||||
if self.lastPanelState["pathName"] != "":
|
if self.lastPanelState["pathName"] != "":
|
||||||
basePathName = os.path.basename(self.lastPanelState["pathName"])
|
basePathName = os.path.basename(self.lastPanelState["pathName"])
|
||||||
textItems.append("Current file: {}".format(basePathName))
|
textItems.append("Current file: {}".format(basePathName))
|
||||||
self.SetTitle("{} - MiRCART".format(basePathName))
|
self.SetTitle("{} - roar".format(basePathName))
|
||||||
else:
|
else:
|
||||||
self.SetTitle("MiRCART")
|
self.SetTitle("roar")
|
||||||
if "toolName" in self.lastPanelState:
|
if "toolName" in self.lastPanelState:
|
||||||
textItems.append("Current tool: {}".format( \
|
textItems.append("Current tool: {}".format( \
|
||||||
self.lastPanelState["toolName"]))
|
self.lastPanelState["toolName"]))
|
||||||
@ -219,8 +224,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
# __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): initialisation method
|
# __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): initialisation method
|
||||||
def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)):
|
def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)):
|
||||||
self._initPaletteToolBitmaps()
|
self._initPaletteToolBitmaps()
|
||||||
self.panelSkin = super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize)
|
self.panelSkin = super().__init__(parent, wx.ID_ANY, "", size=appSize)
|
||||||
self.panelCanvas = MiRCARTCanvas(self.panelSkin, parentFrame=self, \
|
self.panelCanvas = Canvas(self.panelSkin, parentFrame=self, \
|
||||||
defaultCanvasPos=defaultCanvasPos, \
|
defaultCanvasPos=defaultCanvasPos, \
|
||||||
defaultCanvasSize=defaultCanvasSize, \
|
defaultCanvasSize=defaultCanvasSize, \
|
||||||
defaultCellSize=defaultCellSize)
|
defaultCellSize=defaultCellSize)
|
||||||
@ -230,5 +235,10 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
self.panelSkin.SetSizer(self.sizerSkin)
|
self.panelSkin.SetSizer(self.sizerSkin)
|
||||||
self.panelSkin.SetAutoLayout(1)
|
self.panelSkin.SetAutoLayout(1)
|
||||||
self.sizerSkin.Fit(self.panelSkin)
|
self.sizerSkin.Fit(self.panelSkin)
|
||||||
|
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)
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTGeneralFrame.py -- XXX
|
# GuiGeneralFrame.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ NID_MENU_SEP = (0x200, TID_NOTHING)
|
|||||||
NID_TOOLBAR_HSEP = (0x201, TID_NOTHING)
|
NID_TOOLBAR_HSEP = (0x201, TID_NOTHING)
|
||||||
NID_TOOLBAR_VSEP = (0x202, TID_NOTHING)
|
NID_TOOLBAR_VSEP = (0x202, TID_NOTHING)
|
||||||
|
|
||||||
class MiRCARTGeneralFrame(wx.Frame):
|
class GuiGeneralFrame(wx.Frame):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
accelItemsById = itemsById = menuItemsById = toolBarItemsById = None
|
accelItemsById = itemsById = menuItemsById = toolBarItemsById = None
|
||||||
statusBar = toolBars = None
|
statusBar = toolBars = None
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTTool.py -- XXX
|
# Tool.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
class MiRCARTTool():
|
class Tool():
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
parentCanvas = None
|
parentCanvas = None
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolCircle.py -- XXX
|
# ToolCircle.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
|
|
||||||
class MiRCARTToolCircle(MiRCARTTool):
|
class ToolCircle(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Circle"
|
name = "Circle"
|
||||||
|
|
||||||
@ -20,15 +20,14 @@ class MiRCARTToolCircle(MiRCARTTool):
|
|||||||
brushColours[0] = brushColours[1]
|
brushColours[0] = brushColours[1]
|
||||||
else:
|
else:
|
||||||
brushColours[1] = brushColours[0]
|
brushColours[1] = brushColours[0]
|
||||||
_brushSize = brushSize[0]*2
|
_brushSize = brushSize[0] * 2
|
||||||
originPoint = (_brushSize/2, _brushSize/2)
|
originPoint, radius = (_brushSize / 2, _brushSize / 2), _brushSize
|
||||||
radius = _brushSize
|
|
||||||
for brushY in range(-radius, radius + 1):
|
for brushY in range(-radius, radius + 1):
|
||||||
for brushX in range(-radius, radius + 1):
|
for brushX in range(-radius, radius + 1):
|
||||||
if ((brushX**2)+(brushY**2) < (((radius**2)+radius)*0.8)):
|
if ((brushX ** 2) + (brushY ** 2) < (((radius ** 2) + radius) * 0.8)):
|
||||||
patch = [ \
|
patch = [ \
|
||||||
atPoint[0] + int(originPoint[0]+brushX), \
|
atPoint[0] + int(originPoint[0] + brushX), \
|
||||||
atPoint[1] + int(originPoint[1]+brushY), \
|
atPoint[1] + int(originPoint[1] + brushY), \
|
||||||
*brushColours, 0, " "]
|
*brushColours, 0, " "]
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
@ -1,19 +1,19 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolFill.py -- XXX
|
# ToolFill.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
|
|
||||||
class MiRCARTToolFill(MiRCARTTool):
|
class ToolFill(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Fill"
|
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): XXX
|
||||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||||
pointStack = [list(atPoint)]; pointsDone = [];
|
pointStack, pointsDone = [list(atPoint)], []
|
||||||
testColour = self.parentCanvas.canvasMap[atPoint[1]][atPoint[0]][0:2]
|
testColour = self.parentCanvas.canvasMap[atPoint[1]][atPoint[0]][0:2]
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
if isRightDown:
|
if isRightDown:
|
@ -1,45 +1,34 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolLine.py -- XXX
|
# ToolLine.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
|
|
||||||
class MiRCARTToolLine(MiRCARTTool):
|
class ToolLine(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Line"
|
name = "Line"
|
||||||
toolColours = toolOriginPoint = toolState = None
|
|
||||||
|
|
||||||
TS_NONE = 0
|
TS_NONE = 0
|
||||||
TS_ORIGIN = 1
|
TS_ORIGIN = 1
|
||||||
|
|
||||||
# {{{ _pointDelta(self, a, b): XXX
|
# {{{ _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint): XXX
|
||||||
def _pointDelta(self, a, b):
|
def _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint):
|
||||||
return [a2-a1 for a1, a2 in zip(a, b)]
|
originPoint, targetPoint = originPoint.copy(), targetPoint.copy()
|
||||||
# }}}
|
|
||||||
# {{{ _pointSwap(self, a, b): XXX
|
|
||||||
def _pointSwap(self, a, b):
|
|
||||||
return [b, a]
|
|
||||||
# }}}
|
|
||||||
# {{{ _getLine(self, brushColours, brushSize, eventDc, isCursor, originPoint, targetPoint, dispatchFn): XXX
|
|
||||||
def _getLine(self, brushColours, brushSize, eventDc, isCursor, originPoint, targetPoint, dispatchFn):
|
|
||||||
originPoint = originPoint.copy(); targetPoint = targetPoint.copy();
|
|
||||||
pointDelta = self._pointDelta(originPoint, targetPoint)
|
pointDelta = self._pointDelta(originPoint, targetPoint)
|
||||||
lineXSign = 1 if pointDelta[0] > 0 else -1;
|
lineXSign = 1 if pointDelta[0] > 0 else -1; lineYSign = 1 if pointDelta[1] > 0 else -1;
|
||||||
lineYSign = 1 if pointDelta[1] > 0 else -1;
|
|
||||||
pointDelta = [abs(a) for a in pointDelta]
|
pointDelta = [abs(a) for a in pointDelta]
|
||||||
if pointDelta[0] > pointDelta[1]:
|
if pointDelta[0] > pointDelta[1]:
|
||||||
lineXX, lineXY, lineYX, lineYY = lineXSign, 0, 0, lineYSign
|
lineXX, lineXY, lineYX, lineYY = lineXSign, 0, 0, lineYSign
|
||||||
else:
|
else:
|
||||||
pointDelta = [pointDelta[1], pointDelta[0]]
|
|
||||||
lineXX, lineXY, lineYX, lineYY = 0, lineYSign, lineXSign, 0
|
lineXX, lineXY, lineYX, lineYY = 0, lineYSign, lineXSign, 0
|
||||||
|
pointDelta = [pointDelta[1], pointDelta[0]]
|
||||||
lineD = 2 * pointDelta[1] - pointDelta[0]; lineY = 0;
|
lineD = 2 * pointDelta[1] - pointDelta[0]; lineY = 0;
|
||||||
for lineX in range(pointDelta[0] + 1):
|
for lineX in range(pointDelta[0] + 1):
|
||||||
for brushStep in range(brushSize[0]):
|
for brushStep in range(brushSize[0]):
|
||||||
patch = [ \
|
patch = [ \
|
||||||
originPoint[0] + lineX*lineXX + lineY*lineYX + brushStep, \
|
originPoint[0] + lineX * lineXX + lineY * lineYX + brushStep, \
|
||||||
originPoint[1] + lineX*lineXY + lineY*lineYY, \
|
originPoint[1] + lineX * lineXY + lineY * lineYY, \
|
||||||
*brushColours, 0, " "]
|
*brushColours, 0, " "]
|
||||||
if isCursor:
|
if isCursor:
|
||||||
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
||||||
@ -49,6 +38,14 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
lineD -= pointDelta[0]; lineY += 1;
|
lineD -= pointDelta[0]; lineY += 1;
|
||||||
lineD += pointDelta[1]
|
lineD += pointDelta[1]
|
||||||
# }}}
|
# }}}
|
||||||
|
# {{{ _pointDelta(self, a, b): XXX
|
||||||
|
def _pointDelta(self, a, b):
|
||||||
|
return [a2 - a1 for a1, a2 in zip(a, b)]
|
||||||
|
# }}}
|
||||||
|
# {{{ _pointSwap(self, a, b): XXX
|
||||||
|
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): XXX
|
||||||
@ -62,26 +59,17 @@ class MiRCARTToolLine(MiRCARTTool):
|
|||||||
brushColours[1] = brushColours[0]
|
brushColours[1] = brushColours[0]
|
||||||
if self.toolState == self.TS_NONE:
|
if self.toolState == self.TS_NONE:
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
self.toolColours = brushColours
|
self.toolColours, self.toolOriginPoint, self.toolState = brushColours, list(atPoint), self.TS_ORIGIN
|
||||||
self.toolOriginPoint = list(atPoint)
|
|
||||||
self.toolState = self.TS_ORIGIN
|
|
||||||
dispatchFn(eventDc, True, [*atPoint, *brushColours, 0, " "])
|
dispatchFn(eventDc, True, [*atPoint, *brushColours, 0, " "])
|
||||||
elif self.toolState == self.TS_ORIGIN:
|
elif self.toolState == self.TS_ORIGIN:
|
||||||
targetPoint = list(atPoint)
|
originPoint, targetPoint = self.toolOriginPoint, list(atPoint)
|
||||||
originPoint = self.toolOriginPoint
|
self._getLine(self.toolColours, brushSize, dispatchFn, eventDc, isLeftDown or isRightDown, originPoint, targetPoint)
|
||||||
self._getLine(self.toolColours, brushSize, \
|
|
||||||
eventDc, isLeftDown or isRightDown, \
|
|
||||||
originPoint, targetPoint, dispatchFn)
|
|
||||||
if isLeftDown or isRightDown:
|
if isLeftDown or isRightDown:
|
||||||
self.toolColours = None
|
self.toolColours, self.toolOriginPoint, self.toolState = None, None, self.TS_NONE
|
||||||
self.toolOriginPoint = None
|
|
||||||
self.toolState = self.TS_NONE
|
|
||||||
|
|
||||||
# __init__(self, *args): initialisation method
|
# __init__(self, *args): initialisation method
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
super().__init__(*args)
|
super().__init__(*args)
|
||||||
self.toolColours = None
|
self.toolColours, self.toolOriginPoint, self.toolState = None, None, self.TS_NONE
|
||||||
self.toolOriginPoint = None
|
|
||||||
self.toolState = self.TS_NONE
|
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolRect.py -- XXX
|
# ToolRect.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
|
|
||||||
class MiRCARTToolRect(MiRCARTTool):
|
class ToolRect(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Rectangle"
|
name = "Rectangle"
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolSelect.py -- XXX
|
# ToolSelect.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
|
|
||||||
class MiRCARTToolSelect(MiRCARTTool):
|
class ToolSelect(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
TS_NONE = 0
|
TS_NONE = 0
|
||||||
TS_ORIGIN = 1
|
TS_ORIGIN = 1
|
||||||
@ -35,11 +35,11 @@ class MiRCARTToolSelect(MiRCARTTool):
|
|||||||
if rectFrame[0][1] > rectFrame[1][1]:
|
if rectFrame[0][1] > rectFrame[1][1]:
|
||||||
rectFrame[0][1], rectFrame[1][1] = rectFrame[1][1], rectFrame[0][1]
|
rectFrame[0][1], rectFrame[1][1] = rectFrame[1][1], rectFrame[0][1]
|
||||||
curColours = [0, 0]
|
curColours = [0, 0]
|
||||||
for rectX in range(rectFrame[0][0], rectFrame[1][0]+1):
|
for rectX in range(rectFrame[0][0], rectFrame[1][0] + 1):
|
||||||
curColours = [1, 1] if curColours == [0, 0] else [0, 0]
|
curColours = [1, 1] if curColours == [0, 0] else [0, 0]
|
||||||
dispatchFn(eventDc, True, [rectX, rectFrame[0][1], *curColours, 0, " "])
|
dispatchFn(eventDc, True, [rectX, rectFrame[0][1], *curColours, 0, " "])
|
||||||
dispatchFn(eventDc, True, [rectX, rectFrame[1][1], *curColours, 0, " "])
|
dispatchFn(eventDc, True, [rectX, rectFrame[1][1], *curColours, 0, " "])
|
||||||
for rectY in range(rectFrame[0][1], rectFrame[1][1]+1):
|
for rectY in range(rectFrame[0][1], rectFrame[1][1] + 1):
|
||||||
curColours = [1, 1] if curColours == [0, 0] else [0, 0]
|
curColours = [1, 1] if curColours == [0, 0] else [0, 0]
|
||||||
dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "])
|
dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "])
|
||||||
dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "])
|
dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "])
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolSelectClone.py -- XXX
|
# ToolSelectClone.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTToolSelect import MiRCARTToolSelect
|
from ToolSelect import ToolSelect
|
||||||
|
|
||||||
class MiRCARTToolSelectClone(MiRCARTToolSelect):
|
class ToolSelectClone(ToolSelect):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Clone selection"
|
name = "Clone selection"
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolSelectMove.py -- XXX
|
# ToolSelectMove.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTToolSelect import MiRCARTToolSelect
|
from ToolSelect import ToolSelect
|
||||||
|
|
||||||
class MiRCARTToolSelectMove(MiRCARTToolSelect):
|
class ToolSelectMove(ToolSelect):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Move selection"
|
name = "Move selection"
|
||||||
|
|
@ -1,16 +1,15 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCARTToolText.py -- XXX
|
# ToolText.py -- XXX
|
||||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from MiRCARTTool import MiRCARTTool
|
from Tool import Tool
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
class MiRCARTToolText(MiRCARTTool):
|
class ToolText(Tool):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
name = "Text"
|
name = "Text"
|
||||||
textColours = textPos = None
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc): XXX
|
# onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc): XXX
|
||||||
@ -28,8 +27,7 @@ class MiRCARTToolText(MiRCARTTool):
|
|||||||
if self.textPos[0] < (self.parentCanvas.canvasSize[0] - 1):
|
if self.textPos[0] < (self.parentCanvas.canvasSize[0] - 1):
|
||||||
self.textPos[0] += 1
|
self.textPos[0] += 1
|
||||||
elif self.textPos[1] < (self.parentCanvas.canvasSize[1] - 1):
|
elif self.textPos[1] < (self.parentCanvas.canvasSize[1] - 1):
|
||||||
self.textPos[0] = 0
|
self.textPos[0] = 0; self.textPos[1] += 1;
|
||||||
self.textPos[1] += 1
|
|
||||||
else:
|
else:
|
||||||
self.textPos = [0, 0]
|
self.textPos = [0, 0]
|
||||||
return False
|
return False
|
||||||
@ -38,15 +36,18 @@ class MiRCARTToolText(MiRCARTTool):
|
|||||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||||
def 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:
|
if isLeftDown:
|
||||||
self.textColours = brushColours.copy()
|
self.textColours, self.textPos = brushColours.copy(), list(atPoint)
|
||||||
self.textPos = list(atPoint)
|
|
||||||
elif isRightDown:
|
elif isRightDown:
|
||||||
self.textColours = [brushColours[1], brushColours[0]]
|
self.textColours, self.textPos = [brushColours[1], brushColours[0]], list(atPoint)
|
||||||
self.textPos = list(atPoint)
|
|
||||||
else:
|
else:
|
||||||
if self.textColours == None:
|
if self.textColours == None:
|
||||||
self.textColours = brushColours.copy()
|
self.textColours = brushColours.copy()
|
||||||
self.textPos = list(atPoint)
|
self.textPos = list(atPoint)
|
||||||
dispatchFn(eventDc, True, [*self.textPos, *self.textColours, 0, "_"])
|
dispatchFn(eventDc, True, [*self.textPos, *self.textColours, 0, "_"])
|
||||||
|
|
||||||
|
# __init__(self, *args): initialisation method
|
||||||
|
def __init__(self, *args):
|
||||||
|
super().__init__(*args)
|
||||||
|
self.textColours = self.textPos = None
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# MiRCART.py -- mIRC art editor for Windows & Linux
|
# roar.py -- mIRC art editor for Windows & Linux
|
||||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -8,14 +8,14 @@ import os, sys
|
|||||||
[sys.path.append(os.path.join(os.getcwd(), path)) for path in \
|
[sys.path.append(os.path.join(os.getcwd(), path)) for path in \
|
||||||
["libcanvas", "libgui", "librtl", "libtools"]]
|
["libcanvas", "libgui", "librtl", "libtools"]]
|
||||||
|
|
||||||
from MiRCARTFrame import MiRCARTFrame
|
from GuiFrame import GuiFrame
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
#
|
#
|
||||||
# Entry point
|
# Entry point
|
||||||
def main(*argv):
|
def main(*argv):
|
||||||
wxApp = wx.App(False)
|
wxApp = wx.App(False)
|
||||||
appFrame = MiRCARTFrame(None)
|
appFrame = GuiFrame(None)
|
||||||
if len(argv) > 1 \
|
if len(argv) > 1 \
|
||||||
and len(argv[1]) > 0:
|
and len(argv[1]) > 0:
|
||||||
appFrame.panelCanvas.canvasInterface.canvasPathName = argv[1]
|
appFrame.panelCanvas.canvasInterface.canvasPathName = argv[1]
|