Draft: move LinkArray GuiCommand to gui_array_simple module

The code is kept for historical reasons, but the tool
is no longer accessible from the toolbars or menus,
as it was superseded by the three commands `Draft_OrthoArray`,
`Draft_PolarArray` and `Draft_CircularArray`.
This commit is contained in:
vocx-fc
2020-04-09 22:36:53 -05:00
committed by Yorik van Havre
parent a34ce0acf3
commit ae3089d780
2 changed files with 25 additions and 12 deletions

View File

@@ -189,19 +189,9 @@ from draftguitools.gui_wire2spline import WireToBSpline
from draftguitools.gui_shape2dview import Shape2DView
from draftguitools.gui_draft2sketch import Draft2Sketch
from draftguitools.gui_array_simple import Array
from draftguitools.gui_array_simple import LinkArray
class LinkArray(Array):
"""GuiCommand for the Draft_LinkArray tool."""
def __init__(self):
Array.__init__(self, use_link=True)
def GetResources(self):
return {'Pixmap' : 'Draft_LinkArray',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_LinkArray", "LinkArray"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_LinkArray", "Creates a polar or rectangular link array from a selected object")}
class PathArray(Modifier):
"""The PathArray FreeCAD command definition"""
@@ -484,7 +474,6 @@ from draftguitools.gui_snaps import ShowSnapBar
# drawing commands
# modification commands
FreeCADGui.addCommand('Draft_LinkArray',LinkArray())
FreeCADGui.addCommand('Draft_Clone',Draft_Clone())
FreeCADGui.addCommand('Draft_PathArray',PathArray())
FreeCADGui.addCommand('Draft_PathLinkArray',PathLinkArray())

View File

@@ -108,3 +108,27 @@ class Array(gui_base_original.Modifier):
Gui.addCommand('Draft_Array', Array())
class LinkArray(Array):
"""Gui Command for the LinkArray tool based on the simple Array tool."""
def __init__(self):
super().__init__(use_link=True)
def GetResources(self):
"""Set icon, menu and tooltip."""
_tip = ("Like the Array 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_LinkArray',
'MenuText': QT_TRANSLATE_NOOP("Draft_LinkArray", "LinkArray"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_LinkArray", _tip)}
def Activated(self):
"""Execute when the command is called."""
super().Activated(name=_tr("Link array"))
Gui.addCommand('Draft_LinkArray', LinkArray())