From adfc58580d1773f2b5e0601084bccfe1462cd32d Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Wed, 29 Jan 2020 22:47:07 -0600 Subject: [PATCH] Draft, Arch: group the array tools --- src/Mod/Arch/InitGui.py | 1 + src/Mod/Draft/CMakeLists.txt | 1 + src/Mod/Draft/InitGui.py | 1 + src/Mod/Draft/draftguitools/gui_arrays.py | 56 +++++++++++++++++++++++ src/Mod/Draft/draftutils/init_tools.py | 6 +-- 5 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 src/Mod/Draft/draftguitools/gui_arrays.py diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py index cf178844da..07962ad989 100644 --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -51,6 +51,7 @@ class ArchWorkbench(FreeCADGui.Workbench): import DraftGui from draftguitools import gui_circulararray from draftguitools import gui_polararray + from draftguitools import gui_arrays import Arch_rc import Arch diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index 3ed3af7aa0..31e6e30e64 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -74,6 +74,7 @@ SET(Draft_GUI_tools draftguitools/gui_base.py draftguitools/gui_circulararray.py draftguitools/gui_polararray.py + draftguitools/gui_arrays.py ) SET(Draft_task_panels diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index 069ed07263..cace902269 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -82,6 +82,7 @@ class DraftWorkbench(FreeCADGui.Workbench): import DraftFillet from draftguitools import gui_circulararray from draftguitools import gui_polararray + from draftguitools import gui_arrays FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") except Exception as exc: diff --git a/src/Mod/Draft/draftguitools/gui_arrays.py b/src/Mod/Draft/draftguitools/gui_arrays.py new file mode 100644 index 0000000000..c0048c2e78 --- /dev/null +++ b/src/Mod/Draft/draftguitools/gui_arrays.py @@ -0,0 +1,56 @@ +"""Provide the Draft ArrayTools command to group the other array tools.""" +## @package gui_arrays +# \ingroup DRAFT +# \brief Provide the Draft ArrayTools command to group the other array tools. + +# *************************************************************************** +# * (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 * +# * * +# *************************************************************************** +import FreeCAD as App +import FreeCADGui as Gui +from PySide.QtCore import QT_TRANSLATE_NOOP + + +class ArrayGroupCommand: + """Gui command for the group of array tools.""" + + def GetCommands(self): + """Tuple of array commands.""" + return tuple(["Draft_Array", "Draft_LinkArray", + "Draft_PolarArray", "Draft_CircularArray", + "Draft_PathArray", "Draft_PathLinkArray", + "Draft_PointArray"]) + + def GetResources(self): + """Add menu and tooltip.""" + _tooltip = ("Create various types of arrays, " + "including rectangular, polar, circular, " + "path, and point") + return {'MenuText': QT_TRANSLATE_NOOP("Draft", "Array tools"), + 'ToolTip': QT_TRANSLATE_NOOP("Arch", _tooltip)} + + def IsActive(self): + """Be active only when a document is active.""" + return App.ActiveDocument is not None + + +Gui.addCommand('Draft_ArrayTools', ArrayGroupCommand()) diff --git a/src/Mod/Draft/draftutils/init_tools.py b/src/Mod/Draft/draftutils/init_tools.py index 04f4794b6e..d44df6bc98 100644 --- a/src/Mod/Draft/draftutils/init_tools.py +++ b/src/Mod/Draft/draftutils/init_tools.py @@ -54,11 +54,7 @@ def get_draft_annotation_commands(): def get_draft_array_commands(): """Return the array commands list.""" - # After the array commands are grouped, return this - # return ["Draft_ArrayTools"] - return ["Draft_Array", "Draft_LinkArray", - "Draft_PolarArray", "Draft_CircularArray", - "Draft_PathArray", "Draft_PathLinkArray", "Draft_PointArray"] + return ["Draft_ArrayTools"] def get_draft_modification_commands():