Browse Source

Add deprecated tag to arranger

CURA-7440
Jaime van Kessel 4 years ago
parent
commit
9312dc5c07
3 changed files with 7 additions and 7 deletions
  1. 4 0
      cura/Arranging/Arrange.py
  2. 3 2
      cura/CuraApplication.py
  3. 0 5
      cura/MultiplyObjectsJob.py

+ 4 - 0
cura/Arranging/Arrange.py

@@ -2,6 +2,7 @@
 # Cura is released under the terms of the LGPLv3 or higher.
 from typing import Optional
 
+from UM.Decorators import deprecated
 from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
 from UM.Logger import Logger
 from UM.Math.Polygon import Polygon
@@ -20,6 +21,7 @@ LocationSuggestion = namedtuple("LocationSuggestion", ["x", "y", "penalty_points
 """Return object for  bestSpot"""
 
 
+@deprecated("Use the functions in Nest2dArrange instead", "4.8")
 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
@@ -44,6 +46,7 @@ class Arrange:
         self._last_priority = 0
         self._is_empty = True
 
+    @deprecated("Use the functions in Nest2dArrange instead", "4.8")
     @classmethod
     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
@@ -101,6 +104,7 @@ class Arrange:
 
         self._last_priority = 0
 
+    @deprecated("Use the functions in Nest2dArrange instead", "4.8")
     def findNodePlacement(self, node: SceneNode, offset_shape_arr: ShapeArray, hull_shape_arr: ShapeArray, step = 1) -> bool:
         """Find placement for a node (using offset shape) and place it (using hull shape)
 

+ 3 - 2
cura/CuraApplication.py

@@ -52,8 +52,7 @@ from cura.API.Account import Account
 from cura.Arranging.Arrange import Arrange
 from cura.Arranging.ArrangeObjectsAllBuildPlatesJob import ArrangeObjectsAllBuildPlatesJob
 from cura.Arranging.ArrangeObjectsJob import ArrangeObjectsJob
-from cura.Arranging.ShapeArray import ShapeArray
-from cura.Arranging.Nest2DArrange import findNodePlacement, arrange
+from cura.Arranging.Nest2DArrange import arrange
 from cura.Machines.MachineErrorChecker import MachineErrorChecker
 from cura.Machines.Models.BuildPlateModel import BuildPlateModel
 from cura.Machines.Models.CustomQualityProfilesDropDownMenuModel import CustomQualityProfilesDropDownMenuModel
@@ -802,6 +801,8 @@ class CuraApplication(QtApplication):
         self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing build volume..."))
         root = self.getController().getScene().getRoot()
         self._volume = BuildVolume.BuildVolume(self, root)
+
+        # Ensure that the old style arranger still works.
         Arrange.build_volume = self._volume
 
         # initialize info objects

+ 0 - 5
cura/MultiplyObjectsJob.py

@@ -4,8 +4,6 @@
 import copy
 from typing import List
 
-from PyQt5.QtCore import QCoreApplication
-
 from UM.Job import Job
 from UM.Math.Matrix import Matrix
 from UM.Math.Quaternion import Quaternion
@@ -21,9 +19,6 @@ from cura.Arranging.Nest2DArrange import findNodePlacement
 
 i18n_catalog = i18nCatalog("cura")
 
-from cura.Arranging.Arrange import Arrange
-from cura.Arranging.ShapeArray import ShapeArray
-
 from UM.Application import Application
 from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation