Draft: move array commands to DraftTools

Previously they were imported directly in `InitGui.py`,
now they are collected in `DraftTools.py`, so that they
are imported at the same time as other modules.

Also provide an icon so this icon appears in the menu.
This commit is contained in:
vocx-fc
2020-03-23 02:18:04 -06:00
committed by Yorik van Havre
parent 2021d0bec9
commit 6c890c1966
3 changed files with 21 additions and 12 deletions

View File

@@ -92,6 +92,7 @@ from draftguitools.gui_heal import Heal
from draftguitools.gui_dimension_ops import Draft_FlipDimension
from draftguitools.gui_lineslope import Draft_Slope
from draftguitools.gui_arcs import Draft_Arc_3Points
import draftguitools.gui_arrays
# import DraftFillet
import drafttaskpanels.task_shapestring as task_shapestring
import drafttaskpanels.task_scale as task_scale

View File

@@ -82,10 +82,6 @@ class DraftWorkbench(FreeCADGui.Workbench):
import DraftTools
import DraftGui
import DraftFillet
from draftguitools import gui_circulararray
from draftguitools import gui_polararray
from draftguitools import gui_orthoarray
from draftguitools import gui_arrays
FreeCADGui.addLanguagePath(":/translations")
FreeCADGui.addIconPath(":/icons")
except Exception as exc:

View File

@@ -28,6 +28,16 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD as App
import FreeCADGui as Gui
import Draft_rc
import draftguitools.gui_circulararray
import draftguitools.gui_polararray
import draftguitools.gui_orthoarray
# The module is used to prevent complaints from code checkers (flake8)
True if Draft_rc.__name__ else False
True if draftguitools.gui_circulararray.__name__ else False
True if draftguitools.gui_polararray.__name__ else False
True if draftguitools.gui_orthoarray.__name__ else False
class ArrayGroupCommand:
@@ -35,22 +45,24 @@ class ArrayGroupCommand:
def GetCommands(self):
"""Tuple of array commands."""
return tuple(["Draft_OrthoArray",
"Draft_PolarArray", "Draft_CircularArray",
"Draft_PathArray", "Draft_PathLinkArray",
"Draft_PointArray"])
return ("Draft_OrthoArray",
"Draft_PolarArray", "Draft_CircularArray",
"Draft_PathArray", "Draft_PathLinkArray",
"Draft_PointArray")
def GetResources(self):
"""Add menu and tooltip."""
"""Set icon, 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)}
return {'Pixmap': 'Draft_Array',
'MenuText': QT_TRANSLATE_NOOP("Draft", "Array tools"),
'ToolTip': QT_TRANSLATE_NOOP("Draft", _tooltip)}
def IsActive(self):
"""Return True when this command should be available."""
if App.ActiveDocument:
if App.activeDocument():
return True
else:
return False