From 699624fd261323b6cce9a74700a2520a2d785815 Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Tue, 11 Feb 2020 00:51:37 -0600 Subject: [PATCH] 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. --- src/Mod/Draft/CMakeLists.txt | 2 +- src/Mod/Draft/DraftGui.py | 3 --- src/Mod/Draft/DraftTools.py | 4 ++-- src/Mod/Draft/{DraftSnap.py => draftguitools/gui_snapper.py} | 0 4 files changed, 3 insertions(+), 6 deletions(-) rename src/Mod/Draft/{DraftSnap.py => draftguitools/gui_snapper.py} (100%) diff --git a/src/Mod/Draft/CMakeLists.txt b/src/Mod/Draft/CMakeLists.txt index caec6ec872..0bd5a6f64c 100644 --- a/src/Mod/Draft/CMakeLists.txt +++ b/src/Mod/Draft/CMakeLists.txt @@ -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 ) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index f5bb5f75b2..f5e91a7e35 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -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 diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 75f8cefb01..809514eded 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -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() diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/draftguitools/gui_snapper.py similarity index 100% rename from src/Mod/Draft/DraftSnap.py rename to src/Mod/Draft/draftguitools/gui_snapper.py