From c417c04188759061288dd432b70882c58e240b4c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 13 Nov 2022 18:52:03 +0000 Subject: [PATCH 1/8] chore(deps): update dependency mkdocstrings-python to ^0.8.0 --- poetry.lock | 17 +++++++++-------- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index a58009b4..b593f006 100644 --- a/poetry.lock +++ b/poetry.lock @@ -296,7 +296,7 @@ typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.8\"" [[package]] name = "griffe" -version = "0.23.0" +version = "0.24.0" description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." category = "dev" optional = false @@ -304,6 +304,7 @@ python-versions = ">=3.7" [package.dependencies] cached-property = {version = "*", markers = "python_version < \"3.8\""} +colorama = ">=0.4" [package.extras] async = ["aiofiles (>=0.7,<1.0)"] @@ -630,14 +631,14 @@ python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"] [[package]] name = "mkdocstrings-python" -version = "0.7.1" +version = "0.8.0" description = "A Python handler for mkdocstrings." category = "dev" optional = false python-versions = ">=3.7" [package.dependencies] -griffe = ">=0.11.1" +griffe = ">=0.24" mkdocstrings = ">=0.19" [[package]] @@ -1100,7 +1101,7 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "1.1" python-versions = ">=3.7,<4.0" -content-hash = "6ff9e191a251c54dbcca7c3dd9e0e9f1b1198f84e7966dfe073f67cd91341006" +content-hash = "50afdf67cf49d1020969d860ae8451205551f3db66ad294e4be726a241a90746" [metadata.files] argcomplete = [ @@ -1270,8 +1271,8 @@ gitpython = [ {file = "GitPython-3.1.29.tar.gz", hash = "sha256:cc36bfc4a3f913e66805a28e84703e419d9c264c1077e537b54f0e1af85dbefd"}, ] griffe = [ - {file = "griffe-0.23.0-py3-none-any.whl", hash = "sha256:cfca5f523808109da3f8cfaa46e325fa2e5bef51120d1146e908c121b56475f0"}, - {file = "griffe-0.23.0.tar.gz", hash = "sha256:a639e2968c8e27f56ebcc57f869a03cea7ac7e7f5684bd2429c665f761c4e7bd"}, + {file = "griffe-0.24.0-py3-none-any.whl", hash = "sha256:6c6b64716155f27ef63377e2b04749079c359f06d9a6e638bb2f885cbe463360"}, + {file = "griffe-0.24.0.tar.gz", hash = "sha256:afa92aeb8c5a4f2501693ffd607f820d7ade3ac2a36e34c43d39ee3486cec392"}, ] htmlmin = [ {file = "htmlmin-0.1.12.tar.gz", hash = "sha256:50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178"}, @@ -1434,8 +1435,8 @@ mkdocstrings = [ {file = "mkdocstrings-0.19.0.tar.gz", hash = "sha256:efa34a67bad11229d532d89f6836a8a215937548623b64f3698a1df62e01cc3e"}, ] mkdocstrings-python = [ - {file = "mkdocstrings-python-0.7.1.tar.gz", hash = "sha256:c334b382dca202dfa37071c182418a6df5818356a95d54362a2b24822ca3af71"}, - {file = "mkdocstrings_python-0.7.1-py3-none-any.whl", hash = "sha256:a22060bfa374697678e9af4e62b020d990dad2711c98f7a9fac5c0345bef93c7"}, + {file = "mkdocstrings-python-0.8.0.tar.gz", hash = "sha256:67f674a8b252fca0b9411c10fb923dd6aacc49ac55c59f738b78b06592ace43d"}, + {file = "mkdocstrings_python-0.8.0-py3-none-any.whl", hash = "sha256:cbee42e53aeaae340d79d72e9bcf42f2b6abe4d11696597c76e3e86a4d9f05a0"}, ] mypy = [ {file = "mypy-0.961-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:697540876638ce349b01b6786bc6094ccdaba88af446a9abb967293ce6eaa2b0"}, diff --git a/pyproject.toml b/pyproject.toml index a3c461eb..7420e17c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ mkdocs = "^1.2.2" mkdocs-git-revision-date-plugin = "^0.3.1" black = "^22.1.0" mkdocs-material = "^8.2.5" -mkdocstrings-python = "^0.7.0" +mkdocstrings-python = "^0.8.0" mkdocs-pymdownx-material-extras = "^2.0" mkdocs-same-dir = "^0.1.1" mkdocs-include-markdown-plugin = "^3.3.0" From 1710d6189c81602324680ee1cdf4bc2f1f4b1562 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 14 Nov 2022 01:43:54 +0000 Subject: [PATCH 2/8] =?UTF-8?q?bump:=20version=200.19.6=20=E2=86=92=200.19?= =?UTF-8?q?.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ photoshop/__version__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd3f2f7c..225b947c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.19.7 (2022-11-14) + +### Fix + +- **deps**: update dependency wheel to ^0.38.0 + ## v0.19.6 (2022-11-06) ### Refactor diff --git a/photoshop/__version__.py b/photoshop/__version__.py index 4c5578cd..08bd98ed 100644 --- a/photoshop/__version__.py +++ b/photoshop/__version__.py @@ -1 +1 @@ -__version__ = "0.19.6" +__version__ = "0.19.7" diff --git a/pyproject.toml b/pyproject.toml index 7420e17c..4015d48f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "photoshop-python-api" -version = "0.19.6" +version = "0.19.7" description = "Python API for Photoshop." homepage = "https://github.com/loonghao/photoshop-python-api" repository = "https://github.com/loonghao/photoshop-python-api" @@ -59,7 +59,7 @@ mkdocs-literate-nav = "^0.5.0" [tool.commitizen] name = "cz_conventional_commits" -version = "0.19.6" +version = "0.19.7" tag_format = "v$version" version_files = [ "pyproject.toml:version", From cb8d380221aacc43d388a7ed7112a15e7d1a99f2 Mon Sep 17 00:00:00 2001 From: longhao Date: Sat, 26 Nov 2022 02:07:49 +0800 Subject: [PATCH 3/8] feat: add a new option for create batch Signed-off-by: longhao --- .gitignore | 1 + examples/run_batch.py | 16 +++++ photoshop/api/__init__.py | 3 +- photoshop/api/application.py | 5 +- photoshop/api/batch_options.py | 119 +++++++++++++++++++++++++++++++++ photoshop/session.py | 2 + 6 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 examples/run_batch.py create mode 100644 photoshop/api/batch_options.py diff --git a/.gitignore b/.gitignore index 2d36bebe..592ac66a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ result/ # Coverage output .coverage /venv/ +venv_python # Docs docs_src/_build/ diff --git a/examples/run_batch.py b/examples/run_batch.py new file mode 100644 index 00000000..5e791397 --- /dev/null +++ b/examples/run_batch.py @@ -0,0 +1,16 @@ +# Import built-in modules +import os + +# Import local modules +from photoshop import Session + + +root = "your/images/root" +files = [] +for name in os.listdir(root): + files.append(os.path.join(root, name)) +with Session() as api: + options = api.BatchOptions() + options.destination = 3 + options.destinationFolder = "c:\\test" + api.app.batch(files=files, actionName="Quadrant Colors", actionSet="Default Actions", options=options) diff --git a/photoshop/api/__init__.py b/photoshop/api/__init__.py index 16e39984..4bfddeb3 100644 --- a/photoshop/api/__init__.py +++ b/photoshop/api/__init__.py @@ -1,11 +1,11 @@ """Python API for Photoshop.""" - # Import local modules from photoshop.api import constants from photoshop.api.action_descriptor import ActionDescriptor from photoshop.api.action_list import ActionList from photoshop.api.action_reference import ActionReference from photoshop.api.application import Application +from photoshop.api.batch_options import BatchOptions from photoshop.api.colors import CMYKColor from photoshop.api.colors import GrayColor from photoshop.api.colors import HSBColor @@ -35,6 +35,7 @@ "ActionReference", "ActionList", "Application", + "BatchOptions", "constants", "enumerations", "PhotoshopPythonAPIError", diff --git a/photoshop/api/application.py b/photoshop/api/application.py index 51f133ed..681874dc 100644 --- a/photoshop/api/application.py +++ b/photoshop/api/application.py @@ -10,7 +10,6 @@ app.documents.add(800, 600, 72, "docRef") """ - # Import built-in modules import os from pathlib import Path @@ -259,13 +258,13 @@ def windowsFileTypes(self): return self.app.windowsFileTypes # Methods. - def batch(self, *args, **kwargs): + def batch(self, files, actionName, actionSet, options): """Runs the batch automation routine. Similar to the **File** > **Automate** > **Batch** command. """ - self.app.bath(*args, **kwargs) + self.app.batch(files, actionName, actionSet, options) def beep(self): """Causes a "beep" sound.""" diff --git a/photoshop/api/batch_options.py b/photoshop/api/batch_options.py new file mode 100644 index 00000000..87156b24 --- /dev/null +++ b/photoshop/api/batch_options.py @@ -0,0 +1,119 @@ +# https://theiviaxx.github.io/photoshop-docs/Photoshop/BatchOptions.html +# Import local modules +from photoshop.api._core import Photoshop + + +class BatchOptions(Photoshop): + object_name = "BatchOptions" + + def __init__(self): + super().__init__() + + @property + def destination(self): + """The type of destination for the processed files.""" + return self.app.destination + + @destination.setter + def destination(self, value): + self.app.destination = value + + @property + def destinationFolder(self): + """The folder location for the processed files. Valid only when β€˜destination’ = folder.""" + return self.app.destinationFolder + + @destinationFolder.setter + def destinationFolder(self, path): + self.app.destinationFolder = path + + @property + def errorFile(self): + """The file in which to log errors encountered. + To display errors on the screen and stop batch processing when errors occur, leave blank.""" + return self.app.errorFile + + @errorFile.setter + def errorFile(self, file_path): + self.app.errorFile = file_path + + @property + def fileNaming(self) -> list: + """A list of file naming options. Maximum: 6.""" + return self.app.fileNaming + + @fileNaming.setter + def fileNaming(self, file_naming: list): + self.app.fileNaming = file_naming + + @property + def macintoshCompatible(self) -> bool: + """If true, the final file names are Macintosh compatible.""" + return self.app.macintoshCompatible + + @macintoshCompatible.setter + def macintoshCompatible(self, value: bool): + self.app.macintoshCompatible = value + + @property + def overrideOpen(self) -> bool: + """If true, overrides action open commands.""" + return self.app.overrideOpen + + @overrideOpen.setter + def overrideOpen(self, value: bool): + self.app.overrideOpen = value + + @property + def overrideSave(self) -> bool: + """If true, overrides save as action steps with the specified destination.""" + return self.app.overrideSave + + @overrideSave.setter + def overrideSave(self, value: bool): + self.app.overrideSave = value + + @property + def startingSerial(self) -> int: + """The starting serial number to use in naming files.""" + return self.app.startingSerial + + @startingSerial.setter + def startingSerial(self, value: int): + self.app.startingSerial = value + + @property + def suppressOpen(self) -> bool: + """If true, suppresses file open options dialogs.""" + return self.app.suppressOpen + + @suppressOpen.setter + def suppressOpen(self, value: bool): + self.app.suppressOpen = value + + @property + def suppressProfile(self) -> bool: + """If true, suppresses color profile warnings.""" + return self.app.suppressProfile + + @suppressProfile.setter + def suppressProfile(self, value: bool): + self.app.suppressProfile = value + + @property + def unixCompatible(self) -> bool: + """If true, the final file names are Unix compatible.""" + return self.app.unixCompatible + + @unixCompatible.setter + def unixCompatible(self, value: bool): + self.app.unixCompatible = value + + @property + def windowsCompatible(self) -> bool: + """If true, the final file names are Windows compatible.""" + return self.app.windowsCompatible + + @windowsCompatible.setter + def windowsCompatible(self, value: bool): + self.app.windowsCompatible = value diff --git a/photoshop/session.py b/photoshop/session.py index 882416d3..d5976e1b 100644 --- a/photoshop/session.py +++ b/photoshop/session.py @@ -35,6 +35,7 @@ from photoshop.api import ActionReference from photoshop.api import Application from photoshop.api import BMPSaveOptions +from photoshop.api import BatchOptions from photoshop.api import CMYKColor from photoshop.api import EPSSaveOptions from photoshop.api import EventID @@ -128,6 +129,7 @@ def __init__( self.EventID = EventID self.SolidColor = SolidColor self.TextItem = TextItem + self.BatchOptions = BatchOptions # The save options. self.GIFSaveOptions = GIFSaveOptions From 674666275f6cdfe577db42924c996f2c2463a4fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 26 Nov 2022 03:45:39 +0000 Subject: [PATCH 4/8] =?UTF-8?q?bump:=20version=200.19.7=20=E2=86=92=200.20?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ photoshop/__version__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 225b947c..9273c1d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.20.0 (2022-11-26) + +### Feat + +- add a new option for create batch + ## v0.19.7 (2022-11-14) ### Fix diff --git a/photoshop/__version__.py b/photoshop/__version__.py index 08bd98ed..5f4bb0b3 100644 --- a/photoshop/__version__.py +++ b/photoshop/__version__.py @@ -1 +1 @@ -__version__ = "0.19.7" +__version__ = "0.20.0" diff --git a/pyproject.toml b/pyproject.toml index 4015d48f..e7369162 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "photoshop-python-api" -version = "0.19.7" +version = "0.20.0" description = "Python API for Photoshop." homepage = "https://github.com/loonghao/photoshop-python-api" repository = "https://github.com/loonghao/photoshop-python-api" @@ -59,7 +59,7 @@ mkdocs-literate-nav = "^0.5.0" [tool.commitizen] name = "cz_conventional_commits" -version = "0.19.7" +version = "0.20.0" tag_format = "v$version" version_files = [ "pyproject.toml:version", From 561625612e2d331fed53de02face3d3aabf787d6 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 04:24:07 +0000 Subject: [PATCH 5/8] docs: update README.md [skip ci] --- README.md | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index cdacd660..0ef4ed18 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ -[![All Contributors](https://img.shields.io/badge/all_contributors-15-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-)

