ROAR!
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
*.sw[op]
|
||||
__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:
|
||||
`pip install requests urllib3 wxPython`
|
||||
* Prerequisites on Linux: python3 && python-wx{gtk2.8,tools} on Debian-family Linux distributions
|
||||
* Screenshot:
|
||||
![Screenshot](https://github.com/lalbornoz/MiRCARTools/raw/master/assets/images/MiRCART.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>`]
|
||||
![Screenshot](https://github.com/lalbornoz/roar/raw/master/assets/images/roar.png "Screenshot")
|
||||
|
||||
References:
|
||||
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
|
||||
2) Incremental auto{load,save} & {backup,restore}
|
||||
3) Open and toggle a reference image in the background
|
||||
4) Client-Server or Peer-to-Peer realtime collaboration
|
||||
5) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.)
|
||||
6) Hotkey & graphical interfaces to {composed,parametrised} tools
|
||||
7) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits
|
||||
8) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc.
|
||||
9) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers
|
||||
10) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...)
|
||||
11) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools:
|
||||
1) Scrollbar
|
||||
2) Allow {un,re}doing resizing
|
||||
3) {Copy to,Paste from} clipboard
|
||||
4) Incremental auto{load,save} & {backup,restore}
|
||||
5) Open and toggle a reference image in the background
|
||||
6) Client-Server or Peer-to-Peer realtime collaboration
|
||||
7) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.)
|
||||
8) Hotkey & graphical interfaces to {composed,parametrised} tools
|
||||
9) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits
|
||||
10) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc.
|
||||
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)
|
||||
b) regions (crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate)
|
||||
c) text (edit, Unicode sets)
|
||||
|
@ -5,19 +5,19 @@
|
||||
# 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
|
||||
import base64
|
||||
import os, socket, sys, time
|
||||
import json
|
||||
import IrcClient
|
||||
import requests, urllib.request
|
||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
||||
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
|
||||
from CanvasImportStore import CanvasImportStore
|
||||
from ImgurApiKey import ImgurApiKey
|
||||
from IrcClient import IrcClient
|
||||
from MiRCARTToPngFile import MiRCARTToPngFile
|
||||
|
||||
class IrcMiRCARTBot(IrcClient.IrcClient):
|
||||
class IrcMiRCARTBot(IrcClient):
|
||||
"""IRC<->MiRC2png bot"""
|
||||
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
|
||||
imgurApiKey = ImgurApiKey.imgurApiKey
|
||||
|
||||
# {{{ ContentTooLargeException(Exception): Raised by _urlretrieveReportHook() given download size > 1 MB
|
||||
class ContentTooLargeException(Exception):
|
||||
@ -125,7 +125,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
||||
self.queue("PRIVMSG", message[2], "4/!\\ Unknown URL type specified!")
|
||||
return
|
||||
|
||||
canvasStore = MiRCARTCanvasImportStore(inFile=asciiTmpFilePath)
|
||||
canvasStore = CanvasImportStore(inFile=asciiTmpFilePath)
|
||||
numRowCols = 0
|
||||
for numRow in range(len(canvasStore.outMap)):
|
||||
numRowCols = max(numRowCols, len(canvasStore.outMap[numRow]))
|
||||
@ -137,7 +137,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
||||
canvasStore.outMap[numRow].append([1, 1, 0, " "])
|
||||
canvasStore.outMap.insert(0, [[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
||||
canvasStore.outMap.append([[1, 1, 0, " "]] * len(canvasStore.outMap[0]))
|
||||
MiRCARTToPngFile(canvasStore.outMap, "DejaVuSansMono.ttf", 11).export(imgTmpFilePath)
|
||||
MiRCARTToPngFile(canvasStore.outMap, os.path.join("..", "fonts", "DejaVuSansMono.ttf"), 11).export(imgTmpFilePath)
|
||||
imgurResponse = self._uploadToImgur(imgTmpFilePath, "MiRCART image", "MiRCART image", self.imgurApiKey)
|
||||
if imgurResponse[0] == None:
|
||||
self._log("Upload failed with exception `{}'".format(imgurResponse[1]))
|
||||
|
@ -5,22 +5,23 @@
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
|
||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
||||
import sys
|
||||
import os, sys
|
||||
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||
|
||||
from CanvasImportStore import CanvasImportStore
|
||||
|
||||
def canonicalise(inPathName):
|
||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
||||
canvasStore = CanvasImportStore(inPathName)
|
||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||
with open(inPathName, "w+") as outFile:
|
||||
for inCurRow in range(len(inMap)):
|
||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
||||
lastColours = None
|
||||
lastAttribs, lastColours = CanvasImportStore._CellState.CS_NONE, None
|
||||
for inCurCol in range(len(inMap[inCurRow])):
|
||||
inCurCell = inMap[inCurRow][inCurCol]
|
||||
if lastAttribs != inCurCell[2]:
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||
print("\u0002", end="", file=outFile)
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||
print("\u001f", end="", file=outFile)
|
||||
lastAttribs = inCurCell[2]
|
||||
if lastColours == None or lastColours != inCurCell[:2]:
|
||||
|
@ -5,22 +5,24 @@
|
||||
# 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
|
||||
|
||||
def reduce(inPathName):
|
||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
||||
canvasStore = CanvasImportStore(inPathName)
|
||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||
with open(inPathName, "w+") as outFile:
|
||||
for inCurRow in range(len(inMap)):
|
||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
||||
lastColours = None
|
||||
lastAttribs, lastColours = CanvasImportStore._CellState.CS_NONE, None
|
||||
for inCurCol in range(len(inMap[inCurRow])):
|
||||
inCurCell = inMap[inCurRow][inCurCol]
|
||||
if lastAttribs != inCurCell[2]:
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||
print("\u0002", end="", file=outFile)
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_UNDERLINE:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_UNDERLINE:
|
||||
print("\u001f", end="", file=outFile)
|
||||
lastAttribs = inCurCell[2]
|
||||
if lastColours == None \
|
||||
|
@ -5,8 +5,10 @@
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
|
||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
||||
import sys
|
||||
import os, sys
|
||||
[sys.path.append(os.path.join(os.getcwd(), "..", "..", path)) for path in ["libcanvas", "librtl"]]
|
||||
|
||||
from CanvasImportStore import CanvasImportStore
|
||||
|
||||
MiRCARTToAnsiColours = [
|
||||
97, # Bright White
|
||||
@ -28,18 +30,18 @@ MiRCARTToAnsiColours = [
|
||||
];
|
||||
|
||||
def ToAnsi(inPathName):
|
||||
canvasStore = MiRCARTCanvasImportStore(inPathName)
|
||||
canvasStore = CanvasImportStore(inPathName)
|
||||
inMap = canvasStore.outMap.copy(); del canvasStore;
|
||||
with open(inPathName, "w+") as outFile:
|
||||
for inCurRow in range(len(inMap)):
|
||||
lastAttribs = MiRCARTCanvasImportStore._CellState.CS_NONE
|
||||
lastAttribs = CanvasImportStore._CellState.CS_NONE
|
||||
lastColours = None
|
||||
for inCurCol in range(len(inMap[inCurRow])):
|
||||
inCurCell = inMap[inCurRow][inCurCol]
|
||||
if lastAttribs != inCurCell[2]:
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||
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)
|
||||
lastAttribs = inCurCell[2]
|
||||
if lastColours == None or lastColours != inCurCell[:2]:
|
||||
|
@ -5,9 +5,12 @@
|
||||
# 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
|
||||
import sys
|
||||
|
||||
class MiRCARTToPngFile:
|
||||
"""XXX"""
|
||||
@ -73,7 +76,7 @@ class MiRCARTToPngFile:
|
||||
for inCurCol in range(len(self.inCanvasMap[inCurRow])):
|
||||
inCurCell = self.inCanvasMap[inCurRow][inCurCol]
|
||||
outColours = [0, 0]
|
||||
if inCurCell[2] & MiRCARTCanvasImportStore.MiRCARTCanvasImportStore._CellState.CS_BOLD:
|
||||
if inCurCell[2] & CanvasImportStore._CellState.CS_BOLD:
|
||||
if inCurCell[3] != " ":
|
||||
if inCurCell[3] == "█":
|
||||
outColours[1] = self._ColourMapNormal[inCurCell[0]]
|
||||
@ -100,7 +103,7 @@ class MiRCARTToPngFile:
|
||||
# XXX implement italic
|
||||
outImgDraw.text(outCurPos, \
|
||||
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]]
|
||||
self._drawUnderLine(outCurPos, \
|
||||
self.outImgFontSize, \
|
||||
@ -112,29 +115,31 @@ class MiRCARTToPngFile:
|
||||
# }}}
|
||||
|
||||
#
|
||||
# __init__(self, inCanvasMap, fontFilePath="DejaVuSansMono.ttf", fontSize=11): initialisation method
|
||||
def __init__(self, inCanvasMap, fontFilePath="DejaVuSansMono.ttf", fontSize=11):
|
||||
# __init__(self, inCanvasMap, fontFilePath, fontSize): initialisation method
|
||||
def __init__(self, inCanvasMap, fontFilePath, fontSize):
|
||||
self.inCanvasMap = inCanvasMap
|
||||
self.outFontFilePath = fontFilePath; self.outFontSize = int(fontSize);
|
||||
self.outImgFont = ImageFont.truetype( \
|
||||
self.outFontFilePath, self.outFontSize)
|
||||
self.outFontFilePath, self.outFontSize = fontFilePath, fontSize
|
||||
self.outImgFont = ImageFont.truetype(self.outFontFilePath, self.outFontSize)
|
||||
self.outImgFontSize = [*self.outImgFont.getsize(" ")]
|
||||
self.outImgFontSize[1] += 3
|
||||
|
||||
#
|
||||
# Entry point
|
||||
def main(*argv):
|
||||
canvasStore = MiRCARTCanvasImportStore.MiRCARTCanvasImportStore(inFile=argv[1])
|
||||
MiRCARTToPngFile(canvasStore.outMap, *argv[3:]).export(argv[2])
|
||||
if __name__ == "__main__":
|
||||
if ((len(sys.argv) - 1) < 2)\
|
||||
or ((len(sys.argv) - 1) > 4):
|
||||
print("usage: {} " \
|
||||
"<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)
|
||||
argv0 = argv[0]; optlist, argv = getopt(argv[1:], "f:hs:"); optdict = dict(optlist);
|
||||
if len(argv) < 1:
|
||||
print("""usage: {} [-f fname] [-h] [-s size] fname...
|
||||
-h.........: show this screen
|
||||
-f fname...: font file pathname (defaults to: ../fonts/DejaVuSansMono.ttf)
|
||||
-s size....: font size (defaults to: 11)""".format(argv0), file=sys.stderr)
|
||||
else:
|
||||
main(*sys.argv)
|
||||
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)
|
||||
|
||||
# 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
|
||||
#
|
||||
|
||||
PACKAGE_NAME="MiRCART-www";
|
||||
PACKAGE_NAME="roar-python";
|
||||
RELEASE_DEPS="cpio find rm sed zip";
|
||||
RELEASES_DNAME="releases";
|
||||
|
||||
@ -13,7 +13,7 @@ msgf() {
|
||||
deploy() {
|
||||
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_fname="${_release_dname}.zip";
|
||||
|
||||
@ -21,9 +21,12 @@ deploy() {
|
||||
-mindepth 1 \
|
||||
-not -path "./${RELEASES_DNAME}/*" \
|
||||
-not -path "./${RELEASES_DNAME}" \
|
||||
-not -path "./.git/*" \
|
||||
-not -path "./.git" \
|
||||
-not -name '*.sw*' \
|
||||
-not -name "${0##*/}" |\
|
||||
cpio --quiet -dLmp "${_release_dname}";
|
||||
sed -i"" "s/__ROAR_RELEASE_GIT_SHORT_REV__/${_release_version}/" "${_release_dname}/libcanvas/CanvasInterface.py";
|
||||
cd "${RELEASES_DNAME}";
|
||||
if [ "${_vflag:-0}" -eq 0 ]; then
|
||||
zip -9 -r "${_release_fname##${RELEASES_DNAME}/}" "${_release_dname##${RELEASES_DNAME}/}" >/dev/null;
|
@ -1,18 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvas.py -- XXX
|
||||
# Canvas.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from MiRCARTCanvasBackend import MiRCARTCanvasBackend
|
||||
from MiRCARTCanvasJournal import MiRCARTCanvasJournal
|
||||
from MiRCARTCanvasExportStore import MiRCARTCanvasExportStore, haveMiRCARTToPngFile, haveUrllib
|
||||
from MiRCARTCanvasImportStore import MiRCARTCanvasImportStore
|
||||
from MiRCARTCanvasInterface import MiRCARTCanvasInterface
|
||||
from MiRCARTImgurApiKey import MiRCARTImgurApiKey
|
||||
from CanvasBackend import CanvasBackend
|
||||
from CanvasJournal import CanvasJournal
|
||||
from CanvasExportStore import CanvasExportStore, haveToPngFile, haveUrllib
|
||||
from CanvasImportStore import CanvasImportStore
|
||||
from CanvasInterface import CanvasInterface
|
||||
from ImgurApiKey import ImgurApiKey
|
||||
import wx
|
||||
|
||||
class MiRCARTCanvas(wx.Panel):
|
||||
class Canvas(wx.Panel):
|
||||
"""XXX"""
|
||||
parentFrame = None
|
||||
defaultCanvasPos = defaultCanvasSize = defaultCellSize = None
|
||||
@ -21,7 +21,7 @@ class MiRCARTCanvas(wx.Panel):
|
||||
canvasBackend = canvasJournal = None
|
||||
canvasExportStore = canvasImportStore = None
|
||||
canvasInterface = None
|
||||
imgurApiKey = MiRCARTImgurApiKey.imgurApiKey
|
||||
imgurApiKey = ImgurApiKey.imgurApiKey
|
||||
|
||||
# {{{ _commitPatch(self, patch): XXX
|
||||
def _commitPatch(self, patch):
|
||||
@ -124,9 +124,9 @@ class MiRCARTCanvas(wx.Panel):
|
||||
self.canvasMap = []; oldCanvasSize = [0, 0];
|
||||
else:
|
||||
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.SetSize(wx.DefaultCoord, wx.DefaultCoord, *newWinSize)
|
||||
curWindow = self
|
||||
@ -175,7 +175,7 @@ class MiRCARTCanvas(wx.Panel):
|
||||
# __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method
|
||||
def __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize):
|
||||
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.canvasMap = None
|
||||
@ -184,11 +184,11 @@ class MiRCARTCanvas(wx.Panel):
|
||||
self.brushColours = [4, 1]; self.brushPos = [0, 0]; self.brushSize = [1, 1];
|
||||
self.parentFrame.onCanvasUpdate( \
|
||||
brushSize=self.brushSize, colours=self.brushColours)
|
||||
self.canvasBackend = MiRCARTCanvasBackend(defaultCanvasSize, defaultCellSize)
|
||||
self.canvasJournal = MiRCARTCanvasJournal()
|
||||
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)
|
||||
self.canvasImportStore = MiRCARTCanvasImportStore(parentCanvas=self)
|
||||
self.canvasInterface = MiRCARTCanvasInterface(self, parentFrame)
|
||||
self.canvasBackend = CanvasBackend(defaultCanvasSize, defaultCellSize)
|
||||
self.canvasJournal = CanvasJournal()
|
||||
self.canvasExportStore = CanvasExportStore(parentCanvas=self)
|
||||
self.canvasImportStore = CanvasImportStore(parentCanvas=self)
|
||||
self.canvasInterface = CanvasInterface(self, parentFrame)
|
||||
|
||||
# Bind event handlers
|
||||
self.Bind(wx.EVT_CLOSE, self.onPanelClose)
|
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvasBackend.py -- XXX
|
||||
# CanvasBackend.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from MiRCARTColours import MiRCARTColours
|
||||
from Colours import Colours
|
||||
import wx
|
||||
|
||||
class MiRCARTCanvasBackend():
|
||||
class CanvasBackend():
|
||||
"""XXX"""
|
||||
_font = _brushes = _pens = None
|
||||
_lastBrush = _lastPen = None
|
||||
@ -30,8 +30,8 @@ class MiRCARTCanvasBackend():
|
||||
pen = self._pens[patch[3]]
|
||||
fontBitmap = wx.Bitmap(*self.cellSize)
|
||||
fontDc = wx.MemoryDC(); fontDc.SelectObject(fontBitmap);
|
||||
fontDc.SetTextForeground(wx.Colour(MiRCARTColours[patch[2]][0:4]))
|
||||
fontDc.SetTextBackground(wx.Colour(MiRCARTColours[patch[3]][0:4]))
|
||||
fontDc.SetTextForeground(wx.Colour(Colours[patch[2]][0:4]))
|
||||
fontDc.SetTextBackground(wx.Colour(Colours[patch[3]][0:4]))
|
||||
fontDc.SetBrush(brushBg); fontDc.SetBackground(brushBg); fontDc.SetPen(pen);
|
||||
fontDc.SetFont(self._font)
|
||||
fontDc.DrawRectangle(0, 0, *self.cellSize)
|
||||
@ -50,13 +50,13 @@ class MiRCARTCanvasBackend():
|
||||
# }}}
|
||||
# {{{ _initBrushesAndPens(self): XXX
|
||||
def _initBrushesAndPens(self):
|
||||
self._brushes = [None for x in range(len(MiRCARTColours))]
|
||||
self._pens = [None for x in range(len(MiRCARTColours))]
|
||||
for mircColour in range(len(MiRCARTColours)):
|
||||
self._brushes = [None for x in range(len(Colours))]
|
||||
self._pens = [None for x in range(len(Colours))]
|
||||
for mircColour in range(len(Colours)):
|
||||
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( \
|
||||
wx.Colour(MiRCARTColours[mircColour][0:4]), 1)
|
||||
wx.Colour(Colours[mircColour][0:4]), 1)
|
||||
self._lastBrushBg = self._lastBrushFg = self._lastPen = None;
|
||||
# }}}
|
||||
# {{{ _setBrushDc(self, brushBg, brushFg, dc, pen): XXX
|
||||
@ -73,7 +73,7 @@ class MiRCARTCanvasBackend():
|
||||
# }}}
|
||||
# {{{ _xlatePoint(self, patch): XXX
|
||||
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
|
||||
@ -113,7 +113,7 @@ class MiRCARTCanvasBackend():
|
||||
# }}}
|
||||
# {{{ 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:
|
||||
self.canvasBitmap = wx.Bitmap(winSize)
|
||||
else:
|
@ -1,16 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvasExportStore.py -- XXX
|
||||
# CanvasExportStore.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
import io, os, tempfile
|
||||
|
||||
try:
|
||||
from MiRCARTToPngFile import MiRCARTToPngFile
|
||||
haveMiRCARTToPngFile = True
|
||||
from ToPngFile import ToPngFile
|
||||
haveToPngFile = True
|
||||
except ImportError:
|
||||
haveMiRCARTToPngFile = False
|
||||
haveToPngFile = False
|
||||
|
||||
try:
|
||||
import base64, json, requests, urllib.request
|
||||
@ -18,7 +18,7 @@ try:
|
||||
except ImportError:
|
||||
haveUrllib = False
|
||||
|
||||
class MiRCARTCanvasExportStore():
|
||||
class CanvasExportStore():
|
||||
"""XXX"""
|
||||
parentCanvas = None
|
||||
|
||||
@ -81,8 +81,8 @@ class MiRCARTCanvasExportStore():
|
||||
# }}}
|
||||
# {{{ exportPngFile(self, canvasMap, outPathName): XXX
|
||||
def exportPngFile(self, canvasMap, outPathName):
|
||||
if haveMiRCARTToPngFile:
|
||||
MiRCARTToPngFile(canvasMap).export(outPathName)
|
||||
if haveToPngFile:
|
||||
ToPngFile(canvasMap).export(outPathName)
|
||||
return True
|
||||
else:
|
||||
return False
|
@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvasImportStore.py -- XXX
|
||||
# CanvasImportStore.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
# This project is licensed under the terms of the MIT licence.
|
||||
#
|
||||
|
||||
class MiRCARTCanvasImportStore():
|
||||
class CanvasImportStore():
|
||||
"""XXX"""
|
||||
inFile = inSize = outMap = None
|
||||
parentCanvas = None
|
@ -1,20 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvasInterface.py -- XXX
|
||||
# CanvasInterface.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from MiRCARTToolCircle import MiRCARTToolCircle
|
||||
from MiRCARTToolFill import MiRCARTToolFill
|
||||
from MiRCARTToolLine import MiRCARTToolLine
|
||||
from MiRCARTToolSelectClone import MiRCARTToolSelectClone
|
||||
from MiRCARTToolSelectMove import MiRCARTToolSelectMove
|
||||
from MiRCARTToolRect import MiRCARTToolRect
|
||||
from MiRCARTToolText import MiRCARTToolText
|
||||
from ToolCircle import ToolCircle
|
||||
from ToolFill import ToolFill
|
||||
from ToolLine import ToolLine
|
||||
from ToolSelectClone import ToolSelectClone
|
||||
from ToolSelectMove import ToolSelectMove
|
||||
from ToolRect import ToolRect
|
||||
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"""
|
||||
imgurApiKey = None
|
||||
parentCanvas = parentFrame = canvasPathName = canvasTool = None
|
||||
@ -23,12 +65,16 @@ class MiRCARTCanvasInterface():
|
||||
def _dialogSaveChanges(self):
|
||||
with wx.MessageDialog(self.parentCanvas, \
|
||||
"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:
|
||||
dialogChoice = dialog.ShowModal()
|
||||
return dialogChoice
|
||||
# }}}
|
||||
|
||||
# {{{ canvasAbout(self, event): XXX
|
||||
def canvasAbout(self, event):
|
||||
CanvasInterfaceAbout(self.parentFrame)
|
||||
# }}}
|
||||
# {{{ canvasBrushSolid(self, event): XXX
|
||||
def canvasBrushSolid(self, event):
|
||||
pass
|
||||
@ -173,7 +219,7 @@ class MiRCARTCanvasInterface():
|
||||
def canvasIncrCanvasHeight(self, event):
|
||||
self.parentCanvas.resize([ \
|
||||
self.parentCanvas.canvasSize[0], \
|
||||
self.parentCanvas.canvasSize[1]+1])
|
||||
self.parentCanvas.canvasSize[1] + 1])
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasHeightWidth(self, event): XXX
|
||||
def canvasIncrCanvasHeightWidth(self, event):
|
||||
@ -182,8 +228,8 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasWidth(self, event): XXX
|
||||
def canvasIncrCanvasWidth(self, event):
|
||||
self.parentCanvas.resize([ \
|
||||
self.parentCanvas.canvasSize[0]+1, \
|
||||
self.parentCanvas.resize([ \
|
||||
self.parentCanvas.canvasSize[0] + 1, \
|
||||
self.parentCanvas.canvasSize[1]])
|
||||
# }}}
|
||||
# {{{ canvasNew(self, event, newCanvasSize=None): XXX
|
||||
@ -265,7 +311,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolCircle(self, event): XXX
|
||||
def canvasToolCircle(self, event):
|
||||
self.canvasTool = MiRCARTToolCircle(self.parentCanvas)
|
||||
self.canvasTool = ToolCircle(self.parentCanvas)
|
||||
self.parentFrame.menuItemsById[self.parentFrame.CID_CIRCLE[0]].Check(True)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CIRCLE[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_CIRCLE[0], True)
|
||||
@ -273,7 +319,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolFill(self, event): XXX
|
||||
def canvasToolFill(self, event):
|
||||
self.canvasTool = MiRCARTToolFill(self.parentCanvas)
|
||||
self.canvasTool = ToolFill(self.parentCanvas)
|
||||
self.parentFrame.menuItemsById[self.parentFrame.CID_FILL[0]].Check(True)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_FILL[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_FILL[0], True)
|
||||
@ -281,7 +327,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolLine(self, event): XXX
|
||||
def canvasToolLine(self, event):
|
||||
self.canvasTool = MiRCARTToolLine(self.parentCanvas)
|
||||
self.canvasTool = ToolLine(self.parentCanvas)
|
||||
self.parentFrame.menuItemsById[self.parentFrame.CID_LINE[0]].Check(True)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_LINE[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_LINE[0], True)
|
||||
@ -289,7 +335,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolSelectClone(self, event): XXX
|
||||
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)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_CLONE_SELECT[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_CLONE_SELECT[0], True)
|
||||
@ -297,7 +343,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolSelectMove(self, event): XXX
|
||||
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)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_MOVE_SELECT[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_MOVE_SELECT[0], True)
|
||||
@ -305,7 +351,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolRect(self, event): XXX
|
||||
def canvasToolRect(self, event):
|
||||
self.canvasTool = MiRCARTToolRect(self.parentCanvas)
|
||||
self.canvasTool = ToolRect(self.parentCanvas)
|
||||
self.parentFrame.menuItemsById[self.parentFrame.CID_RECT[0]].Check(True)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_RECT[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_RECT[0], True)
|
||||
@ -313,7 +359,7 @@ class MiRCARTCanvasInterface():
|
||||
# }}}
|
||||
# {{{ canvasToolText(self, event): XXX
|
||||
def canvasToolText(self, event):
|
||||
self.canvasTool = MiRCARTToolText(self.parentCanvas)
|
||||
self.canvasTool = ToolText(self.parentCanvas)
|
||||
self.parentFrame.menuItemsById[self.parentFrame.CID_TEXT[0]].Check(True)
|
||||
toolBar = self.parentFrame.toolBarItemsById[self.parentFrame.CID_TEXT[0]].GetToolBar()
|
||||
toolBar.ToggleTool(self.parentFrame.CID_TEXT[0], True)
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTCanvasJournal.py -- XXX
|
||||
# CanvasJournal.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
class MiRCARTCanvasJournal():
|
||||
class CanvasJournal():
|
||||
"""XXX"""
|
||||
patchesCursor = patchesUndo = patchesUndoLevel = None
|
||||
|
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTColours.py -- XXX
|
||||
# Colours.py -- XXX
|
||||
# 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"],
|
||||
[0, 0, 0, 255, "Black"],
|
||||
[0, 0, 187, 255, "Blue"],
|
@ -1,91 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTFrame.py -- XXX
|
||||
# GuiFrame.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from MiRCARTCanvas import MiRCARTCanvas, haveUrllib
|
||||
from MiRCARTCanvasInterface import MiRCARTCanvasInterface
|
||||
from MiRCARTColours import MiRCARTColours
|
||||
from MiRCARTGeneralFrame import MiRCARTGeneralFrame, \
|
||||
from Canvas import Canvas, haveUrllib
|
||||
from CanvasInterface import CanvasInterface
|
||||
from Colours import Colours
|
||||
from GuiGeneralFrame import GuiGeneralFrame, \
|
||||
TID_ACCELS, TID_COMMAND, TID_LIST, TID_MENU, TID_NOTHING, TID_SELECT, TID_TOOLBAR, \
|
||||
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"""
|
||||
panelCanvas = None; lastPanelState = {};
|
||||
|
||||
# {{{ Commands
|
||||
# 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_OPEN = [0x101, TID_COMMAND, "Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None, MiRCARTCanvasInterface.canvasOpen]
|
||||
CID_SAVE = [0x102, TID_COMMAND, "Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None, MiRCARTCanvasInterface.canvasSave]
|
||||
CID_SAVEAS = [0x103, TID_COMMAND, "Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None, MiRCARTCanvasInterface.canvasSaveAs]
|
||||
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, CanvasInterface.canvasOpen]
|
||||
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, CanvasInterface.canvasSaveAs]
|
||||
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...", \
|
||||
"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...", \
|
||||
"Export to Pasteb&in...", None, None, haveUrllib, MiRCARTCanvasInterface.canvasExportPastebin]
|
||||
CID_EXIT = [0x107, TID_COMMAND, "Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None, MiRCARTCanvasInterface.canvasExit]
|
||||
CID_UNDO = [0x108, TID_COMMAND, "Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False, MiRCARTCanvasInterface.canvasUndo]
|
||||
CID_REDO = [0x109, TID_COMMAND, "Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False, MiRCARTCanvasInterface.canvasRedo]
|
||||
CID_CUT = [0x10a, TID_COMMAND, "Cut", "Cu&t", ["", wx.ART_CUT], None, False, MiRCARTCanvasInterface.canvasCut]
|
||||
CID_COPY = [0x10b, TID_COMMAND, "Copy", "&Copy", ["", wx.ART_COPY], None, False, MiRCARTCanvasInterface.canvasCopy]
|
||||
CID_PASTE = [0x10c, TID_COMMAND, "Paste", "&Paste", ["", wx.ART_PASTE], None, False, MiRCARTCanvasInterface.canvasPaste]
|
||||
CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, MiRCARTCanvasInterface.canvasDelete]
|
||||
"Export to Pasteb&in...", None, None, haveUrllib, CanvasInterface.canvasExportPastebin]
|
||||
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, CanvasInterface.canvasUndo]
|
||||
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, CanvasInterface.canvasCut]
|
||||
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, CanvasInterface.canvasPaste]
|
||||
CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, CanvasInterface.canvasDelete]
|
||||
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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"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", \
|
||||
"Decrease brush size", ["toolDecrBrushHW.png"], None, None, MiRCARTCanvasInterface.canvasDecrBrushHeightWidth]
|
||||
CID_SOLID_BRUSH = [0x11a, TID_SELECT, "Solid brush", "Solid brush", None, None, True, MiRCARTCanvasInterface.canvasBrushSolid]
|
||||
"Decrease brush size", ["toolDecrBrushHW.png"], None, None, CanvasInterface.canvasDecrBrushHeightWidth]
|
||||
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_CIRCLE = [0x151, TID_SELECT, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False, MiRCARTCanvasInterface.canvasToolCircle]
|
||||
CID_FILL = [0x152, TID_SELECT, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False, MiRCARTCanvasInterface.canvasToolFill]
|
||||
CID_LINE = [0x153, TID_SELECT, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False, MiRCARTCanvasInterface.canvasToolLine]
|
||||
CID_TEXT = [0x154, TID_SELECT, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False, MiRCARTCanvasInterface.canvasToolText]
|
||||
CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, MiRCARTCanvasInterface.canvasToolSelectClone]
|
||||
CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, MiRCARTCanvasInterface.canvasToolSelectMove]
|
||||
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, CanvasInterface.canvasToolCircle]
|
||||
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, CanvasInterface.canvasToolLine]
|
||||
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, CanvasInterface.canvasToolSelectClone]
|
||||
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_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, True, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, MiRCARTCanvasInterface.canvasColour]
|
||||
CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", 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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.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, CanvasInterface.canvasColour]
|
||||
|
||||
CID_ABOUT = [0x1b0, TID_COMMAND, "About", "&About", None, None, True, CanvasInterface.canvasAbout]
|
||||
# }}}
|
||||
# {{{ Menus
|
||||
MID_FILE = (0x300, TID_MENU, "File", "&File", ( \
|
||||
@ -102,6 +105,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
CID_SOLID_BRUSH))
|
||||
MID_TOOLS = (0x302, TID_MENU, "Tools", "&Tools", ( \
|
||||
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
|
||||
BID_TOOLBAR = (0x400, TID_TOOLBAR, ( \
|
||||
@ -126,7 +131,7 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
# }}}
|
||||
# {{{ Lists
|
||||
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))
|
||||
# }}}
|
||||
|
||||
@ -138,7 +143,7 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
self.CID_COLOUR10, self.CID_COLOUR11, self.CID_COLOUR12, self.CID_COLOUR13, self.CID_COLOUR14, \
|
||||
self.CID_COLOUR15)
|
||||
for numColour in range(len(paletteDescr)):
|
||||
toolBitmapColour = MiRCARTColours[numColour][0:4]
|
||||
toolBitmapColour = Colours[numColour][0:4]
|
||||
toolBitmap = wx.Bitmap((16,16))
|
||||
toolBitmapDc = wx.MemoryDC(); toolBitmapDc.SelectObject(toolBitmap);
|
||||
toolBitmapBrush = wx.Brush( \
|
||||
@ -177,15 +182,15 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
textItems.append("FG: {:02d}, BG: {:02d}".format( \
|
||||
*self.lastPanelState["colours"]))
|
||||
textItems.append("{} on {}".format( \
|
||||
MiRCARTColours[self.lastPanelState["colours"][0]][4], \
|
||||
MiRCARTColours[self.lastPanelState["colours"][1]][4]))
|
||||
Colours[self.lastPanelState["colours"][0]][4], \
|
||||
Colours[self.lastPanelState["colours"][1]][4]))
|
||||
if "pathName" in self.lastPanelState:
|
||||
if self.lastPanelState["pathName"] != "":
|
||||
basePathName = os.path.basename(self.lastPanelState["pathName"])
|
||||
textItems.append("Current file: {}".format(basePathName))
|
||||
self.SetTitle("{} - MiRCART".format(basePathName))
|
||||
self.SetTitle("{} - roar".format(basePathName))
|
||||
else:
|
||||
self.SetTitle("MiRCART")
|
||||
self.SetTitle("roar")
|
||||
if "toolName" in self.lastPanelState:
|
||||
textItems.append("Current tool: {}".format( \
|
||||
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
|
||||
def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)):
|
||||
self._initPaletteToolBitmaps()
|
||||
self.panelSkin = super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize)
|
||||
self.panelCanvas = MiRCARTCanvas(self.panelSkin, parentFrame=self, \
|
||||
self.panelSkin = super().__init__(parent, wx.ID_ANY, "", size=appSize)
|
||||
self.panelCanvas = Canvas(self.panelSkin, parentFrame=self, \
|
||||
defaultCanvasPos=defaultCanvasPos, \
|
||||
defaultCanvasSize=defaultCanvasSize, \
|
||||
defaultCellSize=defaultCellSize)
|
||||
@ -230,5 +235,10 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
self.panelSkin.SetSizer(self.sizerSkin)
|
||||
self.panelSkin.SetAutoLayout(1)
|
||||
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
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTGeneralFrame.py -- XXX
|
||||
# GuiGeneralFrame.py -- XXX
|
||||
# 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_VSEP = (0x202, TID_NOTHING)
|
||||
|
||||
class MiRCARTGeneralFrame(wx.Frame):
|
||||
class GuiGeneralFrame(wx.Frame):
|
||||
"""XXX"""
|
||||
accelItemsById = itemsById = menuItemsById = toolBarItemsById = None
|
||||
statusBar = toolBars = None
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTTool.py -- XXX
|
||||
# Tool.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
class MiRCARTTool():
|
||||
class Tool():
|
||||
"""XXX"""
|
||||
parentCanvas = None
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolCircle.py -- XXX
|
||||
# ToolCircle.py -- XXX
|
||||
# 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"""
|
||||
name = "Circle"
|
||||
|
||||
@ -20,15 +20,14 @@ class MiRCARTToolCircle(MiRCARTTool):
|
||||
brushColours[0] = brushColours[1]
|
||||
else:
|
||||
brushColours[1] = brushColours[0]
|
||||
_brushSize = brushSize[0]*2
|
||||
originPoint = (_brushSize/2, _brushSize/2)
|
||||
radius = _brushSize
|
||||
_brushSize = brushSize[0] * 2
|
||||
originPoint, radius = (_brushSize / 2, _brushSize / 2), _brushSize
|
||||
for brushY 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 = [ \
|
||||
atPoint[0] + int(originPoint[0]+brushX), \
|
||||
atPoint[1] + int(originPoint[1]+brushY), \
|
||||
atPoint[0] + int(originPoint[0] + brushX), \
|
||||
atPoint[1] + int(originPoint[1] + brushY), \
|
||||
*brushColours, 0, " "]
|
||||
if isLeftDown or isRightDown:
|
||||
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
@ -1,19 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolFill.py -- XXX
|
||||
# ToolFill.py -- XXX
|
||||
# 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"""
|
||||
name = "Fill"
|
||||
|
||||
#
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
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]
|
||||
if isLeftDown or isRightDown:
|
||||
if isRightDown:
|
@ -1,45 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolLine.py -- XXX
|
||||
# ToolLine.py -- XXX
|
||||
# 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"""
|
||||
name = "Line"
|
||||
toolColours = toolOriginPoint = toolState = None
|
||||
|
||||
TS_NONE = 0
|
||||
TS_ORIGIN = 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]
|
||||
# }}}
|
||||
# {{{ _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();
|
||||
# {{{ _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint): XXX
|
||||
def _getLine(self, brushColours, brushSize, dispatchFn, eventDc, isCursor, originPoint, targetPoint):
|
||||
originPoint, targetPoint = originPoint.copy(), targetPoint.copy()
|
||||
pointDelta = self._pointDelta(originPoint, targetPoint)
|
||||
lineXSign = 1 if pointDelta[0] > 0 else -1;
|
||||
lineYSign = 1 if pointDelta[1] > 0 else -1;
|
||||
lineXSign = 1 if pointDelta[0] > 0 else -1; lineYSign = 1 if pointDelta[1] > 0 else -1;
|
||||
pointDelta = [abs(a) for a in pointDelta]
|
||||
if pointDelta[0] > pointDelta[1]:
|
||||
lineXX, lineXY, lineYX, lineYY = lineXSign, 0, 0, lineYSign
|
||||
else:
|
||||
pointDelta = [pointDelta[1], pointDelta[0]]
|
||||
lineXX, lineXY, lineYX, lineYY = 0, lineYSign, lineXSign, 0
|
||||
pointDelta = [pointDelta[1], pointDelta[0]]
|
||||
lineD = 2 * pointDelta[1] - pointDelta[0]; lineY = 0;
|
||||
for lineX in range(pointDelta[0] + 1):
|
||||
for brushStep in range(brushSize[0]):
|
||||
patch = [ \
|
||||
originPoint[0] + lineX*lineXX + lineY*lineYX + brushStep, \
|
||||
originPoint[1] + lineX*lineXY + lineY*lineYY, \
|
||||
patch = [ \
|
||||
originPoint[0] + lineX * lineXX + lineY * lineYX + brushStep, \
|
||||
originPoint[1] + lineX * lineXY + lineY * lineYY, \
|
||||
*brushColours, 0, " "]
|
||||
if isCursor:
|
||||
dispatchFn(eventDc, False, patch); dispatchFn(eventDc, True, patch);
|
||||
@ -49,6 +38,14 @@ class MiRCARTToolLine(MiRCARTTool):
|
||||
lineD -= pointDelta[0]; lineY += 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
|
||||
@ -62,26 +59,17 @@ class MiRCARTToolLine(MiRCARTTool):
|
||||
brushColours[1] = brushColours[0]
|
||||
if self.toolState == self.TS_NONE:
|
||||
if isLeftDown or isRightDown:
|
||||
self.toolColours = brushColours
|
||||
self.toolOriginPoint = list(atPoint)
|
||||
self.toolState = self.TS_ORIGIN
|
||||
self.toolColours, self.toolOriginPoint, self.toolState = brushColours, list(atPoint), self.TS_ORIGIN
|
||||
dispatchFn(eventDc, True, [*atPoint, *brushColours, 0, " "])
|
||||
elif self.toolState == self.TS_ORIGIN:
|
||||
targetPoint = list(atPoint)
|
||||
originPoint = self.toolOriginPoint
|
||||
self._getLine(self.toolColours, brushSize, \
|
||||
eventDc, isLeftDown or isRightDown, \
|
||||
originPoint, targetPoint, dispatchFn)
|
||||
originPoint, targetPoint = self.toolOriginPoint, list(atPoint)
|
||||
self._getLine(self.toolColours, brushSize, dispatchFn, eventDc, isLeftDown or isRightDown, originPoint, targetPoint)
|
||||
if isLeftDown or isRightDown:
|
||||
self.toolColours = None
|
||||
self.toolOriginPoint = None
|
||||
self.toolState = self.TS_NONE
|
||||
self.toolColours, self.toolOriginPoint, self.toolState = None, None, self.TS_NONE
|
||||
|
||||
# __init__(self, *args): initialisation method
|
||||
def __init__(self, *args):
|
||||
super().__init__(*args)
|
||||
self.toolColours = None
|
||||
self.toolOriginPoint = None
|
||||
self.toolState = self.TS_NONE
|
||||
self.toolColours, self.toolOriginPoint, self.toolState = None, None, self.TS_NONE
|
||||
|
||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolRect.py -- XXX
|
||||
# ToolRect.py -- XXX
|
||||
# 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"""
|
||||
name = "Rectangle"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolSelect.py -- XXX
|
||||
# ToolSelect.py -- XXX
|
||||
# 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"""
|
||||
TS_NONE = 0
|
||||
TS_ORIGIN = 1
|
||||
@ -35,11 +35,11 @@ class MiRCARTToolSelect(MiRCARTTool):
|
||||
if rectFrame[0][1] > rectFrame[1][1]:
|
||||
rectFrame[0][1], rectFrame[1][1] = rectFrame[1][1], rectFrame[0][1]
|
||||
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]
|
||||
dispatchFn(eventDc, True, [rectX, rectFrame[0][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]
|
||||
dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "])
|
||||
dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "])
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolSelectClone.py -- XXX
|
||||
# ToolSelectClone.py -- XXX
|
||||
# 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"""
|
||||
name = "Clone selection"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolSelectMove.py -- XXX
|
||||
# ToolSelectMove.py -- XXX
|
||||
# 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"""
|
||||
name = "Move selection"
|
||||
|
@ -1,22 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# MiRCARTToolText.py -- XXX
|
||||
# ToolText.py -- XXX
|
||||
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||
#
|
||||
|
||||
from MiRCARTTool import MiRCARTTool
|
||||
from Tool import Tool
|
||||
import wx
|
||||
|
||||
class MiRCARTToolText(MiRCARTTool):
|
||||
class ToolText(Tool):
|
||||
"""XXX"""
|
||||
name = "Text"
|
||||
textColours = textPos = None
|
||||
|
||||
#
|
||||
# onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc): XXX
|
||||
def onKeyboardEvent(self, event, atPoint, brushColours, brushSize, keyChar, dispatchFn, eventDc):
|
||||
keyModifiers = event.GetModifiers()
|
||||
if keyModifiers != wx.MOD_NONE \
|
||||
if keyModifiers != wx.MOD_NONE \
|
||||
and keyModifiers != wx.MOD_SHIFT:
|
||||
return True
|
||||
else:
|
||||
@ -28,8 +27,7 @@ class MiRCARTToolText(MiRCARTTool):
|
||||
if self.textPos[0] < (self.parentCanvas.canvasSize[0] - 1):
|
||||
self.textPos[0] += 1
|
||||
elif self.textPos[1] < (self.parentCanvas.canvasSize[1] - 1):
|
||||
self.textPos[0] = 0
|
||||
self.textPos[1] += 1
|
||||
self.textPos[0] = 0; self.textPos[1] += 1;
|
||||
else:
|
||||
self.textPos = [0, 0]
|
||||
return False
|
||||
@ -38,15 +36,18 @@ class MiRCARTToolText(MiRCARTTool):
|
||||
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX
|
||||
def onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc):
|
||||
if isLeftDown:
|
||||
self.textColours = brushColours.copy()
|
||||
self.textPos = list(atPoint)
|
||||
self.textColours, self.textPos = brushColours.copy(), list(atPoint)
|
||||
elif isRightDown:
|
||||
self.textColours = [brushColours[1], brushColours[0]]
|
||||
self.textPos = list(atPoint)
|
||||
self.textColours, self.textPos = [brushColours[1], brushColours[0]], list(atPoint)
|
||||
else:
|
||||
if self.textColours == None:
|
||||
self.textColours = brushColours.copy()
|
||||
self.textPos = list(atPoint)
|
||||
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
|
@ -1,6 +1,6 @@
|
||||
#!/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>
|
||||
#
|
||||
|
||||
@ -8,14 +8,14 @@ import os, sys
|
||||
[sys.path.append(os.path.join(os.getcwd(), path)) for path in \
|
||||
["libcanvas", "libgui", "librtl", "libtools"]]
|
||||
|
||||
from MiRCARTFrame import MiRCARTFrame
|
||||
from GuiFrame import GuiFrame
|
||||
import wx
|
||||
|
||||
#
|
||||
# Entry point
|
||||
def main(*argv):
|
||||
wxApp = wx.App(False)
|
||||
appFrame = MiRCARTFrame(None)
|
||||
appFrame = GuiFrame(None)
|
||||
if len(argv) > 1 \
|
||||
and len(argv[1]) > 0:
|
||||
appFrame.panelCanvas.canvasInterface.canvasPathName = argv[1]
|