diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 26521cf4ac..a02cb65129 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -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()) diff --git a/src/Mod/Draft/draftguitools/gui_snaps.py b/src/Mod/Draft/draftguitools/gui_snaps.py index 019d93c47a..2d2745c7db 100644 --- a/src/Mod/Draft/draftguitools/gui_snaps.py +++ b/src/Mod/Draft/draftguitools/gui_snaps.py @@ -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())