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:
@@ -27,18 +27,12 @@ This module is obsolete, since Drawing was substituted by TechDraw.
|
||||
# \ingroup DRAFT
|
||||
# \brief This module provides the object code for the Draft DrawingView object.
|
||||
|
||||
import math
|
||||
|
||||
from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
|
||||
import DraftVecUtils
|
||||
|
||||
from getSVG import getSVG
|
||||
import getSVG
|
||||
|
||||
import draftutils.utils as utils
|
||||
|
||||
import draftutils.groups as groups
|
||||
from draftobjects.base import DraftObject
|
||||
|
||||
|
||||
@@ -105,16 +99,16 @@ class DrawingView(DraftObject):
|
||||
svg = ""
|
||||
shapes = []
|
||||
others = []
|
||||
objs = utils.getGroupContents([obj.Source])
|
||||
objs = groups.get_group_contents([obj.Source])
|
||||
for o in objs:
|
||||
v = o.ViewObject.isVisible()
|
||||
if hasattr(obj,"AlwaysOn"):
|
||||
if obj.AlwaysOn:
|
||||
v = True
|
||||
if v:
|
||||
svg += getSVG(o,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc,lp)
|
||||
svg += getSVG.getSVG(o,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc,lp)
|
||||
else:
|
||||
svg = getSVG(obj.Source,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc,lp)
|
||||
svg = getSVG.getSVG(obj.Source,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc,lp)
|
||||
result += '<g id="' + obj.Name + '"'
|
||||
result += ' transform="'
|
||||
result += 'rotate('+str(obj.Rotation)+','+str(obj.X)+','+str(obj.Y)+') '
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user