do code cleanup
move BOPTools from Part to PartGui because it depends on GUI
This commit is contained in:
@@ -383,22 +383,6 @@ PyMOD_INIT_FUNC(Part)
|
||||
Base::Interpreter().addType(&Part::Line2dSegmentPy::Type,geom2dModule,"Line2dSegment");
|
||||
Base::Interpreter().addType(&Part::Line2dPy::Type,geom2dModule,"Line2d");
|
||||
Base::Interpreter().addType(&Part::OffsetCurve2dPy::Type,geom2dModule,"OffsetCurve2d");
|
||||
#if 0 /* for python3 this isn't working anymore, it's solved by importing the BOPTools
|
||||
directly. (import BOPTools) */
|
||||
// this causes double initialisation of the part modul with python3.
|
||||
try {
|
||||
//import all submodules of BOPTools, to make them easy to browse in Py console.
|
||||
//It's done in this weird manner instead of bt.caMemberFunction("importAll"),
|
||||
//because the latter crashed when importAll failed with exception.
|
||||
Base::Interpreter().runString("__import__('BOPTools').importAll()");
|
||||
|
||||
Py::Object bt = Base::Interpreter().runStringObject("__import__('BOPTools')");
|
||||
module.setAttr(std::string("BOPTools"),bt);
|
||||
} catch (Base::PyException &err){
|
||||
Base::Console().Error("Failed to import BOPTools package:\n");
|
||||
err.ReportException();
|
||||
}
|
||||
#endif
|
||||
|
||||
Part::TopoShape ::init();
|
||||
Part::PropertyPartShape ::init();
|
||||
|
||||
@@ -41,13 +41,14 @@ class PartWorkbench ( Workbench ):
|
||||
def Initialize(self):
|
||||
# load the module
|
||||
import PartGui
|
||||
import BOPTools
|
||||
|
||||
import CompoundTools._CommandCompoundFilter
|
||||
|
||||
try:
|
||||
BOPTools.importAll()
|
||||
BOPTools.addCommands()
|
||||
bop = __import__("BOPTools")
|
||||
bop.importAll()
|
||||
bop.addCommands()
|
||||
PartGui.BOPTools = bop
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError("Features from BOPTools package cannot be loaded. {err}\n".format(err= str(err)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user