Salome HOME
svn merge -r31:HEAD svn://nepal.der.edf.fr/OPENTURNS/GENERICSOLVER_SRC/branches/YACS_...
[samples/genericsolver.git] / src / GENERICSOLVERGUI / GENERICSOLVERGUI.py
index defaca3a20e04b89af3d93532251836cbf4b7fe2..3ccc72c5e72b11e21fe873fae2a5b675a6030a00 100644 (file)
@@ -1,7 +1,4 @@
-#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-#  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#  Copyright (C) 2009-2010 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# ---
-# File   : GENERICSOLVERGUI.py
-# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-# ---
+
+# $Id$
 #
+
 import traceback
 import os
 from PyQt4.QtGui import *
 from PyQt4.QtCore import *
 
-from omniORB import CORBA
-from SALOME_NamingServicePy import *
-from LifeCycleCORBA import *
+import salome
 import SALOMEDS
-import SALOMEDS_Attributes_idl
-
 import GENERICSOLVER_ORB
 
+salome.salome_init()
+
 ################################################
 # GUI context class
 # Used to store actions, menus, toolbars, etc...
@@ -143,21 +137,6 @@ sgPyQt = SalomePyQt.SalomePyQt()
 import libSALOME_Swig
 sg = libSALOME_Swig.SALOMEGUI_Swig()
 
-################################################
-
-# init ORB
-orb = CORBA.ORB_init( [''], CORBA.ORB_ID )
-
-# create naming service instance
-naming_service = SALOME_NamingServicePy_i( orb )
-
-# create life cycle CORBA instance
-lcc = LifeCycleCORBA( orb )
-
-# get study manager
-obj = naming_service.Resolve( '/myStudyManager' )
-studyManager = obj._narrow( SALOMEDS.StudyManager )
-
 ################################################
 # Internal methods
 ################################################
@@ -181,7 +160,7 @@ def verbose():
 # get GENERICSOLVER engine
 ###
 def getEngine():
-    engine = lcc.FindOrLoadComponent( "FactoryServerPy", GUIcontext.MODULE_NAME )
+    engine = salome.lcc.FindOrLoadComponent( "FactoryServerPy", GUIcontext.MODULE_NAME )
     return engine
 
 ###
@@ -195,7 +174,7 @@ def getStudyId():
 ###
 def getStudy():
     studyId = getStudyId()
-    study = studyManager.GetStudyByID( studyId )
+    study = salome.myStudyManager.GetStudyByID( studyId )
     return study
 
 ###
@@ -655,10 +634,8 @@ def RunSOLVER():
     getEngine().Init( getStudyId(), case, "" )
     
     inPoint = GetDataFromCase( case )[:2]
-    outPoint = [0, 0]
     print "GENERICSOLVERGUI.RunSOLVER (1): inPoint  = ", inPoint
-    print "GENERICSOLVERGUI.RunSOLVER (1): outPoint = ", outPoint
-    (ok,outPoint) = getEngine().Exec( inPoint, outPoint )
+    (ok, outPoint) = getEngine().Exec(inPoint)
     print "GENERICSOLVERGUI.RunSOLVER (2): inPoint  = ", inPoint
     print "GENERICSOLVERGUI.RunSOLVER (2): outPoint = ", outPoint
     AddDataToCase( case, "Deviation", outPoint[0] )