Skip to content

Commit eda5d76

Browse files
committed
2021.2.8
1 parent 8c903d1 commit eda5d76

24 files changed

+103
-37
lines changed

.pre-commit-config.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repos:
2+
- repo: https://github.com/FHPythonUtils/Blackt
3+
rev: '2021'
4+
hooks:
5+
- id: blackt
6+
7+
- repo: https://github.com/pycqa/isort
8+
rev: 5.9.3
9+
hooks:
10+
- id: isort
11+
12+
- repo: https://github.com/pycqa/pylint
13+
rev: v2.11.1
14+
hooks:
15+
- id: pylint
16+
args: [--disable=import-error,--jobs=0, --fail-under=9.8, --ignore-patterns=test.*?py]
17+
18+
- repo: https://github.com/pre-commit/pre-commit-hooks
19+
rev: v4.0.1
20+
hooks:
21+
- id: trailing-whitespace
22+
- id: end-of-file-fixer
23+
24+
- repo: https://github.com/asottile/pyupgrade
25+
rev: v2.29.0
26+
hooks:
27+
- id: pyupgrade
28+
args: [--py37-plus]

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
All major and minor version changes will be documented in this file. Details of
33
patch-level version changes can be found in [commit messages](../../commits/master).
44

5+
## 2021.2.8 - 2021/11/07
6+
7+
- add pre-commit
8+
- code quality improvements
9+
510
## 2021.2.7 - 2021/10/02
611

712
- code quality improvements

DOCS/layeredimage/io/common.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Do file io - Common Operations for file readers/writers.
1010

1111
## blendModeLookup
1212

