Skip to content

layerComp

LayerComp

Bases: Photoshop

A snapshot of a state of the layers in a document (can be used to view different page layouts or compostions).

Source code in photoshop/api/_layerComp.py
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
class LayerComp(Photoshop):
    """A snapshot of a state of the layers in a document (can be used to view different page layouts or compostions)."""

    def __init__(self, parent):
        super().__init__(parent=parent)
        self._flag_as_method(
            "apply",
            "recapture",
            "remove",
            "resetfromComp",
        )

    def __len__(self):
        return self.length

    @property
    def appearance(self):
        return self.app.appearance

    @appearance.setter
    def appearance(self, value):
        self.app.appearance = value

    @property
    def childLayerCompState(self):
        return self.app.childLayerCompState

    @childLayerCompState.setter
    def childLayerCompState(self, value):
        self.app.childLayerCompState = value

    @property
    def comment(self):
        return self.app.comment

    @comment.setter
    def comment(self, text):
        self.app.comment = text

    @property
    def name(self):
        return self.app.name

    @name.setter
    def name(self, text):
        self.app.name = text

    @property
    def parent(self):
        return self.app.parent

    @property
    def position(self):
        return self.app.position

    @position.setter
    def position(self, value):
        self.app.position = value

    @property
    def selected(self):
        """True if the layer comp is currently selected."""
        return self.app.selected

    @selected.setter
    def selected(self, value):
        self.app.selected = value

    @property
    def typename(self):
        return self.app.typename

    @property
    def visibility(self):
        """True to use layer visibility settings."""
        return self.app.visibility

    @visibility.setter
    def visibility(self, value):
        self.app.visibility = value

    def apply(self):
        """Applies the layer comp to the document."""
        self.app.apply()

    def recapture(self):
        """Recaptures the current layer state(s) for this layer comp."""
        self.app.recapture()

    def remove(self):
        """Deletes the layerComp object."""
        self.app.remove()

    def resetfromComp(self):
        """Resets the layer comp state to thedocument state."""
        self.app.resetfromComp()

selected property writable

True if the layer comp is currently selected.

visibility property writable

True to use layer visibility settings.

apply()

Applies the layer comp to the document.

Source code in photoshop/api/_layerComp.py
86
87
88
def apply(self):
    """Applies the layer comp to the document."""
    self.app.apply()

recapture()

Recaptures the current layer state(s) for this layer comp.

Source code in photoshop/api/_layerComp.py
90
91
92
def recapture(self):
    """Recaptures the current layer state(s) for this layer comp."""
    self.app.recapture()

remove()

Deletes the layerComp object.

Source code in photoshop/api/_layerComp.py
94
95
96
def remove(self):
    """Deletes the layerComp object."""
    self.app.remove()

resetfromComp()

Resets the layer comp state to thedocument state.

Source code in photoshop/api/_layerComp.py
 98
 99
100
def resetfromComp(self):
    """Resets the layer comp state to thedocument state."""
    self.app.resetfromComp()

Last update: 2024-11-17
Created: 2024-11-17