summaryrefslogtreecommitdiff
path: root/lib/sew_stack/stitch_layers/mixins/path.py
blob: 9739f3819b04a2ac796d5d2267d63cd5ff49ef4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from .protocol import LayerProtocol
from ..stitch_layer_editor import Category, Property
from ....i18n import _


class PathPropertiesMixin:
    @classmethod
    def path_properties(cls):
        return Category(_("Path")).children(
            Property("reverse_path", _("Reverse path"), type=bool,
                     help=_("Reverse the path when stitching this layer."))
        )


class PathMixin:
    def get_paths(self: LayerProtocol):
        paths = self.paths

        if self.config.reverse_path:
            paths.reverse()
            for path in paths:
                path.reverse()

        return paths