mirror of
https://github.com/Steffo99/flyingsnake.git
synced 2024-12-21 22:24:19 +00:00
Update to 1.4; some colors are still missing, though
This commit is contained in:
parent
71066ed56b
commit
4d26a53e87
11 changed files with 112 additions and 125 deletions
37
.github/workflows/pythonpackage.yml
vendored
37
.github/workflows/pythonpackage.yml
vendored
|
@ -1,37 +0,0 @@
|
|||
name: Python package
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
lfs: true
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
python setup.py develop
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
pip install flake8
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pip install pytest
|
||||
pytest
|
File diff suppressed because one or more lines are too long
|
@ -11,7 +11,7 @@ def get_block_colors_from_tedit_settings(tree: ElementTree) -> typing.Dict[int,
|
|||
|
||||
for block in root:
|
||||
id_ = block.attrib["Id"]
|
||||
color = block.attrib["Color"]
|
||||
color = block.attrib["Color"] if "color" in block.attrib else "#00000000"
|
||||
alpha, red, green, blue = ImageColor.getrgb(color)
|
||||
colors[id_] = red, green, blue, alpha
|
||||
|
||||
|
|
69
poetry.lock
generated
Normal file
69
poetry.lock
generated
Normal file
|
@ -0,0 +1,69 @@
|
|||
[[package]]
|
||||
category = "main"
|
||||
description = "Composable command line interface toolkit"
|
||||
name = "click"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
version = "7.1.2"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "A Terraria world parser in Python"
|
||||
name = "lihzahrd"
|
||||
optional = false
|
||||
python-versions = ">=3.6,<4.0"
|
||||
version = "2.0.0a1"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Python Imaging Library (Fork)"
|
||||
name = "pillow"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
version = "6.2.2"
|
||||
|
||||
[metadata]
|
||||
content-hash = "5ea328722a25ebd42b3ccd900143ad2db3c94feda34c89cc5e680add291dbeb5"
|
||||
python-versions = "^3.6"
|
||||
|
||||
[metadata.files]
|
||||
click = [
|
||||
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
|
||||
{file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
|
||||
]
|
||||
lihzahrd = [
|
||||
{file = "lihzahrd-2.0.0a1-py3-none-any.whl", hash = "sha256:facda1e2e68d5d940183cc33dd0fc52840a7ec38a69ba7e5997553ff3360da9a"},
|
||||
{file = "lihzahrd-2.0.0a1.tar.gz", hash = "sha256:aed5e196ca9cb7c11ef559f3fc398f40c5c5001e6492a73c1ea5c19125ec1c2d"},
|
||||
]
|
||||
pillow = [
|
||||
{file = "Pillow-6.2.2-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:834dd023b7f987d6b700ad93dc818098d7eb046bd445e9992b3093c6f9d7a95f"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:d3a98444a00b4643b22b0685dbf9e0ddcaf4ebfd4ea23f84f228adf5a0765bb2"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:2b4a94be53dff02af90760c10a2e3634c3c7703410f38c98154d5ce71fe63d20"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27m-win32.whl", hash = "sha256:87ef0eca169f7f0bc050b22f05c7e174a65c36d584428431e802c0165c5856ea"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27m-win_amd64.whl", hash = "sha256:cbd5647097dc55e501f459dbac7f1d0402225636deeb9e0a98a8d2df649fc19d"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:4adc3302df4faf77c63ab3a83e1a3e34b94a6a992084f4aa1cb236d1deaf4b39"},
|
||||
{file = "Pillow-6.2.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e3a797a079ce289e59dbd7eac9ca3bf682d52687f718686857281475b7ca8e6a"},
|
||||
{file = "Pillow-6.2.2-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:bb7861e4618a0c06c40a2e509c1bea207eea5fd4320d486e314e00745a402ca5"},
|
||||
{file = "Pillow-6.2.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:535e8e0e02c9f1fc2e307256149d6ee8ad3aa9a6e24144b7b6e6fb6126cb0e99"},
|
||||
{file = "Pillow-6.2.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:bc149dab804291a18e1186536519e5e122a2ac1316cb80f506e855a500b1cdd4"},
|
||||
{file = "Pillow-6.2.2-cp35-cp35m-win32.whl", hash = "sha256:1a3bc8e1db5af40a81535a62a591fafdb30a8a1b319798ea8052aa65ef8f06d2"},
|
||||
{file = "Pillow-6.2.2-cp35-cp35m-win_amd64.whl", hash = "sha256:d6b4dc325170bee04ca8292bbd556c6f5398d52c6149ca881e67daf62215426f"},
|
||||
{file = "Pillow-6.2.2-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:43ef1cff7ee57f9c8c8e6fa02a62eae9fa23a7e34418c7ce88c0e3fe09d1fb38"},
|
||||
{file = "Pillow-6.2.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:900de1fdc93764be13f6b39dc0dd0207d9ff441d87ad7c6e97e49b81987dc0f3"},
|
||||
{file = "Pillow-6.2.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:92b83b380f9181cacc994f4c983d95a9c8b00b50bf786c66d235716b526a3332"},
|
||||
{file = "Pillow-6.2.2-cp36-cp36m-win32.whl", hash = "sha256:00e0bbe9923adc5cc38a8da7d87d4ce16cde53b8d3bba8886cb928e84522d963"},
|
||||
{file = "Pillow-6.2.2-cp36-cp36m-win_amd64.whl", hash = "sha256:5ccfcb0a34ad9b77ad247c231edb781763198f405a5c8dc1b642449af821fb7f"},
|
||||
{file = "Pillow-6.2.2-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:5dcbbaa3a24d091a64560d3c439a8962866a79a033d40eb1a75f1b3413bfc2bc"},
|
||||
{file = "Pillow-6.2.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6e2a7e74d1a626b817ecb7a28c433b471a395c010b2a1f511f976e9ea4363e64"},
|
||||
{file = "Pillow-6.2.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c424d35a5259be559b64490d0fd9e03fba81f1ce8e5b66e0a59de97547351d80"},
|
||||
{file = "Pillow-6.2.2-cp37-cp37m-win32.whl", hash = "sha256:aa4792ab056f51b49e7d59ce5733155e10a918baf8ce50f64405db23d5627fa2"},
|
||||
{file = "Pillow-6.2.2-cp37-cp37m-win_amd64.whl", hash = "sha256:0d5c99f80068f13231ac206bd9b2e80ea357f5cf9ae0fa97fab21e32d5b61065"},
|
||||
{file = "Pillow-6.2.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:03457e439d073770d88afdd90318382084732a5b98b0eb6f49454746dbaae701"},
|
||||
{file = "Pillow-6.2.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:ccf16fe444cc43800eeacd4f4769971200982200a71b1368f49410d0eb769543"},
|
||||
{file = "Pillow-6.2.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:b72c39585f1837d946bd1a829a4820ccf86e361f28cbf60f5d646f06318b61e2"},
|
||||
{file = "Pillow-6.2.2-cp38-cp38-win32.whl", hash = "sha256:3ba7d8f1d962780f86aa747fef0baf3211b80cb13310fff0c375da879c0656d4"},
|
||||
{file = "Pillow-6.2.2-cp38-cp38-win_amd64.whl", hash = "sha256:3e81485cec47c24f5fb27acb485a4fc97376b2b332ed633867dc68ac3077998c"},
|
||||
{file = "Pillow-6.2.2-pp273-pypy_73-win32.whl", hash = "sha256:aa1b0297e352007ec781a33f026afbb062a9a9895bb103c8f49af434b1666880"},
|
||||
{file = "Pillow-6.2.2-pp373-pypy36_pp73-win32.whl", hash = "sha256:82859575005408af81b3e9171ae326ff56a69af5439d3fc20e8cb76cd51c8246"},
|
||||
{file = "Pillow-6.2.2.tar.gz", hash = "sha256:db9ff0c251ed066d367f53b64827cc9e18ccea001b986d08c265e53625dab950"},
|
||||
]
|
41
pyproject.toml
Normal file
41
pyproject.toml
Normal file
|
@ -0,0 +1,41 @@
|
|||
[tool.poetry]
|
||||
name = "flyingsnake"
|
||||
version = "2.0.0a1"
|
||||
description = "A Terraria world map renderer"
|
||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||
license = "AGPL-3.0+"
|
||||
readme = "README.md"
|
||||
homepage = "https://github.com/Steffo99/flyingsnake"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
||||
"Topic :: Games/Entertainment",
|
||||
"Topic :: Multimedia :: Graphics",
|
||||
"Typing :: Typed"
|
||||
]
|
||||
|
||||
# Library dependencies
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.6"
|
||||
click = "^7.0"
|
||||
lihzahrd = "^2.0.0a1"
|
||||
"Pillow" = "^6.1.0"
|
||||
|
||||
# Development dependencies
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
# Optional dependencies
|
||||
[tool.poetry.extras]
|
||||
|
||||
# Scripts
|
||||
[tool.poetry.scripts]
|
||||
flyingsnake = 'flyingsnake.__main__:flyingsnake'
|
||||
|
||||
# Used build system
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
|
@ -1,4 +0,0 @@
|
|||
click>=7.0
|
||||
lihzahrd>=1.0b1
|
||||
Pillow>=6.1.0
|
||||
pytest>=5.1.3
|
38
setup.py
38
setup.py
|
@ -1,38 +0,0 @@
|
|||
import setuptools
|
||||
|
||||
with open("README.md", "r") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="flyingsnake",
|
||||
version="1.0",
|
||||
author="Stefano Pigozzi",
|
||||
author_email="ste.pigozzi@gmail.com",
|
||||
description="A Terraria world map renderer",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/Steffo99/flyingsnake",
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=[
|
||||
"click>=7.0",
|
||||
"lihzahrd>=1.0b6",
|
||||
"Pillow>=6.1.0"
|
||||
],
|
||||
python_requires=">=3.7",
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
||||
"Topic :: Games/Entertainment",
|
||||
"Topic :: Multimedia :: Graphics",
|
||||
"Typing :: Typed"
|
||||
],
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"flyingsnake = flyingsnake.__main__:flyingsnake"
|
||||
]
|
||||
}
|
||||
)
|
BIN
tests/Small_Example.wld
(Stored with Git LFS)
BIN
tests/Small_Example.wld
(Stored with Git LFS)
Binary file not shown.
BIN
tests/Small_Example_full_prerendered.png
(Stored with Git LFS)
BIN
tests/Small_Example_full_prerendered.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/Small_Example_partial_prerendered.png
(Stored with Git LFS)
BIN
tests/Small_Example_partial_prerendered.png
(Stored with Git LFS)
Binary file not shown.
|
@ -1,35 +0,0 @@
|
|||
import pytest
|
||||
import flyingsnake
|
||||
from click.testing import CliRunner
|
||||
from PIL import Image
|
||||
import hashlib
|
||||
|
||||
|
||||
# Main integration test
|
||||
def test_full_render():
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(flyingsnake.flyingsnake, ["./tests/Small_Example.wld", "./tests/Small_Example_full.png"])
|
||||
assert result.exit_code == 0
|
||||
|
||||
with open("Small_Example_full_prerendered.png") as prerendered:
|
||||
prerendered_hash = hashlib.sha1(prerendered)
|
||||
with open("Small_Example_full.png") as created:
|
||||
created_hash = hashlib.sha1(created)
|
||||
assert prerendered_hash.hexdigest() == created_hash.hexdigest()
|
||||
|
||||
|
||||
def test_partial_render():
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(flyingsnake.flyingsnake,
|
||||
["./tests/Small_Example.wld", "./tests/Small_Example_partial.png",
|
||||
"-x", "100",
|
||||
"-y", "600",
|
||||
"-w", "321",
|
||||
"-h", "123"])
|
||||
assert result.exit_code == 0
|
||||
|
||||
with open("Small_Example_partial_prerendered.png") as prerendered:
|
||||
prerendered_hash = hashlib.sha1(prerendered)
|
||||
with open("Small_Example_partial.png") as created:
|
||||
created_hash = hashlib.sha1(created)
|
||||
assert prerendered_hash.hexdigest() == created_hash.hexdigest()
|
Loading…
Reference in a new issue