@@ -122,27 +122,30 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +

Hal

πŸ’»

voodraizer

πŸ›

brunosly

πŸ›

tubi

πŸ›

wjxiehaixin

πŸ›

η½—ι©¬ι’Ÿ

πŸ›

clement

πŸ›

krevlinmen

πŸ›

Thomas

πŸ›

CaptainCsaba

πŸ›

Il Harper

πŸ’»

blunderedbishop

πŸ›

MrTeferi

πŸ’»

Damien Chambe

πŸ’»

Ehsan Akbari Tabar

πŸ›
Hal
Hal

πŸ’»
voodraizer
voodraizer

πŸ›
brunosly
brunosly

πŸ›
tubi
tubi

πŸ›
wjxiehaixin
wjxiehaixin

πŸ›
η½—ι©¬ι’Ÿ
η½—ι©¬ι’Ÿ

πŸ›
clement
clement

πŸ›
krevlinmen
krevlinmen

πŸ›
Thomas
Thomas

πŸ›
CaptainCsaba
CaptainCsaba

πŸ›
Il Harper
Il Harper

πŸ’»
blunderedbishop
blunderedbishop

πŸ›
MrTeferi
MrTeferi

πŸ’»
Damien Chambe
Damien Chambe

πŸ’»
Ehsan Akbari Tabar
Ehsan Akbari Tabar

