Draft: move Draft_ShowSnapBar to gui_snaps module

This commit is contained in:
vocx-fc
2020-03-16 12:48:47 -06:00
committed by Yorik van Havre
parent 9eab03b593
commit 11206b1d3a
2 changed files with 24 additions and 13 deletions

View File

@@ -4655,17 +4655,6 @@ class Point(Creator):
if self.ui.continueMode:
self.Activated()
class ShowSnapBar():
"""The ShowSnapBar FreeCAD command definition"""
def GetResources(self):
return {'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_ShowSnapBar", "Show Snap Bar"),
'ToolTip' : QtCore.QT_TRANSLATE_NOOP("Draft_ShowSnapBar", "Shows Draft snap toolbar")}
def Activated(self):
if hasattr(FreeCADGui,"Snapper"):
FreeCADGui.Snapper.show()
class Draft_Clone(Modifier):
"""The Draft Clone command definition"""
@@ -5262,7 +5251,7 @@ class Draft_Arc_3Points:
#---------------------------------------------------------------------------
# Snap tools
#---------------------------------------------------------------------------
import draftguitools.gui_snaps
from draftguitools.gui_snaps import ShowSnapBar
#---------------------------------------------------------------------------
# Adds the icons & commands to the FreeCAD command manager, and sets defaults
@@ -5336,7 +5325,6 @@ FreeCADGui.addCommand('Draft_Stretch',Stretch())
# context commands
FreeCADGui.addCommand('Draft_ApplyStyle',ApplyStyle())
FreeCADGui.addCommand('Draft_Shape2DView',Shape2DView())
FreeCADGui.addCommand('Draft_ShowSnapBar',ShowSnapBar())
FreeCADGui.addCommand('Draft_ToggleGrid',ToggleGrid())
FreeCADGui.addCommand('Draft_FlipDimension',Draft_FlipDimension())
FreeCADGui.addCommand('Draft_AutoGroup',SetAutoGroup())

View File

@@ -377,3 +377,26 @@ class Draft_Snap_WorkingPlane:
Gui.addCommand('Draft_Snap_WorkingPlane', Draft_Snap_WorkingPlane())
class ShowSnapBar:
"""GuiCommand for the Draft_ShowSnapBar tool.
Show the snap toolbar if it's hidden.
"""
def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Draft_Snap',
'MenuText': QT_TRANSLATE_NOOP("Draft_ShowSnapBar",
"Show snap toolbar"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_ShowSnapBar",
"Shows Draft snap toolbar.")}
def Activated(self):
"""Execute when the command is called."""
if hasattr(Gui, "Snapper"):
Gui.Snapper.show()
Gui.addCommand('Draft_ShowSnapBar', ShowSnapBar())