From 889ad11e0237e635147a1149ced408df0db4a6fb Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Mon, 3 Apr 2023 16:36:23 +0200 Subject: [PATCH] [Draft] Remove obsolete code related to Drawing WB * [Draft] Remove obsolete code related to Drawing WB remove unused elif * [Draft] Remove obsolete code related to the Drawing WB * Update preferences-draftvisual.ui Also remove the template label. * Update utils.py Remove reference to "template" * Remove Draft_Drawing.svg from Draft.qrc --------- Co-authored-by: Roy-043 Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com> --- src/Mod/Draft/CMakeLists.txt | 3 - src/Mod/Draft/Draft.py | 6 +- src/Mod/Draft/DraftGui.py | 3 +- src/Mod/Draft/DraftTools.py | 1 - src/Mod/Draft/Resources/Draft.qrc | 1 - .../Draft/Resources/icons/Draft_AutoGroup.svg | 2 +- .../Resources/icons/Draft_AutoGroup_off.svg | 2 +- .../Resources/icons/Draft_AutoGroup_on.svg | 2 +- .../Draft/Resources/icons/Draft_Drawing.svg | 522 ------------------ .../Resources/ui/preferences-draftvisual.ui | 43 -- src/Mod/Draft/draftfunctions/heal.py | 4 +- src/Mod/Draft/draftguitools/gui_drawing.py | 148 ----- src/Mod/Draft/draftmake/make_drawingview.py | 111 ---- src/Mod/Draft/draftobjects/drawingview.py | 192 ------- src/Mod/Draft/draftutils/utils.py | 2 +- src/Mod/Draft/importSVG.py | 2 +- 16 files changed, 8 insertions(+), 1036 deletions(-) delete mode 100644 src/Mod/Draft/Resources/icons/Draft_Drawing.svg delete mode 100644 src/Mod/Draft/draftguitools/gui_drawing.py delete mode 100644 src/Mod/Draft/draftmake/make_drawingview.py delete mode 100644 src/Mod/Draft/draftobjects/drawingview.py diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index 1495c32b0c..4fbf840f3d 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -115,7 +115,6 @@ SET(Draft_make_functions draftmake/make_clone.py draftmake/make_copy.py draftmake/make_dimension.py - draftmake/make_drawingview.py draftmake/make_ellipse.py draftmake/make_facebinder.py draftmake/make_fillet.py @@ -148,7 +147,6 @@ SET(Draft_objects draftobjects/bspline.py draftobjects/circle.py draftobjects/clone.py - draftobjects/drawingview.py draftobjects/ellipse.py draftobjects/facebinder.py draftobjects/draft_annotation.py @@ -231,7 +229,6 @@ SET(Modifier_tools draftguitools/gui_downgrade.py draftguitools/gui_trimex.py draftguitools/gui_scale.py - draftguitools/gui_drawing.py draftguitools/gui_wire2spline.py draftguitools/gui_shape2dview.py draftguitools/gui_draft2sketch.py diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 98b636e273..f4d0c86551 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -219,11 +219,7 @@ from draftmake.make_circle import (make_circle, # arcs from draftmake.make_arc_3points import make_arc_3points -# drawing: obsolete since Drawing was replaced by TechDraw -from draftobjects.drawingview import (DrawingView, - _DrawingView) -from draftmake.make_drawingview import (make_drawing_view, - makeDrawingView) + # ellipse from draftobjects.ellipse import (Ellipse, diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 9b28c01b72..c02bd059dd 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -1688,8 +1688,7 @@ class DraftToolBar: self.commands = ["Draft_Move","Draft_Rotate", "Draft_Scale","Draft_Offset", "Draft_Trimex","Draft_Upgrade", - "Draft_Downgrade","Draft_Edit", - "Draft_Drawing"] + "Draft_Downgrade","Draft_Edit"] self.title = "Modify objects" def shouldShow(self): return (FreeCAD.ActiveDocument is not None) and (FreeCADGui.Selection.getSelection() != []) diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index f0cef4e713..c15181fb91 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -184,7 +184,6 @@ from draftguitools.gui_upgrade import Upgrade from draftguitools.gui_downgrade import Downgrade from draftguitools.gui_trimex import Trimex from draftguitools.gui_scale import Scale -from draftguitools.gui_drawing import Drawing from draftguitools.gui_wire2spline import WireToBSpline from draftguitools.gui_shape2dview import Shape2DView from draftguitools.gui_draft2sketch import Draft2Sketch diff --git a/src/Mod/Draft/Resources/Draft.qrc b/src/Mod/Draft/Resources/Draft.qrc index 7907e7423e..d068ab0935 100644 --- a/src/Mod/Draft/Resources/Draft.qrc +++ b/src/Mod/Draft/Resources/Draft.qrc @@ -35,7 +35,6 @@ icons/Draft_Downgrade.svg icons/Draft_Draft.svg icons/Draft_Draft2Sketch.svg - icons/Draft_Drawing.svg icons/Draft_Edit.svg icons/Draft_Ellipse.svg icons/Draft_Facebinder.svg diff --git a/src/Mod/Draft/Resources/icons/Draft_AutoGroup.svg b/src/Mod/Draft/Resources/icons/Draft_AutoGroup.svg index 390e37b2c8..3db16c7373 100644 --- a/src/Mod/Draft/Resources/icons/Draft_AutoGroup.svg +++ b/src/Mod/Draft/Resources/icons/Draft_AutoGroup.svg @@ -374,7 +374,7 @@ FreeCAD - FreeCAD/src/Mod/Draft/Resources/icons/Draft_Drawing.svg + FreeCAD/src/Mod/Draft/Resources/icons/Draft_AutoGroup.svg http://www.freecadweb.org/wiki/index.php?title=Artwork diff --git a/src/Mod/Draft/Resources/icons/Draft_AutoGroup_off.svg b/src/Mod/Draft/Resources/icons/Draft_AutoGroup_off.svg index ef6b836177..16390e3a36 100644 --- a/src/Mod/Draft/Resources/icons/Draft_AutoGroup_off.svg +++ b/src/Mod/Draft/Resources/icons/Draft_AutoGroup_off.svg @@ -370,7 +370,7 @@ FreeCAD - FreeCAD/src/Mod/Draft/Resources/icons/Draft_Drawing.svg + FreeCAD/src/Mod/Draft/Resources/icons/Draft_AutoGroup_off.svg http://www.freecadweb.org/wiki/index.php?title=Artwork diff --git a/src/Mod/Draft/Resources/icons/Draft_AutoGroup_on.svg b/src/Mod/Draft/Resources/icons/Draft_AutoGroup_on.svg index bab1228c99..dbeb71dd83 100644 --- a/src/Mod/Draft/Resources/icons/Draft_AutoGroup_on.svg +++ b/src/Mod/Draft/Resources/icons/Draft_AutoGroup_on.svg @@ -345,7 +345,7 @@ FreeCAD - FreeCAD/src/Mod/Draft/Resources/icons/Draft_Drawing.svg + FreeCAD/src/Mod/Draft/Resources/icons/Draft_AutoGroup_on.svg http://www.freecadweb.org/wiki/index.php?title=Artwork diff --git a/src/Mod/Draft/Resources/icons/Draft_Drawing.svg b/src/Mod/Draft/Resources/icons/Draft_Drawing.svg deleted file mode 100644 index feca8eafe5..0000000000 --- a/src/Mod/Draft/Resources/icons/Draft_Drawing.svg +++ /dev/null @@ -1,522 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Mon Oct 10 13:44:52 2011 +0000 - - - [wmayer] - - - - - FreeCAD LGPL2+ - - - - - FreeCAD - - - FreeCAD/src/Mod/Draft/Resources/icons/Draft_Drawing.svg - http://www.freecadweb.org/wiki/index.php?title=Artwork - - - [agryson] Alexander Gryson - - - - - arrow - page - shapes - - - An arrow pointing from left to right onto a page with shapes drawn on it - - - - diff --git a/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui b/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui index b8cda91542..c3decd2da0 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui @@ -143,49 +143,6 @@ - - - - - - Default template sheet - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 300 - 0 - - - - The default template to use when creating a new drawing sheet - - - template - - - Mod/Draft - - - - - diff --git a/src/Mod/Draft/draftfunctions/heal.py b/src/Mod/Draft/draftfunctions/heal.py index 0e3c01ac72..4ec4a1c5c1 100644 --- a/src/Mod/Draft/draftfunctions/heal.py +++ b/src/Mod/Draft/draftfunctions/heal.py @@ -70,7 +70,7 @@ def heal(objlist=None, delete=True, reparent=True): for obj in objlist: dtype = utils.get_type(obj) ftype = obj.TypeId - if ftype in ["Part::FeaturePython","App::FeaturePython","Part::Part2DObjectPython","Drawing::FeatureViewPython"]: + if ftype in ["Part::FeaturePython","App::FeaturePython","Part::Part2DObjectPython"]: proxy = obj.Proxy if hasattr(obj,"ViewObject"): if hasattr(obj.ViewObject,"Proxy"): @@ -98,8 +98,6 @@ def heal(objlist=None, delete=True, reparent=True): elif ("DrawMode" in props) and ("FacesNumber" in props): print("Healing " + obj.Name + " of type Polygon") nobj = make_copy(obj,force="Polygon",reparent=reparent) - elif ("FillStyle" in props) and ("FontSize" in props): - nobj = make_copy(obj,force="DrawingView",reparent=reparent) else: dellist.pop() print("Object " + obj.Name + " is not healable") diff --git a/src/Mod/Draft/draftguitools/gui_drawing.py b/src/Mod/Draft/draftguitools/gui_drawing.py deleted file mode 100644 index 107cd875d1..0000000000 --- a/src/Mod/Draft/draftguitools/gui_drawing.py +++ /dev/null @@ -1,148 +0,0 @@ -# *************************************************************************** -# * (c) 2009, 2010 Yorik van Havre * -# * (c) 2009, 2010 Ken Cline * -# * (c) 2020 Eliud Cabrera Castillo * -# * * -# * This file is part of the FreeCAD CAx development system. * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * FreeCAD is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with FreeCAD; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** -"""Provides GUI tools to project an object into a Drawing Workbench page. - -This commands takes a 2D geometrical element and creates a projection -that is displayed in a drawing page in the Drawing Workbench. - -This command should be considered obsolete as the Drawing Workbench -is obsolete since 0.17. - -A similar command is not planned for the TechDraw Workbench because -it is not really necessary. TechDraw has its own set of tools -to create 2D projections of 2D and 3D objects. -""" -## @package gui_drawing -# \ingroup draftguitools -# \brief Provides GUI tools to project an object into a Drawing Workbench page. - -## \addtogroup draftguitools -# @{ -from PySide.QtCore import QT_TRANSLATE_NOOP - -import FreeCAD as App -import FreeCADGui as Gui -import Draft_rc -import Draft -import draftutils.utils as utils -import draftguitools.gui_base_original as gui_base_original -import draftguitools.gui_tool_utils as gui_tool_utils -from draftutils.messages import _msg, _wrn -from draftutils.translate import translate - -# The module is used to prevent complaints from code checkers (flake8) -True if Draft_rc.__name__ else False - - -class Drawing(gui_base_original.Modifier): - """Gui Command for the Drawing tool. - - This command should be considered obsolete as the Drawing Workbench - is obsolete since 0.17. - """ - - def GetResources(self): - """Set icon, menu and tooltip.""" - - return {'Pixmap': 'Draft_Drawing', - # 'Accel': "D, D", - 'MenuText': QT_TRANSLATE_NOOP("Draft_Drawing", "Drawing"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_Drawing", "Creates a 2D projection on a Drawing Workbench page from the selected objects.\nThis command is OBSOLETE since the Drawing Workbench became obsolete in 0.17.\nUse TechDraw Workbench instead for generating technical drawings.")} - - def Activated(self): - """Execute when the command is called.""" - super(Drawing, self).Activated(name="Drawing") - _wrn(translate("draft","The Drawing Workbench is obsolete since 0.17, consider using the TechDraw Workbench instead.")) - if not Gui.Selection.getSelection(): - self.ghost = None - self.ui.selectUi() - _msg(translate("draft", "Select an object to project")) - self.call = \ - self.view.addEventCallback("SoEvent", - gui_tool_utils.selectObject) - else: - self.proceed() - - def proceed(self): - """Proceed with execution of the command after proper selection.""" - if self.call: - self.view.removeEventCallback("SoEvent", self.call) - - sel = Gui.Selection.getSelection() - if not sel: - self.page = self.createDefaultPage() - else: - self.page = None - # if the user selected a page, put the objects on that page - for obj in sel: - if obj.isDerivedFrom("Drawing::FeaturePage"): - self.page = obj - break - if not self.page: - # no page selected, default to the first page in the document - for obj in self.doc.Objects: - if obj.isDerivedFrom("Drawing::FeaturePage"): - self.page = obj - break - if not self.page: - # no page in the document, create a default page. - self.page = self.createDefaultPage() - otherProjection = None - # if an existing projection is selected, - # reuse its projection properties - for obj in sel: - if obj.isDerivedFrom("Drawing::FeatureView"): - otherProjection = obj - break - sel.reverse() - for obj in sel: - if (obj.ViewObject.isVisible() - and not obj.isDerivedFrom("Drawing::FeatureView") - and not obj.isDerivedFrom("Drawing::FeaturePage")): - # name = 'View' + obj.Name - # no reason to remove the old one... - # oldobj = self.page.getObject(name) - # if oldobj: - # self.doc.removeObject(oldobj.Name) - Draft.make_drawing_view(obj, self.page, - otherProjection=otherProjection) - self.doc.recompute() - - def createDefaultPage(self): - """Create a default Drawing Workbench page.""" - _t = App.getResourceDir() + 'Mod/Drawing/Templates/A3_Landscape.svg' - template = utils.getParam("template", _t) - page = self.doc.addObject('Drawing::FeaturePage', 'Page') - page.ViewObject.HintOffsetX = 200 - page.ViewObject.HintOffsetY = 100 - page.ViewObject.HintScale = 2 - page.Template = template - self.doc.recompute() - return page - - -Gui.addCommand('Draft_Drawing', Drawing()) - -## @} diff --git a/src/Mod/Draft/draftmake/make_drawingview.py b/src/Mod/Draft/draftmake/make_drawingview.py deleted file mode 100644 index c7a7d9c37b..0000000000 --- a/src/Mod/Draft/draftmake/make_drawingview.py +++ /dev/null @@ -1,111 +0,0 @@ -# *************************************************************************** -# * Copyright (c) 2009, 2010 Yorik van Havre * -# * Copyright (c) 2009, 2010 Ken Cline * -# * Copyright (c) 2020 FreeCAD Developers * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** -"""Provides functions to create DrawingView objects. - -These functions must be considered obsolete as the Drawing Workbench -is obsolete since v0.17. -""" -## @package make_drawingview -# \ingroup draftmake -# \brief Provides functions to create DrawingView objects. - -## \addtogroup draftmake -# @{ -import FreeCAD as App -import draftutils.utils as utils - -from draftobjects.drawingview import DrawingView - - -def make_drawing_view(obj, page, lwmod=None, tmod=None, otherProjection=None): - """ - make_drawing_view(object,page,[lwmod,tmod]) - - This function is OBSOLETE, since TechDraw substituted the Drawing Workbench. - Add a View of the given object to the given page. - - Parameters - ---------- - lwmod : - modifies lineweights (in percent), - - tmod : - modifies text heights (in percent). - - The Hint scale, X and Y of the page are used. - TODO: Document it properly - """ - if not App.ActiveDocument: - App.Console.PrintError("No active document. Aborting\n") - return - if utils.get_type(obj) == "SectionPlane": - import ArchSectionPlane - viewobj = App.ActiveDocument.addObject("Drawing::FeatureViewPython","View") - page.addObject(viewobj) - ArchSectionPlane._ArchDrawingView(viewobj) - viewobj.Source = obj - viewobj.Label = "View of "+obj.Name - elif utils.get_type(obj) == "Panel": - import ArchPanel - viewobj = ArchPanel.makePanelView(obj, page) - else: - viewobj = App.ActiveDocument.addObject("Drawing::FeatureViewPython", - "View"+ obj.Name) - DrawingView(viewobj) - page.addObject(viewobj) - if (otherProjection): - if hasattr(otherProjection,"Scale"): - viewobj.Scale = otherProjection.Scale - if hasattr(otherProjection,"X"): - viewobj.X = otherProjection.X - if hasattr(otherProjection,"Y"): - viewobj.Y = otherProjection.Y - if hasattr(otherProjection,"Rotation"): - viewobj.Rotation = otherProjection.Rotation - if hasattr(otherProjection,"Direction"): - viewobj.Direction = otherProjection.Direction - else: - if hasattr(page.ViewObject,"HintScale"): - viewobj.Scale = page.ViewObject.HintScale - if hasattr(page.ViewObject,"HintOffsetX"): - viewobj.X = page.ViewObject.HintOffsetX - if hasattr(page.ViewObject,"HintOffsetY"): - viewobj.Y = page.ViewObject.HintOffsetY - viewobj.Source = obj - if lwmod: viewobj.LineweightModifier = lwmod - if tmod: viewobj.TextModifier = tmod - if hasattr(obj.ViewObject,"Pattern"): - if str(obj.ViewObject.Pattern) in list(utils.svgpatterns().keys()): - viewobj.FillStyle = str(obj.ViewObject.Pattern) - if hasattr(obj.ViewObject,"DrawStyle"): - viewobj.LineStyle = obj.ViewObject.DrawStyle - if hasattr(obj.ViewObject,"LineColor"): - viewobj.LineColor = obj.ViewObject.LineColor - elif hasattr(obj.ViewObject,"TextColor"): - viewobj.LineColor = obj.ViewObject.TextColor - return viewobj - - -makeDrawingView = make_drawing_view - -## @} diff --git a/src/Mod/Draft/draftobjects/drawingview.py b/src/Mod/Draft/draftobjects/drawingview.py deleted file mode 100644 index 015460cec2..0000000000 --- a/src/Mod/Draft/draftobjects/drawingview.py +++ /dev/null @@ -1,192 +0,0 @@ -# *************************************************************************** -# * Copyright (c) 2009, 2010 Yorik van Havre * -# * Copyright (c) 2009, 2010 Ken Cline * -# * Copyright (c) 2020 Eliud Cabrera Castillo * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** -"""Provides the object code for the DrawingView object (OBSOLETE). - -This module is obsolete, since the Drawing Workbench stopped -being developed in v0.17. -The TechDraw Workbench replaces Drawing, and it no longer requires -a `DrawingView` object to display objects in a drawing sheet. - -This module is still provided in order to be able to open older files -that use this `DrawingView` object. However, a GUI tool to create -this object should no longer be available. -""" -## @package drawingview -# \ingroup draftobjects -# \brief Provides the object code for the DrawingView object (OBSOLETE). - -## \addtogroup draftobjects -# @{ -from PySide.QtCore import QT_TRANSLATE_NOOP - -import draftfunctions.svg as get_svg -import draftfunctions.dxf as get_dxf -import draftutils.utils as utils -import draftutils.groups as groups - -from draftobjects.base import DraftObject - - -class DrawingView(DraftObject): - """The DrawingView object. This class is OBSOLETE. - - This object was used with the Drawing Workbench, but since this workbench - because obsolete in v0.17, the object should no longer be used. - It is retained for compatibility purposes, that is, to open older - files that may contain this object. - - To produce 2D drawings, use TechDraw Workbench. - """ - - def __init__(self, obj): - super(DrawingView, self).__init__(obj, "DrawingView") - - _tip = QT_TRANSLATE_NOOP("App::Property", - "The linked object") - obj.addProperty("App::PropertyLink", - "Source", - "Base", - _tip) - - _tip = QT_TRANSLATE_NOOP("App::Property", - "Projection direction") - obj.addProperty("App::PropertyVector", - "Direction", - "Shape View", - _tip) - - _tip = QT_TRANSLATE_NOOP("App::Property", - "The width of the lines inside this object") - obj.addProperty("App::PropertyFloat", - "LineWidth", - "View Style", - _tip) - obj.LineWidth = 0.35 - - _tip = QT_TRANSLATE_NOOP("App::Property", - "The size of the texts inside this object") - obj.addProperty("App::PropertyLength", - "FontSize", - "View Style", - _tip) - obj.FontSize = 12 - - _tip = QT_TRANSLATE_NOOP("App::Property", - "The spacing between lines of text") - obj.addProperty("App::PropertyLength", - "LineSpacing", - "View Style", - _tip) - - _tip = QT_TRANSLATE_NOOP("App::Property", - "The color of the projected objects") - obj.addProperty("App::PropertyColor", - "LineColor", - "View Style", - _tip) - - _tip = QT_TRANSLATE_NOOP("App::Property", - "Shape Fill Style") - obj.addProperty("App::PropertyEnumeration", - "FillStyle", - "View Style", - _tip) - obj.FillStyle = ['shape color'] + list(utils.svgpatterns().keys()) - - _tip = QT_TRANSLATE_NOOP("App::Property", - "Line Style") - obj.addProperty("App::PropertyEnumeration", - "LineStyle", - "View Style", - _tip) - obj.LineStyle = ['Solid', 'Dashed', 'Dotted', 'Dashdot'] - - _tip = QT_TRANSLATE_NOOP("App::Property", - "If checked, source objects are displayed " - "regardless of being visible in the 3D model") - obj.addProperty("App::PropertyBool", - "AlwaysOn", - "View Style", - _tip) - - def execute(self, obj): - """Execute when the object is created or recomputed.""" - result = "" - if hasattr(obj, "Source") and obj.Source: - if hasattr(obj, "LineStyle"): - ls = obj.LineStyle - else: - ls = None - if hasattr(obj, "LineColor"): - lc = obj.LineColor - else: - lc = None - if hasattr(obj, "LineSpacing"): - lp = obj.LineSpacing - else: - lp = None - - if obj.Source.isDerivedFrom("App::DocumentObjectGroup"): - svg = "" - objs = groups.get_group_contents([obj.Source]) - for o in objs: - v = o.ViewObject.isVisible() - if hasattr(obj, "AlwaysOn") and obj.AlwaysOn: - v = True - if v: - svg += get_svg.get_svg(o, - obj.Scale, - obj.LineWidth, - obj.FontSize.Value, - obj.FillStyle, - obj.Direction, ls, lc, lp) - else: - svg = get_svg.get_svg(obj.Source, - obj.Scale, - obj.LineWidth, - obj.FontSize.Value, - obj.FillStyle, - obj.Direction, ls, lc, lp) - - result += '