1
0
Fork 0
mirror of https://git.lynn.is/Gwen/python-layout.git synced 2024-01-13 01:31:55 +01:00

Compare commits

...

5 commits

Author SHA1 Message Date
Lynn 17eefd6654 Added Lynn to the authors 2023-02-08 00:20:38 +01:00
Lynn 83d86f9c5c Added project build file 2023-02-07 23:56:47 +01:00
Lynn abeae7f3c8 Fixed imports 2023-02-07 23:56:17 +01:00
Lynn ab735e203f Restructured project 2023-02-07 23:54:13 +01:00
Lynn a563963fe2 Expanded .gitignore 2023-02-07 23:52:49 +01:00
14 changed files with 284 additions and 23 deletions

241
.gitignore vendored
View file

@ -1,2 +1,239 @@
__pycache__
/venv
# Created by https://www.toptal.com/developers/gitignore/api/python,sublimetext,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=python,sublimetext,macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml
# ruff
.ruff_cache/
### SublimeText ###
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
*.sublime-project
# SFTP configuration file
sftp-config.json
sftp-config-alt*.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
# End of https://www.toptal.com/developers/gitignore/api/python,sublimetext,macos

View file

@ -1,8 +1,5 @@
from .enums import FlexDirection, FlexWrap, FlexJustify, FlexAlignItems, FlexAlignContent, TextAlign, \
TextVerticalAlign, TextWrap, ImageMode, ImageAnchor, BoxTitleAnchor
from .layout import Layout
from .enums import *
from .document import Document
from .box import Box
from .container import Container

View file

@ -1,7 +1,6 @@
from . import Layout
from PIL import ImageDraw
from .enums import BoxTitleAnchor
from . import Layout, BoxTitleAnchor
class Box(Layout):

View file

@ -1,6 +1,6 @@
from . import Layout
from PIL import ImageDraw
from . import Layout
from .internal.helpers import min_with_none, max_with_none

View file

@ -1,8 +1,7 @@
from PIL import Image, ImageFont
from layout.enums import ColorMode
from layout.internal.helpers import max_with_none, min_with_none
from layout.layout import Layout
from . import Layout, ColorMode
from .internal.helpers import max_with_none, min_with_none
class Document(Layout):

View file

@ -1,7 +1,6 @@
from . import Layout
from . import Layout, FlexDirection, FlexWrap, FlexJustify, FlexAlignItems, FlexAlignContent
from .internal.flexlayouter import FlexLayouter
from .internal.helpers import min_with_none, max_with_none
from .enums import FlexDirection, FlexWrap, FlexJustify, FlexAlignItems, FlexAlignContent
class Flex(Layout):

View file

@ -1,8 +1,7 @@
from PIL import ImageDraw, Image as PilImage
from layout import Layout
from layout.enums import ImageMode, ImageAnchor
from layout.internal.helpers import max_with_none, min_with_none
from . import Layout, ImageMode, ImageAnchor
from .internal.helpers import max_with_none, min_with_none
class Image(Layout):

View file

@ -1,4 +1,4 @@
from ..enums import FlexDirection, FlexWrap, FlexJustify, FlexAlignItems, FlexAlignContent
from .. import FlexDirection, FlexWrap, FlexJustify, FlexAlignItems, FlexAlignContent
from .helpers import min_with_none, max_with_none

View file

@ -1,6 +1,6 @@
import unicodedata
from layout.enums import TextWrap, TextVerticalAlign, TextAlign
from .. import TextWrap, TextVerticalAlign, TextAlign
class TextLayouter():

View file

@ -2,8 +2,7 @@ import math
from PIL import Image, ImageDraw
import layout
from layout.internal.helpers import line_intersection
from .internal.helpers import line_intersection
class Layout:

View file

@ -1,8 +1,8 @@
from PIL import ImageDraw, ImageFont
from . import Layout
from . import Layout, TextAlign, TextVerticalAlign, TextWrap
from .internal.textlayouter import TextLayouter
from .internal.helpers import min_with_none, max_with_none, get_line_height
from .enums import TextAlign, TextVerticalAlign, TextWrap
class Text(Layout):

32
pyproject.toml Normal file
View file

@ -0,0 +1,32 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["pillow_layout", "pillow_layout.internal"]
[project]
name = "Pillow-Layout"
version = "0.1"
description = "Simple layout engine for Python Pillow images"
readme = "readme.md"
authors = [
{ name="Gwen", email="me@gwendolyn.dev" },
{ name="Lynn", email="git@lynn.is" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
]
requires-python = ">=3.7"
dependencies = [
"Pillow>=9.4.0",
]
[project.urls]
"repository" = "https://git.lynn.is/Gwen/Pillow-Layout"