From 11591ce96da5eebc0d0c328a0d4cafb749ec454d Mon Sep 17 00:00:00 2001 From: MrTeferi Date: Mon, 16 May 2022 17:59:18 -0500 Subject: [PATCH] fix(ArtLayer,-LayerSet): adjusted linkedLayers property, fixed remove() changed remove to use built in method delete() instead of javascript eval for better target accuracy --- photoshop/api/_artlayer.py | 6 +++--- photoshop/api/_layerSet.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/photoshop/api/_artlayer.py b/photoshop/api/_artlayer.py index 2450210d..0be4b099 100644 --- a/photoshop/api/_artlayer.py +++ b/photoshop/api/_artlayer.py @@ -41,7 +41,7 @@ def linkedLayers(self) -> list: Returns: list: Layer objects""" - return list(self.app.linkedLayers) + return [ArtLayer(layer) for layer in self.app.linkedLayers] @property def name(self) -> str: @@ -459,8 +459,8 @@ def applyPinch(self, amount): self.app.applyPinch(amount) def remove(self): - layer = f'app.activeDocument.artLayers.getByName("{self.app.name}")' - self.eval_javascript(f"{layer}.remove()") + """Removes this layer from the document.""" + self.app.delete() def rasterize(self, target: RasterizeType): self.app.rasterize(target) diff --git a/photoshop/api/_layerSet.py b/photoshop/api/_layerSet.py index 2e61199e..30490ec3 100644 --- a/photoshop/api/_layerSet.py +++ b/photoshop/api/_layerSet.py @@ -110,8 +110,8 @@ def move(self, relativeObject, insertionLocation): self.app.move(relativeObject, insertionLocation) def remove(self): - layer = f'app.activeDocument.layerSets.getByName("{self.app.name}")' - self.eval_javascript(f"{layer}.remove()") + """Remove this layer set from the document.""" + self.app.delete() def resize(self, horizontal=None, vertical=None, anchor: AnchorPosition = None): self.app.resize(horizontal, vertical, anchor)