13-
[[find in source code]](../../../layeredimage/io/common.py#L13)
13+
[[find in source code]](../../../layeredimage/io/common.py#L14)
1414

1515
```python
1616
def blendModeLookup(
@@ -24,7 +24,7 @@ Get the blendmode from a lookup table.
2424

2525
## expandLayersToCanvas
2626

27-
[[find in source code]](../../../layeredimage/io/common.py#L25)
27+
[[find in source code]](../../../layeredimage/io/common.py#L26)
2828

2929
```python
3030
def expandLayersToCanvas(

DOCS/layeredimage/io/lsr.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Do file io - LSR.
1010

1111
## openLayer_LSR
1212

13-
[[find in source code]](../../../layeredimage/io/lsr.py#L14)
13+
[[find in source code]](../../../layeredimage/io/lsr.py#L16)
1414

1515
```python
1616
def openLayer_LSR(file: str) -> LayeredImage:
@@ -20,7 +20,7 @@ Open a .lsr file into a layered image.
2020

2121
## saveLayer_LSR
2222

23-
[[find in source code]](../../../layeredimage/io/lsr.py#L35)
23+
[[find in source code]](../../../layeredimage/io/lsr.py#L37)
2424

2525
```python
2626
def saveLayer_LSR(fileName: str, layeredImage: LayeredImage) -> None:

README.md

+50-18
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ Use this module to read, and write to a number of layered image formats
3030
- [Built for](#built-for)
3131
- [Install Python on Windows](#install-python-on-windows)
3232
- [Chocolatey](#chocolatey)
33-
- [Download](#download)
33+
- [Windows - Python.org](#windows---pythonorg)
3434
- [Install Python on Linux](#install-python-on-linux)
3535
- [Apt](#apt)
36+
- [Dnf](#dnf)
37+
- [Install Python on MacOS](#install-python-on-macos)
38+
- [Homebrew](#homebrew)
39+
- [MacOS - Python.org](#macos---pythonorg)
3640
- [How to run](#how-to-run)
37-
- [With VSCode](#with-vscode)
38-
- [From the Terminal](#from-the-terminal)
41+
- [Windows](#windows)
42+
- [Linux/ MacOS](#linux-macos)
3943
- [Download Project](#download-project)
4044
- [Clone](#clone)
4145
- [Using The Command Line](#using-the-command-line)
@@ -228,44 +232,71 @@ pip install layeredimage
228232
Head to https://pypi.org/project/layeredimage/ for more info
229233

230234
## Language information
235+
231236
### Built for
232-
This program has been written for Python 3 and has been tested with
233-
Python version 3.9.0 <https://www.python.org/downloads/release/python-380/>.
237+
This program has been written for Python versions 3.7 - 3.10 and has been tested with both 3.7 and
238+
3.10
234239

235240
## Install Python on Windows
241+
236242
### Chocolatey
237243

238244
```powershell
239245
choco install python
240246
```
241247

242-
### Download
243-
To install Python, go to <https://www.python.org/> and download the latest
248+
### Windows - Python.org
249+
To install Python, go to https://www.python.org/downloads/windows/ and download the latest
244250
version.
245251

246252
## Install Python on Linux
253+
247254
### Apt
248255

249256
```bash
250-
sudo apt install python3.9
257+
sudo apt install python3.x
251258
```
252259

253-
## How to run
254-
### With VSCode
260+
### Dnf
261+
262+
```bash
263+
sudo dnf install python3.x
264+
```
255265

256-
1. Open the .py file in vscode
257-
2. Ensure a python 3.9 interpreter is selected (Ctrl+Shift+P > Python:Select
258-
Interpreter > Python 3.9)
259-
3. Run by pressing Ctrl+F5 (if you are prompted to install any modules, accept)
266+
## Install Python on MacOS
260267

261-
### From the Terminal
268+
### Homebrew
262269

263270
```bash
264-
./[file].py
271+
brew install [email protected]
265272
```
266273

274+
### MacOS - Python.org
275+
To install Python, go to https://www.python.org/downloads/macos/ and download the latest
276+
version.
277+
278+
## How to run
279+
280+
### Windows
281+
282+
- Module
283+
`py -3.x -m [module]` or `[module]` (if module installs a script)
284+
285+
- File
286+
`py -3.x [file]` or `./[file]`
287+
288+
### Linux/ MacOS
289+
290+
- Module
291+
`python3.x -m [module]` or `[module]` (if module installs a script)
292+
293+
- File
294+
`python3.x [file]` or `./[file]`
295+
267296
## Download Project
297+
268298
### Clone
299+
269300
#### Using The Command Line
270301

271302
1. Press the Clone or download button in the top right
@@ -279,7 +310,7 @@ clone to
279310
```
280311

281312
More information can be found at
282-
<https://help.github.com/en/articles/cloning-a-repository>
313+
https://help.github.com/en/articles/cloning-a-repository
283314

284315
#### Using GitHub Desktop
285316

@@ -288,7 +319,7 @@ More information can be found at
288319
3. Choose the path for where you want and click Clone
289320

290321
More information can be found at
291-
<https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop>
322+
https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop
292323

293324
### Download Zip File
294325

@@ -297,6 +328,7 @@ More information can be found at
297328
3. Copy/ move to the desired location
298329

299330
## Community Files
331+
300332
### Licence
301333
MIT License
302334
Copyright (c) FredHappyface

layeredimage/io/common.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
from typing import Any
55

6+
from blendmodes.imagetools import renderWAlphaOffset
67
from metprint import FHFormatter, Logger, LogType
78
from PIL.Image import Image
89

910
from ..blend import BlendType
10-
from ..layeredimage import LayeredImage, renderWAlphaOffset
11+
from ..layeredimage import LayeredImage
1112

1213

1314
def blendModeLookup(

layeredimage/io/layered.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ def _saveLayer_LAYERED(fileName: str, layeredImage: LayeredImage, compressed: bo
114114
thumbnail = compositeImage.copy()
115115
thumbnail.thumbnail((256, 256))
116116
imageLookup = {"composite": compositeImage, "thumbnail": thumbnail}
117-
for image in imageLookup:
118-
writeImage_LAYERED(imageLookup[image], layered, image + ".png", compressed)
117+
for imageName, imageData in imageLookup.items():
118+
writeImage_LAYERED(imageData, layered, imageName + ".png", compressed)
119119

120120

121121
def writeImage_LAYERED(image: Image.Image, zipFile: ZipFile, path: str, compressed: bool = False):

layeredimage/io/lsr.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
from os import sep
55

6-
from ..layeredimage import LayeredImage, renderWAlphaOffset
6+
from blendmodes.imagetools import renderWAlphaOffset
7+
8+
from ..layeredimage import LayeredImage
79
from ..layergroup import Group, Layer
810

911
# pylint: disable=invalid-name

layeredimage/layeredimage.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def __init__(
3838
if dimensions is None:
3939
layerDimens = [layerOrGroup.dimensions for layerOrGroup in layersAndGroups]
4040
self.dimensions = (
41-
max([layerDimen[0] for layerDimen in layerDimens]),
42-
max([layerDimen[1] for layerDimen in layerDimens]),
41+
max(layerDimen[0] for layerDimen in layerDimens),
42+
max(layerDimen[1] for layerDimen in layerDimens),
4343
)
4444
self.extras = kwargs
4545

layeredimage/layergroup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ def __init__(
168168
if dimensions is None:
169169
layerDimens = [layer.dimensions for layer in layers]
170170
self.dimensions = (
171-
max([dimensions[0] for dimensions in layerDimens]),
172-
max([dimensions[1] for dimensions in layerDimens]),
171+
max(dimensions[0] for dimensions in layerDimens),
172+
max(dimensions[1] for dimensions in layerDimens),
173173
)
174174

175175
def json(self) -> dict[str, Any]:

pyproject.toml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
[tool.poetry]
22
name = "layeredimage"
3-
version = "2021.2.7"
3+
version = "2021.2.8"
4+
license = "mit"
45
description = "Use this module to read, and write to a number of layered image formats"
56
authors = ["FredHappyface"]
67
classifiers = [
78
"Environment :: Console",
89
"Development Status :: 5 - Production/Stable",
910
"Intended Audience :: Developers",
1011
"Intended Audience :: Education",
11-
"License :: OSI Approved :: MIT License",
1212
"Natural Language :: English",
1313
"Operating System :: OS Independent",
14-
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: 3.7",
16-
"Programming Language :: Python :: 3.8",
17-
"Programming Language :: Python :: 3.9",
1814
"Programming Language :: Python :: Implementation :: CPython",
1915
"Topic :: Multimedia :: Graphics",
2016
"Topic :: Software Development :: Libraries :: Python Modules",
@@ -58,8 +54,9 @@ indent-string = "\t"
5854
ignore-patterns = "test_.*?py"
5955

6056
[tool.pylint.messages_control]
61-
enable = ['F', 'E', 'W', 'R', 'C']
57+
enable = ["F", "E", "W", "R", "C"]
6258
disable = [
59+
"not-callable", # Bug with 'LayeredImage is not callable (not-callable)'
6360
"pointless-string-statement",
6461
"superfluous-parens",
6562
"bad-continuation",
@@ -72,6 +69,7 @@ target-version = ["py37"]
7269

7370
[tool.isort]
7471
profile = "black"
72+
indent = "Tab"
7573

7674
[tool.pydocstyle]
7775
convention = "google"

test/base24(gif).ora

0 Bytes
Binary file not shown.

test/base24(layered).ora

0 Bytes
Binary file not shown.

test/base24(layeredc).ora

0 Bytes
Binary file not shown.

test/base24(lsr).lsr

0 Bytes
Binary file not shown.

test/base24(lsr).ora

0 Bytes
Binary file not shown.

test/base24(ora).layered

0 Bytes
Binary file not shown.

test/base24(ora).layeredc

0 Bytes
Binary file not shown.

test/base24(ora).ora

0 Bytes
Binary file not shown.

test/base24(pdn).ora

0 Bytes
Binary file not shown.

test/base24(psd).ora

0 Bytes
Binary file not shown.

test/base24(tiff).ora

0 Bytes
Binary file not shown.

test/base24(webp).ora

0 Bytes
Binary file not shown.

test/base24(xcf).ora

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)