πŸ›
Michael Ikemann
Michael Ikemann

πŸ›
From 1942e9bbd4fd5c4734c29c5dad21ffdd6f505aa5 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 04:24:08 +0000 Subject: [PATCH 6/8] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b59bb804..6c1ad3e0 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -145,6 +145,15 @@ "contributions": [ "bug" ] + }, + { + "login": "Alyxion", + "name": "Michael Ikemann", + "avatar_url": "https://avatars.githubusercontent.com/u/33489959?v=4", + "profile": "http://www.linkedin.com/in/michael-ikemann", + "contributions": [ + "bug" + ] } ], "skipCi": true From 129ff7127431d109c545dd00813e5542f6f4b04a Mon Sep 17 00:00:00 2001 From: MrTeferi Date: Sun, 27 Nov 2022 17:18:46 -0600 Subject: [PATCH 7/8] refactor(action_descriptor): Fix type hints for doubles Doubles are akin to float in Python Signed-off-by: MrTeferi --- photoshop/api/action_descriptor.py | 8 ++++---- test/manual_test/manual_test_all_examples.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/photoshop/api/action_descriptor.py b/photoshop/api/action_descriptor.py index d0da601f..e651b38e 100644 --- a/photoshop/api/action_descriptor.py +++ b/photoshop/api/action_descriptor.py @@ -79,7 +79,7 @@ def getData(self, key: int) -> int: """Gets raw byte data as a string value.""" return self.app.getData(key) - def getDouble(self, key: int) -> int: + def getDouble(self, key: int) -> float: """Gets the value of a key of type double.""" return self.app.getDouble(key) @@ -135,7 +135,7 @@ def getUnitDoubleType(self, key: int) -> int: """Gets the unit type of a key of type UnitDouble.""" return self.app.getUnitDoubleType(key) - def getUnitDoubleValue(self, key: int) -> int: + def getUnitDoubleValue(self, key: int) -> float: """Gets the unit type of a key of type UnitDouble.""" return self.app.getUnitDoubleValue(key) @@ -164,7 +164,7 @@ def putData(self, key: int, value: str): """Puts raw byte data as a string value.""" self.app.putData(key, value) - def putDouble(self, key: int, value: int): + def putDouble(self, key: int, value: float): """Sets the value for a key whose type is double.""" self.app.putDouble(key, value) @@ -200,7 +200,7 @@ def putString(self, key: int, value: str): """Sets the value for a key whose type is string.""" self.app.putString(key, value) - def putUnitDouble(self, key: int, unit_id: int, value: int): + def putUnitDouble(self, key: int, unit_id: int, value: float): """Sets the value for a key whose type is a unit value formatted as double.""" self.app.putUnitDouble(key, unit_id, value) diff --git a/test/manual_test/manual_test_all_examples.py b/test/manual_test/manual_test_all_examples.py index c8b7e5ec..a21a0190 100644 --- a/test/manual_test/manual_test_all_examples.py +++ b/test/manual_test/manual_test_all_examples.py @@ -1,8 +1,11 @@ """Manual test all examples.""" +# Import built-in modules +from pathlib import Path + # Import local modules from photoshop.api import Application -from pathlib import Path + root = Path(__file__).parent.parent.parent.joinpath("examples") for script_file in root.glob("*.py"): From e93d290a82c7c185ff49361bb7d631b0db9bdf29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 28 Nov 2022 02:05:05 +0000 Subject: [PATCH 8/8] =?UTF-8?q?bump:=20version=200.20.0=20=E2=86=92=200.20?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ photoshop/__version__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9273c1d7..1bbc9251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.20.1 (2022-11-28) + +### Refactor + +- **action_descriptor**: Fix type hints for doubles + ## v0.20.0 (2022-11-26) ### Feat diff --git a/photoshop/__version__.py b/photoshop/__version__.py index 5f4bb0b3..ac824046 100644 --- a/photoshop/__version__.py +++ b/photoshop/__version__.py @@ -1 +1 @@ -__version__ = "0.20.0" +__version__ = "0.20.1" diff --git a/pyproject.toml b/pyproject.toml index e7369162..32564ac1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "photoshop-python-api" -version = "0.20.0" +version = "0.20.1" description = "Python API for Photoshop." homepage = "https://github.com/loonghao/photoshop-python-api" repository = "https://github.com/loonghao/photoshop-python-api" @@ -59,7 +59,7 @@ mkdocs-literate-nav = "^0.5.0" [tool.commitizen] name = "cz_conventional_commits" -version = "0.20.0" +version = "0.20.1" tag_format = "v$version" version_files = [ "pyproject.toml:version",