From 720dc919c37050ad502e1c268fc3790749e2bc1d Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Fri, 10 Apr 2020 00:03:00 -0500 Subject: [PATCH] Draft: move PathLinkArray GuiCommand to gui_patharray module --- src/Mod/Draft/DraftTools.py | 13 +--------- src/Mod/Draft/draftguitools/gui_patharray.py | 26 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index e56faf873a..31fd41b3c1 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -191,19 +191,9 @@ from draftguitools.gui_draft2sketch import Draft2Sketch from draftguitools.gui_array_simple import Array from draftguitools.gui_array_simple import LinkArray from draftguitools.gui_patharray import PathArray +from draftguitools.gui_patharray import PathLinkArray -class PathLinkArray(PathArray): - "The PathLinkArray FreeCAD command definition" - - def __init__(self): - PathArray.__init__(self,True) - - def GetResources(self): - return {'Pixmap' : 'Draft_PathLinkArray', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_PathLinkArray", "PathLinkArray"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_PathLinkArray", "Creates links of a selected object along a selected path.")} - class PointArray(Modifier): """The PointArray FreeCAD command definition""" @@ -436,7 +426,6 @@ from draftguitools.gui_snaps import ShowSnapBar # modification commands FreeCADGui.addCommand('Draft_Clone',Draft_Clone()) -FreeCADGui.addCommand('Draft_PathLinkArray',PathLinkArray()) FreeCADGui.addCommand('Draft_PointArray',PointArray()) FreeCADGui.addCommand('Draft_Mirror',Mirror()) diff --git a/src/Mod/Draft/draftguitools/gui_patharray.py b/src/Mod/Draft/draftguitools/gui_patharray.py index 1d32d635c7..9540c4ae13 100644 --- a/src/Mod/Draft/draftguitools/gui_patharray.py +++ b/src/Mod/Draft/draftguitools/gui_patharray.py @@ -109,3 +109,29 @@ class PathArray(gui_base_original.Modifier): Gui.addCommand('Draft_PathArray', PathArray()) + + +class PathLinkArray(PathArray): + """Gui Command for the PathLinkArray tool based on the PathArray tool.""" + + def __init__(self): + super().__init__(use_link=True) + + def GetResources(self): + """Set icon, menu and tooltip.""" + _menu = "Path Link array" + _tip = ("Like the PathArray tool, but creates a 'Link array' " + "instead.\n" + "A 'Link array' is more efficient when handling many copies " + "but the 'Fuse' option cannot be used.") + + return {'Pixmap': 'Draft_PathLinkArray', + 'MenuText': QT_TRANSLATE_NOOP("Draft_PathLinkArray", _menu), + 'ToolTip': QT_TRANSLATE_NOOP("Draft_PathLinkArray", _tip)} + + def Activated(self): + """Execute when the command is called.""" + super().Activated(name=_tr("Link path array")) + + +Gui.addCommand('Draft_PathLinkArray', PathLinkArray())