Path: py3 fixes
Needed for unit tests to pass
This commit is contained in:
@@ -26,12 +26,12 @@
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import FreeCADGui
|
||||
import PathUtils
|
||||
import Path
|
||||
import Part
|
||||
import PathScripts
|
||||
from PySide import QtCore, QtGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
|
||||
LOG_MODULE = 'PathLoadTool'
|
||||
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
|
||||
@@ -194,7 +194,7 @@ class CommandPathLoadTool:
|
||||
PathLog.track("tool: {} with toolNumber: {}".format(tool, toolNumber))
|
||||
|
||||
import PathScripts
|
||||
import PathUtils
|
||||
from PathScripts import PathUtils
|
||||
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Default Tool")
|
||||
PathScripts.PathLoadTool.LoadTool(obj)
|
||||
|
||||
@@ -34,13 +34,23 @@ class PostProcessor:
|
||||
@classmethod
|
||||
def load(cls, processor):
|
||||
postname = processor + "_post"
|
||||
|
||||
exec("import %s as current_post" % postname)
|
||||
namespace = {}
|
||||
|
||||
#can't modify function local scope with exec in python3
|
||||
exec("from PathScripts import %s as current_post" % postname, namespace)
|
||||
current_post = namespace['current_post']
|
||||
|
||||
# make sure the script is reloaded if it was previously loaded
|
||||
# should the script have been imported for the first time above
|
||||
# then the initialization code of the script gets executed twice
|
||||
# resulting in 2 load messages if the script outputs one of those.
|
||||
exec("reload(%s)" % 'current_post')
|
||||
try:
|
||||
# Python 2.7
|
||||
exec("reload(%s)" % 'current_post')
|
||||
except NameError:
|
||||
# Python 3.4+
|
||||
from importlib import reload
|
||||
exec("reload(%s)" % 'current_post')
|
||||
|
||||
instance = PostProcessor(current_post)
|
||||
instance.units = None
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathUtils
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
LOG_MODULE = 'PathSelection'
|
||||
|
||||
@@ -30,7 +30,7 @@ import Path
|
||||
import os
|
||||
from PySide import QtCore, QtGui
|
||||
import PathScripts
|
||||
import PathUtils
|
||||
from PathScripts import PathUtils
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ from DraftGeomUtils import geomType
|
||||
import PathScripts
|
||||
from PathScripts import PathJob
|
||||
import numpy
|
||||
import PathLog
|
||||
from PathScripts import PathLog
|
||||
from FreeCAD import Vector
|
||||
import Path
|
||||
from PySide import QtCore
|
||||
|
||||
Reference in New Issue
Block a user