Imported numpy, and added as dependency

This commit is contained in:
Jose Luis Cercós pita 2012-07-08 16:04:16 +02:00
parent 3e351aaff2
commit 0ba6c2ae78
2 changed files with 13 additions and 6 deletions

View File

@ -36,12 +36,22 @@ class ShipWorkbench ( Workbench ):
self.appendToolbar("Ship design",list)
list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
self.appendToolbar("Weights",list)
# Simulation stuff only if pyOpenCL & numpy are present
hasOpenCL = True
hasNumpy = True
try:
import pyopencl
except ImportError:
hasOpenCL = False
msg = Translator.translate("pyOpenCL not installed, ship simulations disabled\n")
App.Console.PrintWarning(msg)
else:
try:
import numpy
except ImportError:
hasNumpy = False
msg = Translator.translate("numpy not installed, ship simulations disabled\n")
App.Console.PrintWarning(msg)
if hasOpenCL and hasNumpy:
list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
self.appendToolbar("Simulation",list)
@ -50,11 +60,7 @@ class ShipWorkbench ( Workbench ):
self.appendMenu("Ship design",list)
list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
self.appendMenu("Weights",list)
try:
import pyopencl
except ImportError:
pass
else:
if hasOpenCL and hasNumpy:
list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
self.appendMenu("Simulation",list)

View File

@ -27,6 +27,7 @@ import threading
# pyOpenCL
import pyopencl as cl
import numpy as np
# FreeCAD
import FreeCAD,FreeCADGui