Fixed refactor issues breaking unit tests

This commit is contained in:
Markus Lampert
2022-08-13 21:40:42 -07:00
parent 5ca5a94f5e
commit 080d708f21
7 changed files with 14 additions and 10 deletions

View File

@@ -31,7 +31,6 @@ import Path.Tool.Controller as PathToolController
import PathScripts.PathStock as PathStock
import json
import time
import Path
# lazily loaded modules

View File

@@ -28,7 +28,7 @@ from pivy import coin
import FreeCAD
import FreeCADGui
import Path
import Path.Base.Gui.SetupSheetGui as PathSetupSheetGui
import Path.Base.Gui.SetupSheet as PathSetupSheetGui
import Path.Base.Util as PathUtil
import Path.GuiInit as PathGuiInit
import Path.Tool.Gui.Bit as PathToolBitGui

View File

@@ -325,7 +325,6 @@ class StockCreateCylinder(Stock):
if prop in ["Radius", "Height"] and not "Restore" in obj.State:
self.execute(obj)
def SetupStockObject(obj, stockType):
Path.Log.track(obj.Label, stockType)
if FreeCAD.GuiUp and obj.ViewObject:
@@ -338,9 +337,15 @@ def SetupStockObject(obj, stockType):
obj.StockType = stockType
obj.setEditorMode("StockType", 2) # hide
import Path.Base.Gui.IconViewProvider
# If I don't rename the module then usage as Path.Base.Gui.IconViewProvider below
# 'causes above Path.Log.track(...) to fail with - claiming that Path is accessed
# before it's assigned.
# Alternative _another_ `import Path` statement in front of `Path.Log.track(...)`
# also prevents the issue from happening.
# Go figure.
import Path.Base.Gui.IconViewProvider as PathIconViewProvider
Path.Base.Gui.IconViewProvider.ViewProvider(obj.ViewObject, "Stock")
PathIconViewProvider.ViewProvider(obj.ViewObject, "Stock")
obj.ViewObject.Transparency = 90
obj.ViewObject.DisplayMode = "Wireframe"