Draft: move grouping functions to draftutils.groups module

These functions were previously in `draftutils.utils`,
and are related to grouping objects and finding objects
inside groups. These include `get_group_names`, `ungroup`,
`get_windows`, `get_group_contents`, `get_movable_children`.
These are imported in the main `Draft.py` module, so compatibility
is retained.

Modules which use these functions are updated; these include
Gui Commands like `Move`, `Rotate`, `Scale`, `AddToGroup`,
as well as objects like `DrawingView` and `Shape2DView`,
and `ViewProviderClone`.
The code inside the `importDXF` module is also updated.

The Arch Workbench uses many of these functions
but it does so from the `Draft` namespace, so these edits
don't change the situation for these commands.
This commit is contained in:
vocx-fc
2020-06-25 21:34:09 -05:00
committed by Yorik van Havre
parent 3a7751049b
commit 314637e945
14 changed files with 396 additions and 294 deletions

View File

@@ -32,6 +32,7 @@ import FreeCAD as App
import DraftVecUtils
import draftutils.utils as utils
import draftutils.groups as u_groups
import draftutils.gui_utils as gui_utils
from draftutils.translate import translate
@@ -155,7 +156,7 @@ class Shape2DView(DraftObject):
if hasattr(obj.Base,"OnlySolids"):
onlysolids = obj.Base.OnlySolids
import Arch, Part, Drawing
objs = utils.get_group_contents(objs,walls=True)
objs = u_groups.get_group_contents(objs, walls=True)
objs = gui_utils.remove_hidden(objs)
shapes = []
if hasattr(obj,"FuseArch") and obj.FuseArch:
@@ -246,7 +247,7 @@ class Shape2DView(DraftObject):
elif obj.Base.isDerivedFrom("App::DocumentObjectGroup"):
shapes = []
objs = utils.get_group_contents(obj.Base)
objs = u_groups.get_group_contents(obj.Base)
for o in objs:
if hasattr(o,'Shape'):
if o.Shape: