Transfer deprecated decorator on __init__ of Arrange

As it cannot decorate a class.

Also, the deprecated decorator has to be applied before the @classmethod.

CURA-7440
This commit is contained in:
Kostas Karmas 2020-10-13 18:06:44 +02:00
parent 534b8f74a9
commit c54605a134

View file

@ -21,7 +21,6 @@ LocationSuggestion = namedtuple("LocationSuggestion", ["x", "y", "penalty_points
"""Return object for bestSpot""" """Return object for bestSpot"""
@deprecated("Use the functions in Nest2dArrange instead", "4.8")
class Arrange: class Arrange:
""" """
The Arrange classed is used together with :py:class:`cura.Arranging.ShapeArray.ShapeArray`. Use it to find good locations for objects that you try to put The Arrange classed is used together with :py:class:`cura.Arranging.ShapeArray.ShapeArray`. Use it to find good locations for objects that you try to put
@ -34,6 +33,7 @@ class Arrange:
build_volume = None # type: Optional[BuildVolume] build_volume = None # type: Optional[BuildVolume]
@deprecated("Use the functions in Nest2dArrange instead", "4.8")
def __init__(self, x, y, offset_x, offset_y, scale = 0.5): def __init__(self, x, y, offset_x, offset_y, scale = 0.5):
self._scale = scale # convert input coordinates to arrange coordinates self._scale = scale # convert input coordinates to arrange coordinates
world_x, world_y = int(x * self._scale), int(y * self._scale) world_x, world_y = int(x * self._scale), int(y * self._scale)
@ -46,8 +46,8 @@ class Arrange:
self._last_priority = 0 self._last_priority = 0
self._is_empty = True self._is_empty = True
@deprecated("Use the functions in Nest2dArrange instead", "4.8")
@classmethod @classmethod
@deprecated("Use the functions in Nest2dArrange instead", "4.8")
def create(cls, scene_root = None, fixed_nodes = None, scale = 0.5, x = 350, y = 250, min_offset = 8) -> "Arrange": def create(cls, scene_root = None, fixed_nodes = None, scale = 0.5, x = 350, y = 250, min_offset = 8) -> "Arrange":
"""Helper to create an :py:class:`cura.Arranging.Arrange.Arrange` instance """Helper to create an :py:class:`cura.Arranging.Arrange.Arrange` instance