Draft: move DraftSnap to another module

And do not load the `Snapper` in `DraftGui`.
The Snapper should be initialized by the module
that imports `DraftGui`, most probably `DraftTools`
or even by the `InitGui` of the workbench.
This commit is contained in:
vocx-fc
2020-02-11 00:51:37 -06:00
committed by Yorik van Havre
parent 6b87a416fd
commit 580270ce4a
4 changed files with 3 additions and 6 deletions

View File

@@ -10,7 +10,6 @@ SET(Draft_SRCS_base
Draft.py
DraftTools.py
DraftGui.py
DraftSnap.py
DraftTrackers.py
DraftVecUtils.py
DraftGeomUtils.py
@@ -85,6 +84,7 @@ SET(Draft_GUI_tools
draftguitools/gui_polararray.py
draftguitools/gui_arrays.py
draftguitools/gui_snaps.py
draftguitools/gui_snapper.py
draftguitools/README.md
)

View File

@@ -2452,6 +2452,3 @@ class ShapeStringTaskPanel:
if not hasattr(FreeCADGui,"draftToolBar"):
FreeCADGui.draftToolBar = DraftToolBar()
#----End of Python Features Definitions----#
if not hasattr(FreeCADGui,"Snapper"):
import DraftSnap

View File

@@ -40,14 +40,14 @@ import sys, os, FreeCAD, FreeCADGui, WorkingPlane, math, re, Draft, Draft_rc, Dr
from FreeCAD import Vector
from PySide import QtCore,QtGui
from DraftGui import todo, translate, utf8_decode
import DraftSnap
import draftguitools.gui_snapper as gui_snapper
import DraftGui
import DraftTrackers
from DraftTrackers import *
from pivy import coin
if not hasattr(FreeCADGui, "Snapper"):
FreeCADGui.Snapper = DraftSnap.Snapper()
FreeCADGui.Snapper = gui_snapper.Snapper()
if not hasattr(FreeCAD, "DraftWorkingPlane"):
FreeCAD.DraftWorkingPlane = WorkingPlane.plane()