From: abn Date: Thu, 16 Oct 2014 11:31:21 +0000 (+0200) Subject: Preparing move of the engine code into GUI (and restoring trace) X-Git-Tag: V7_5_0b1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=09c34352cd5ad238ba0f7c1296357d7889c4c47d;p=modules%2Fparavis.git Preparing move of the engine code into GUI (and restoring trace) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 52680155..2744f38d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,7 +251,7 @@ INCLUDE(CMakePackageConfigHelpers) # List of targets in this project we want to make visible to the rest of the world. # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" IF(NOT SALOME_LIGHT_ONLY) - SET(_${PROJECT_NAME}_exposed_targets SalomeIDLPARAVIS PARAVIS) + SET(_${PROJECT_NAME}_exposed_targets SalomeIDLPVServer PARAVIS) # Add all targets to the build-tree export set EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 7300916e..3b40cefb 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -45,7 +45,7 @@ IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) ) ELSE() SET(SalomeIDLPARAVIS_IDLSOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PARAVIS_Gen.idl + ${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PVSERVER_Gen.idl ) SET(_idl_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/no_wrap @@ -59,5 +59,5 @@ SET(_idl_link_flags ${KERNEL_SalomeIDLKernel} ) -OMNIORB_ADD_MODULE(SalomeIDLPARAVIS "${SalomeIDLPARAVIS_IDLSOURCES}" "${_idl_include_dirs}" "${_idl_link_flags}") -INSTALL(TARGETS SalomeIDLPARAVIS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) +OMNIORB_ADD_MODULE(SalomeIDLPVServer "${SalomeIDLPARAVIS_IDLSOURCES}" "${_idl_include_dirs}" "${_idl_link_flags}") +INSTALL(TARGETS SalomeIDLPVServer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/idl/no_wrap/PARAVIS_Gen.idl b/idl/no_wrap/PARAVIS_Gen.idl deleted file mode 100644 index e3e5ffb1..00000000 --- a/idl/no_wrap/PARAVIS_Gen.idl +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, 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 -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Adrien Bruneton (CEA) - - -#ifndef __PARAVIS_GEN__ -#define __PARAVIS_GEN__ - -#include "SALOME_Exception.idl" -#include "SALOME_Component.idl" -#include "SALOMEDS.idl" -#include "SALOME_Exception.idl" - -/*! - The main package of interfaces of the module %PARAVIS. -*/ -module PARAVIS_ORB { - - /*! - * \brief The main interface class for PARAVIS server. - * Instantiation of this class has to be done before access to any other PARAVIS interfaces - */ - interface PARAVIS_Gen : Engines::EngineComponent, SALOMEDS::Driver - { - - /*! - * \brief Returns IOR of the current object. - */ - string GetIOR(); - - /*! If a pvserver is already started, returns its current URL, regardless of the provided - * parameters. - * If not, start a pvserver on the machine hosting the PARAVIS engine and on the given port. - * If port <= 0, a free port is automatically detected, starting from the usual 11111 pvserver port. - */ - string FindOrStartPVServer(in long port); - - /*! Tries to stop the PVserver currently running (send KILL). - * @return false if no server was running, true otherwise. - */ - boolean StopPVServer(); - - /*! Gets the last trace string pushed by the GUI onto the engine. - */ - string GetPythonTraceString(); - - /*! HACK!! For now ParaView's trace mechanism is implemented in such away that asking the trace - * outside the GUI provides an incomplete script. Hence the GUI regularly pushes to the engine - * the latest status of the trace which is then returned by GetPythonTraceString(). - */ - void PutPythonTraceStringToEngine(in string trace); - - /*! Indicates if the GUI process is already connected to the pvserver. - * This avoids multiple attempts to connect from a single thread (makes ParaView crash). */ - void SetGUIConnected(in boolean isConnected); - - boolean GetGUIConnected(); - - }; - -}; - -#endif \ No newline at end of file diff --git a/idl/no_wrap/PVSERVER_Gen.idl b/idl/no_wrap/PVSERVER_Gen.idl new file mode 100644 index 00000000..d8550aa5 --- /dev/null +++ b/idl/no_wrap/PVSERVER_Gen.idl @@ -0,0 +1,79 @@ +// Copyright (C) 2010-2014 CEA/DEN, 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Adrien Bruneton (CEA) + + +#ifndef __PVSERVER_GEN__ +#define __PVSERVER_GEN__ + +#include "SALOME_Exception.idl" +#include "SALOME_Component.idl" +#include "SALOMEDS.idl" +#include "SALOME_Exception.idl" + +/*! + The main package of interfaces of the module %PARAVIS. +*/ +module PVSERVER_ORB { + + /*! + * \brief The main interface class for PARAVIS server. + * Instantiation of this class has to be done before access to any other PARAVIS interfaces + */ + interface PVSERVER_Gen : Engines::EngineComponent, SALOMEDS::Driver + { + + /*! + * \brief Returns IOR of the current object. + */ + string GetIOR(); + + /*! If a pvserver is already started, returns its current URL, regardless of the provided + * parameters. + * If not, start a pvserver on the machine hosting the PARAVIS engine and on the given port. + * If port <= 0, a free port is automatically detected, starting from the usual 11111 pvserver port. + */ + string FindOrStartPVServer(in long port); + + /*! Tries to stop the PVserver currently running (send KILL). + * @return false if no server was running, true otherwise. + */ + boolean StopPVServer(); + + /*! Gets the last trace string pushed by the GUI onto the engine. + */ + string GetPythonTraceString(); + + /*! HACK!! For now ParaView's trace mechanism is implemented in such away that asking the trace + * outside the GUI provides an incomplete script. Hence the GUI regularly pushes to the engine + * the latest status of the trace which is then returned by GetPythonTraceString(). + */ + void PutPythonTraceStringToEngine(in string trace); + + /*! Indicates if the GUI process is already connected to the pvserver. + * This avoids multiple attempts to connect from a single thread (makes ParaView crash). */ + void SetGUIConnected(in boolean isConnected); + + boolean GetGUIConnected(); + + }; + +}; + +#endif \ No newline at end of file diff --git a/resources/PARAVISCatalog.xml.in b/resources/PARAVISCatalog.xml.in index 0652474d..58e28313 100644 --- a/resources/PARAVISCatalog.xml.in +++ b/resources/PARAVISCatalog.xml.in @@ -26,18 +26,18 @@ - PARAVIS + PVSERVER ParaView PARAVIS vsv @SALOMEPARAVIS_VERSION@ - ParaView module + PVServer control service 1 1 pqAppIcon22.png - PARAVIS_Gen + PVSERVER_Gen unknown diff --git a/src/ENGINE/CMakeLists.txt b/src/ENGINE/CMakeLists.txt index d851edfb..47dba95a 100644 --- a/src/ENGINE/CMakeLists.txt +++ b/src/ENGINE/CMakeLists.txt @@ -36,10 +36,10 @@ IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) INSTALL(FILES PARAVIS_Engine_i.hh DESTINATION ${SALOME_INSTALL_HEADERS}) ELSE() - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PARAVIS.py.in ${CMAKE_CURRENT_BINARY_DIR}/PARAVIS.py @ONLY) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PVSERVER.py.in ${CMAKE_CURRENT_BINARY_DIR}/PVSERVER.py @ONLY) SET(_bin_SCRIPTS - ${CMAKE_CURRENT_BINARY_DIR}/PARAVIS.py - no_wrap/PARAVIS_utils.py + ${CMAKE_CURRENT_BINARY_DIR}/PVSERVER.py + no_wrap/PVSERVER_utils.py ) # --- rules --- diff --git a/src/ENGINE/no_wrap/PARAVIS.py.in b/src/ENGINE/no_wrap/PARAVIS.py.in deleted file mode 100644 index 5a7692c7..00000000 --- a/src/ENGINE/no_wrap/PARAVIS.py.in +++ /dev/null @@ -1,238 +0,0 @@ -# Copyright (C) 2007-2014 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 -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author : Adrien Bruneton (CEA) -# - -import PARAVIS_ORB__POA -import SALOME_ComponentPy -import SALOME_DriverPy -import SALOMEDS -import SALOME -import PARAVIS_utils -import subprocess as subp -import socket -from time import sleep -import os -#from SALOME_utilities import MESSAGE - -def MESSAGE(m): - pass - #os.system("echo \"%s\" >> /tmp/paravis_log.txt" % m) - -class PARAVIS_Impl: - """ The core implementation (non CORBA, or Study related). - See the IDL for the documentation. - """ - MAX_PVSERVER_PORT_TRIES = 10 - PARAVIEW_ROOT_DIR = "@PARAVIEW_ROOT_DIR@" - PVSERVER_DEFAULT_PORT = 11111 - - def __init__(self): - self.pvserverPort = -1 - self.pvserverPop = None # Popen object from subprocess module - self.lastTrace = "" - self.isGUIConnected = False # whether there is an active connection from the GUI. - - """ - Private. Identify a free port to launch the PVServer. - """ - def __getFreePort(self, startPort): - cnt = 0 - currPort = startPort - while cnt < self.MAX_PVSERVER_PORT_TRIES: - try: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.bind(('', currPort)) - s.close() - return currPort - except socket.error as e: - cnt += 1 - currPort += 1 - pass - raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, - "[PARAVIS] maximum number of tries to retrieve a free port for the PVServer", - "PARAVIS.py", 0)) - - def FindOrStartPVServer( self, port ): - MESSAGE("[PARAVIS] FindOrStartPVServer ...") - host = "localhost" - alive = True - if self.pvserverPop is None: - alive = False - else: - # Poll active server to check if still alive - self.pvserverPop.poll() - if not self.pvserverPop.returncode is None: # server terminated - alive = False - - if alive: - return "cs://%s:%d" % (host, self.pvserverPort) - - # (else) Server not alive, start it: - pvServerPath = os.path.join(self.PARAVIEW_ROOT_DIR, 'bin', 'pvserver') - opt = [] - if port <= 0: - port = self.__getFreePort(self.PVSERVER_DEFAULT_PORT) - self.pvserverPop = subp.Popen([pvServerPath, "--multi-clients", "--server-port=%d" % port]) - sleep(3) # Give some time to the server to start up to avoid - # ugly messages on the client side saying that it cannot connect - # Is PID still alive? If yes, consider that the launch was successful - self.pvserverPop.poll() - if self.pvserverPop.returncode is None: - success = True - self.pvserverPort = port - MESSAGE("[PARAVIS] pvserver successfully launched on port %d" % port) - else: - raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, - "[PARAVIS] Unable to start PVServer on port %d!" % port, - "PARAVIS.py", 0)) - return "cs://%s:%d" % (host, self.pvserverPort) - - def StopPVServer( self ): - MESSAGE("[PARAVIS] Trying to stop PVServer (sending KILL) ...") - if not self.pvserverPop is None: - self.pvserverPop.poll() - if self.pvserverPop.returncode is None: - # Terminate if still running: - self.pvserverPop.terminate() - MESSAGE("[PARAVIS] KILL signal sent.") - return True - MESSAGE("[PARAVIS] Nothing to kill.") - return False - - def PutPythonTraceStringToEngine( self, t ): - self.lastTrace = t - - def GetPythonTraceString(self): - return self.lastTrace - - def SetGUIConnected( self, isConnected ): - self.isGUIConnected = isConnected - - def GetGUIConnected( self ): - return self.isGUIConnected - -class PARAVIS(PARAVIS_ORB__POA.PARAVIS_Gen, - SALOME_ComponentPy.SALOME_ComponentPy_i, - SALOME_DriverPy.SALOME_DriverPy_i, - PARAVIS_Impl): - """ - Construct an instance of PARAVIS module engine. - The class PARAVIS implements CORBA interface PARAVIS_Gen (see PARAVIS_Gen.idl). - It is inherited from the classes SALOME_ComponentPy_i (implementation of - Engines::EngineComponent CORBA interface - SALOME component) and SALOME_DriverPy_i - (implementation of SALOMEDS::Driver CORBA interface - SALOME module's engine). - """ - def __init__ ( self, orb, poa, contID, containerName, instanceName, - interfaceName ): - SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, - contID, containerName, instanceName, interfaceName, 0) - SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName) - PARAVIS_Impl.__init__(self) - # - self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) - # - - """ Override base class destroy to make sure we try to kill the pvserver - before leaving. - """ - def destroy(self): - self.StopPVServer() - # Invokes super(): - SALOME_ComponentPy.destroy(self) - - """ - Get version information. - """ - def getVersion( self ): - import salome_version - return salome_version.getVersion("PARAVIS", True) - - def GetIOR(self): - return PARAVIS_utils.getEngineIOR() - - """ - Create object. - """ - def createObject( self, study, name ): - MESSAGE("createObject()") - self._createdNew = True # used for getModifiedData method - builder = study.NewBuilder() - father = findOrCreateComponent( study ) - object = builder.NewObject( father ) - attr = builder.FindOrCreateAttribute( object, "AttributeName" ) - attr.SetValue( name ) - attr = builder.FindOrCreateAttribute( object, "AttributeLocalID" ) - attr.SetValue( PARAVIS_utils.objectID() ) - pass - - """ - Dump module data to the Python script. - """ - def DumpPython( self, study, isPublished, isMultiFile ): - MESSAGE("dumpPython()") - abuffer = self.GetPythonTraceString().split("\n") - if isMultiFile: - abuffer = [ " " + s for s in abuffer ] - abuffer[0:0] = [ "def RebuildData( theStudy ):" ] - abuffer += [ " pass" ] - abuffer += [ "\0" ] - return ("\n".join( abuffer ), 1) - - """ - Import file to restore module data - """ - def importData(self, studyId, dataContainer, options): - MESSAGE("importData()") - # get study by Id - obj = self._naming_service.Resolve("myStudyManager") - myStudyManager = obj._narrow(SALOMEDS.StudyManager) - study = myStudyManager.GetStudyByID(studyId) - # create all objects from the imported stream - stream = dataContainer.get() - for objname in stream.split("\n"): - if len(objname) != 0: - self.createObject(study, objname) - self._createdNew = False # to store the modification of the study information later - return ["objects"] # identifier what is in this file - - def getModifiedData(self, studyId): - MESSAGE("getModifiedData()") - if self._createdNew: - # get study by Id - obj = self._naming_service.Resolve("myStudyManager") - myStudyManager = obj._narrow(SALOMEDS.StudyManager) - study = myStudyManager.GetStudyByID(studyId) - # iterate all objects to get their names and store this information in stream - stream="" - father = study.FindComponent( moduleName() ) - if father: - iter = study.NewChildIterator( father ) - while iter.More(): - name = iter.Value().GetName() - stream += name + "\n" - iter.Next() - # store stream to the temporary file to send it in DataContainer - dataContainer = SALOME_DataContainerPy_i(stream, "", "objects", False, True) - aVar = dataContainer._this() - return [aVar] - return [] diff --git a/src/ENGINE/no_wrap/PARAVIS_utils.py b/src/ENGINE/no_wrap/PARAVIS_utils.py deleted file mode 100644 index 5a6d122e..00000000 --- a/src/ENGINE/no_wrap/PARAVIS_utils.py +++ /dev/null @@ -1,199 +0,0 @@ -# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# --- -# File : PARAVIS_utils.py -# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -# --- -# -__all__ = [ - "moduleID", - "objectID", - "unknownID", - "moduleName", - "modulePixmap", - "verbose", - "getORB", - "getNS", - "getLCC", - "getStudyManager", - "getEngine", - "getEngineIOR", - "findOrCreateComponent", - "getObjectID", - ] - -from omniORB import CORBA -from SALOME_NamingServicePy import SALOME_NamingServicePy_i -from LifeCycleCORBA import LifeCycleCORBA -import SALOMEDS -import SALOMEDS_Attributes_idl -import PARAVIS_ORB -import os - -### -# Get PARAVIS module's ID -### -def moduleID(): - MODULE_ID = 1000 - return MODULE_ID - -### -# Get PARAVIS object's ID -### -def objectID(): - OBJECT_ID = 1010 - return OBJECT_ID - -### -# Get unknown ID -### -def unknownID(): - FOREIGN_ID = -1 - return FOREIGN_ID - -### -# Get PARAVIS module's name -### -def moduleName(): - return "PARAVIS" - -### -# Get module's pixmap name -### -def modulePixmap(): - return "PARAVIS_small.png" - -### -# Get verbose level -### -__verbose__ = None -def verbose(): - global __verbose__ - if __verbose__ is None: - try: - __verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) ) - except: - __verbose__ = 0 - pass - pass - return __verbose__ - -### -# Get ORB reference -### -__orb__ = None -def getORB(): - global __orb__ - if __orb__ is None: - __orb__ = CORBA.ORB_init( [''], CORBA.ORB_ID ) - pass - return __orb__ - -### -# Get naming service instance -### -__naming_service__ = None -def getNS(): - global __naming_service__ - if __naming_service__ is None: - __naming_service__ = SALOME_NamingServicePy_i( getORB() ) - pass - return __naming_service__ - -## -# Get life cycle CORBA instance -## -__lcc__ = None -def getLCC(): - global __lcc__ - if __lcc__ is None: - __lcc__ = LifeCycleCORBA( getORB() ) - pass - return __lcc__ - -## -# Get study manager -### -__study_manager__ = None -def getStudyManager(): - global __study_manager__ - if __study_manager__ is None: - obj = getNS().Resolve( '/myStudyManager' ) - __study_manager__ = obj._narrow( SALOMEDS.StudyManager ) - pass - return __study_manager__ - -### -# Get PARAVIS engine -### -__engine__ = None -def getEngine(): - global __engine__ - if __engine__ is None: - __engine__ = getLCC().FindOrLoadComponent( "FactoryServer", moduleName() ) - pass - return __engine__ - -### -# Get PARAVIS engine IOR -### -def getEngineIOR(): - IOR = "" - if getORB() and getEngine(): - IOR = getORB().object_to_string( getEngine() ) - pass - return IOR - -### -# Find or create PARAVIS component object in a study -### -def findOrCreateComponent( study ): - father = study.FindComponent( moduleName() ) - if father is None: - builder = study.NewBuilder() - father = builder.NewComponent( moduleName() ) - attr = builder.FindOrCreateAttribute( father, "AttributeName" ) - attr.SetValue( moduleName() ) - attr = builder.FindOrCreateAttribute( father, "AttributePixMap" ) - attr.SetPixMap( modulePixmap() ) - attr = builder.FindOrCreateAttribute( father, "AttributeLocalID" ) - attr.SetValue( moduleID() ) - try: - builder.DefineComponentInstance( father, getEngine() ) - pass - except: - pass - pass - return father - -### -# Get object's ID -### -def getObjectID( study, entry ): - ID = unknownID() - if study and entry: - sobj = study.FindObjectID( entry ) - if sobj is not None: - test, anAttr = sobj.FindAttribute( "AttributeLocalID" ) - if test: ID = anAttr._narrow( SALOMEDS.AttributeLocalID ).Value() - pass - pass - return ID - diff --git a/src/ENGINE/no_wrap/PVSERVER.py.in b/src/ENGINE/no_wrap/PVSERVER.py.in new file mode 100644 index 00000000..085c2d3a --- /dev/null +++ b/src/ENGINE/no_wrap/PVSERVER.py.in @@ -0,0 +1,238 @@ +# Copyright (C) 2007-2014 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 +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author : Adrien Bruneton (CEA) +# + +import PVSERVER_ORB__POA +import SALOME_ComponentPy +import SALOME_DriverPy +import SALOMEDS +import SALOME +import PVSERVER_utils +import subprocess as subp +import socket +from time import sleep +import os +#from SALOME_utilities import MESSAGE + +def MESSAGE(m): + pass + #os.system("echo \"%s\" >> /tmp/paravis_log.txt" % m) + +class PVSERVER_Impl: + """ The core implementation (non CORBA, or Study related). + See the IDL for the documentation. + """ + MAX_PVSERVER_PORT_TRIES = 10 + PARAVIEW_ROOT_DIR = "@PARAVIEW_ROOT_DIR@" + PVSERVER_DEFAULT_PORT = 11111 + + def __init__(self): + self.pvserverPort = -1 + self.pvserverPop = None # Popen object from subprocess module + self.lastTrace = "" + self.isGUIConnected = False # whether there is an active connection from the GUI. + + """ + Private. Identify a free port to launch the PVServer. + """ + def __getFreePort(self, startPort): + cnt = 0 + currPort = startPort + while cnt < self.MAX_PVSERVER_PORT_TRIES: + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.bind(('', currPort)) + s.close() + return currPort + except socket.error as e: + cnt += 1 + currPort += 1 + pass + raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, + "[PVSERVER] maximum number of tries to retrieve a free port for the PVServer", + "PVSERVER.py", 0)) + + def FindOrStartPVServer( self, port ): + MESSAGE("[PVSERVER] FindOrStartPVServer ...") + host = "localhost" + alive = True + if self.pvserverPop is None: + alive = False + else: + # Poll active server to check if still alive + self.pvserverPop.poll() + if not self.pvserverPop.returncode is None: # server terminated + alive = False + + if alive: + return "cs://%s:%d" % (host, self.pvserverPort) + + # (else) Server not alive, start it: + pvServerPath = os.path.join(self.PARAVIEW_ROOT_DIR, 'bin', 'pvserver') + opt = [] + if port <= 0: + port = self.__getFreePort(self.PVSERVER_DEFAULT_PORT) + self.pvserverPop = subp.Popen([pvServerPath, "--multi-clients", "--server-port=%d" % port]) + sleep(3) # Give some time to the server to start up to avoid + # ugly messages on the client side saying that it cannot connect + # Is PID still alive? If yes, consider that the launch was successful + self.pvserverPop.poll() + if self.pvserverPop.returncode is None: + success = True + self.pvserverPort = port + MESSAGE("[PVSERVER] pvserver successfully launched on port %d" % port) + else: + raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, + "[PVSERVER] Unable to start PVServer on port %d!" % port, + "PVSERVER.py", 0)) + return "cs://%s:%d" % (host, self.pvserverPort) + + def StopPVServer( self ): + MESSAGE("[PVSERVER] Trying to stop PVServer (sending KILL) ...") + if not self.pvserverPop is None: + self.pvserverPop.poll() + if self.pvserverPop.returncode is None: + # Terminate if still running: + self.pvserverPop.terminate() + MESSAGE("[PVSERVER] KILL signal sent.") + return True + MESSAGE("[PVSERVER] Nothing to kill.") + return False + + def PutPythonTraceStringToEngine( self, t ): + self.lastTrace = t + + def GetPythonTraceString(self): + return self.lastTrace + + def SetGUIConnected( self, isConnected ): + self.isGUIConnected = isConnected + + def GetGUIConnected( self ): + return self.isGUIConnected + +class PVSERVER(PVSERVER_ORB__POA.PVSERVER_Gen, + SALOME_ComponentPy.SALOME_ComponentPy_i, + SALOME_DriverPy.SALOME_DriverPy_i, + PVSERVER_Impl): + """ + Construct an instance of PVSERVER module engine. + The class PVSERVER implements CORBA interface PVSERVER_Gen (see PVSERVER_Gen.idl). + It is inherited from the classes SALOME_ComponentPy_i (implementation of + Engines::EngineComponent CORBA interface - SALOME component) and SALOME_DriverPy_i + (implementation of SALOMEDS::Driver CORBA interface - SALOME module's engine). + """ + def __init__ ( self, orb, poa, contID, containerName, instanceName, + interfaceName ): + SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, + contID, containerName, instanceName, interfaceName, 0) + SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName) + PVSERVER_Impl.__init__(self) + # + self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + # + + """ Override base class destroy to make sure we try to kill the pvserver + before leaving. + """ + def destroy(self): + self.StopPVServer() + # Invokes super(): + SALOME_ComponentPy.destroy(self) + + """ + Get version information. + """ + def getVersion( self ): + import salome_version + return salome_version.getVersion("PVSERVER", True) + + def GetIOR(self): + return PVSERVER_utils.getEngineIOR() + + """ + Create object. + """ + def createObject( self, study, name ): + MESSAGE("createObject()") + self._createdNew = True # used for getModifiedData method + builder = study.NewBuilder() + father = findOrCreateComponent( study ) + object = builder.NewObject( father ) + attr = builder.FindOrCreateAttribute( object, "AttributeName" ) + attr.SetValue( name ) + attr = builder.FindOrCreateAttribute( object, "AttributeLocalID" ) + attr.SetValue( PVSERVER_utils.objectID() ) + pass + + """ + Dump module data to the Python script. + """ + def DumpPython( self, study, isPublished, isMultiFile ): + MESSAGE("dumpPython()") + abuffer = self.GetPythonTraceString().split("\n") + if isMultiFile: + abuffer = [ " " + s for s in abuffer ] + abuffer[0:0] = [ "def RebuildData( theStudy ):" ] + abuffer += [ " pass" ] + abuffer += [ "\0" ] + return ("\n".join( abuffer ), 1) + + """ + Import file to restore module data + """ + def importData(self, studyId, dataContainer, options): + MESSAGE("importData()") + # get study by Id + obj = self._naming_service.Resolve("myStudyManager") + myStudyManager = obj._narrow(SALOMEDS.StudyManager) + study = myStudyManager.GetStudyByID(studyId) + # create all objects from the imported stream + stream = dataContainer.get() + for objname in stream.split("\n"): + if len(objname) != 0: + self.createObject(study, objname) + self._createdNew = False # to store the modification of the study information later + return ["objects"] # identifier what is in this file + + def getModifiedData(self, studyId): + MESSAGE("getModifiedData()") + if self._createdNew: + # get study by Id + obj = self._naming_service.Resolve("myStudyManager") + myStudyManager = obj._narrow(SALOMEDS.StudyManager) + study = myStudyManager.GetStudyByID(studyId) + # iterate all objects to get their names and store this information in stream + stream="" + father = study.FindComponent( moduleName() ) + if father: + iter = study.NewChildIterator( father ) + while iter.More(): + name = iter.Value().GetName() + stream += name + "\n" + iter.Next() + # store stream to the temporary file to send it in DataContainer + dataContainer = SALOME_DataContainerPy_i(stream, "", "objects", False, True) + aVar = dataContainer._this() + return [aVar] + return [] diff --git a/src/ENGINE/no_wrap/PVSERVER_utils.py b/src/ENGINE/no_wrap/PVSERVER_utils.py new file mode 100644 index 00000000..aa6f8c0d --- /dev/null +++ b/src/ENGINE/no_wrap/PVSERVER_utils.py @@ -0,0 +1,199 @@ +# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- +# File : PVSERVER_utils.py +# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +# --- +# +__all__ = [ + "moduleID", + "objectID", + "unknownID", + "moduleName", + "modulePixmap", + "verbose", + "getORB", + "getNS", + "getLCC", + "getStudyManager", + "getEngine", + "getEngineIOR", + "findOrCreateComponent", + "getObjectID", + ] + +from omniORB import CORBA +from SALOME_NamingServicePy import SALOME_NamingServicePy_i +from LifeCycleCORBA import LifeCycleCORBA +import SALOMEDS +import SALOMEDS_Attributes_idl +import PVSERVER_ORB +import os + +### +# Get PVSERVER module's ID +### +def moduleID(): + MODULE_ID = 1000 + return MODULE_ID + +### +# Get PVSERVER object's ID +### +def objectID(): + OBJECT_ID = 1010 + return OBJECT_ID + +### +# Get unknown ID +### +def unknownID(): + FOREIGN_ID = -1 + return FOREIGN_ID + +### +# Get PVSERVER module's name +### +def moduleName(): + return "PVSERVER" + +### +# Get module's pixmap name +### +def modulePixmap(): + return "PVSERVER_small.png" + +### +# Get verbose level +### +__verbose__ = None +def verbose(): + global __verbose__ + if __verbose__ is None: + try: + __verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) ) + except: + __verbose__ = 0 + pass + pass + return __verbose__ + +### +# Get ORB reference +### +__orb__ = None +def getORB(): + global __orb__ + if __orb__ is None: + __orb__ = CORBA.ORB_init( [''], CORBA.ORB_ID ) + pass + return __orb__ + +### +# Get naming service instance +### +__naming_service__ = None +def getNS(): + global __naming_service__ + if __naming_service__ is None: + __naming_service__ = SALOME_NamingServicePy_i( getORB() ) + pass + return __naming_service__ + +## +# Get life cycle CORBA instance +## +__lcc__ = None +def getLCC(): + global __lcc__ + if __lcc__ is None: + __lcc__ = LifeCycleCORBA( getORB() ) + pass + return __lcc__ + +## +# Get study manager +### +__study_manager__ = None +def getStudyManager(): + global __study_manager__ + if __study_manager__ is None: + obj = getNS().Resolve( '/myStudyManager' ) + __study_manager__ = obj._narrow( SALOMEDS.StudyManager ) + pass + return __study_manager__ + +### +# Get PVSERVER engine +### +__engine__ = None +def getEngine(): + global __engine__ + if __engine__ is None: + __engine__ = getLCC().FindOrLoadComponent( "FactoryServer", moduleName() ) + pass + return __engine__ + +### +# Get PVSERVER engine IOR +### +def getEngineIOR(): + IOR = "" + if getORB() and getEngine(): + IOR = getORB().object_to_string( getEngine() ) + pass + return IOR + +### +# Find or create PVSERVER component object in a study +### +def findOrCreateComponent( study ): + father = study.FindComponent( moduleName() ) + if father is None: + builder = study.NewBuilder() + father = builder.NewComponent( moduleName() ) + attr = builder.FindOrCreateAttribute( father, "AttributeName" ) + attr.SetValue( moduleName() ) + attr = builder.FindOrCreateAttribute( father, "AttributePixMap" ) + attr.SetPixMap( modulePixmap() ) + attr = builder.FindOrCreateAttribute( father, "AttributeLocalID" ) + attr.SetValue( moduleID() ) + try: + builder.DefineComponentInstance( father, getEngine() ) + pass + except: + pass + pass + return father + +### +# Get object's ID +### +def getObjectID( study, entry ): + ID = unknownID() + if study and entry: + sobj = study.FindObjectID( entry ) + if sobj is not None: + test, anAttr = sobj.FindAttribute( "AttributeLocalID" ) + if test: ID = anAttr._narrow( SALOMEDS.AttributeLocalID ).Value() + pass + pass + return ID + diff --git a/src/PVGUI/CMakeLists.txt b/src/PVGUI/CMakeLists.txt index 4f387fee..21921142 100644 --- a/src/PVGUI/CMakeLists.txt +++ b/src/PVGUI/CMakeLists.txt @@ -57,7 +57,7 @@ SET(_link_LIBRARIES ${MED_SalomeIDLMED} ${_PARAVIEW_APP_COMPO_LIB} ${GUI_PVViewer} - SalomeIDLPARAVIS + SalomeIDLPVServer ) # --- headers --- diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index ccf2167f..c8c1f421 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -29,9 +29,9 @@ #include // Python first #include "PVGUI_Module.h" -#ifdef PARAVIS_WITH_FULL_CORBA -# include "PARAVIS_Gen_i.hh" -#endif +//#ifdef PARAVIS_WITH_FULL_CORBA +//# include "PARAVIS_Gen_i.hh" +//#endif #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) #include CORBA_SERVER_HEADER(SALOMEDS) @@ -141,10 +141,11 @@ //---------------------------------------------------------------------------- PVGUI_Module* ParavisModule = 0; -PARAVIS_ORB::PARAVIS_Gen_var PVGUI_Module::MyEngine; +PVSERVER_ORB::PVSERVER_Gen_var PVGUI_Module::MyEngine; /*! \mainpage + TODO TODO update this:

Building and installing PARAVIS

As any other SALOME module, PARAVIS requires PARAVIS_ROOT_DIR environment variable to be set to PARAVIS @@ -210,45 +211,45 @@ PARAVIS_ORB::PARAVIS_Gen_var PVGUI_Module::MyEngine; SALOME module wrapping ParaView GUI. */ -//_PTR(SComponent) -//ClientFindOrCreateParavisComponent(_PTR(Study) theStudyDocument) -//{ -// _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("PARAVIS"); -// if (!aSComponent) { -// _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); -// aStudyBuilder->NewCommand(); -// int aLocked = theStudyDocument->GetProperties()->IsLocked(); -// if (aLocked) theStudyDocument->GetProperties()->SetLocked(false); -// aSComponent = aStudyBuilder->NewComponent("PARAVIS"); -// _PTR(GenericAttribute) anAttr = -// aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName"); -// _PTR(AttributeName) aName (anAttr); -// -// ORB_INIT& init = *SINGLETON_::Instance(); -// CORBA::ORB_var anORB = init( qApp->argc(), qApp->argv() ); -// -// SALOME_NamingService *NamingService = new SALOME_NamingService( anORB ); -// CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); -// SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = -// SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); -// SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "PARAVIS" ); -// if (!Comp->_is_nil()) { -// aName->SetValue(Comp->componentusername()); -// } -// -// anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap"); -// _PTR(AttributePixMap) aPixmap (anAttr); -// aPixmap->SetPixMap( "pqAppIcon16.png" ); -// -// // Create Attribute parameters for future using -// anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeParameter"); -// -// aStudyBuilder->DefineComponentInstance(aSComponent, PVGUI_Module::GetCPPEngine()->GetIOR()); -// if (aLocked) theStudyDocument->GetProperties()->SetLocked(true); -// aStudyBuilder->CommitCommand(); -// } -// return aSComponent; -//} +_PTR(SComponent) +ClientFindOrCreateParavisComponent(_PTR(Study) theStudyDocument) +{ + _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("PVSERVER"); + if (!aSComponent) { + _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); + aStudyBuilder->NewCommand(); + int aLocked = theStudyDocument->GetProperties()->IsLocked(); + if (aLocked) theStudyDocument->GetProperties()->SetLocked(false); + aSComponent = aStudyBuilder->NewComponent("PVSERVER"); + _PTR(GenericAttribute) anAttr = + aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName"); + _PTR(AttributeName) aName (anAttr); + + ORB_INIT& init = *SINGLETON_::Instance(); + CORBA::ORB_var anORB = init( qApp->argc(), qApp->argv() ); + + SALOME_NamingService *NamingService = new SALOME_NamingService( anORB ); + CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); + SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = + SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); + SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "PVSERVER" ); + if (!Comp->_is_nil()) { + aName->SetValue(Comp->componentusername()); + } + + anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap"); + _PTR(AttributePixMap) aPixmap (anAttr); + aPixmap->SetPixMap( "pqAppIcon16.png" ); + + // Create Attribute parameters for future using + anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeParameter"); + + aStudyBuilder->DefineComponentInstance(aSComponent, PVGUI_Module::GetCPPEngine()->GetIOR()); + if (aLocked) theStudyDocument->GetProperties()->SetLocked(true); + aStudyBuilder->CommitCommand(); + } + return aSComponent; +} /*! Clean up function; used to stop ParaView progress events when @@ -316,6 +317,16 @@ PVViewer_EngineWrapper * PVGUI_Module::GetEngine() return PVViewer_EngineWrapper::GetInstance(); } +PVSERVER_ORB::PVSERVER_Gen_var PVGUI_Module::GetCPPEngine() +{ + // initialize PARAVIS module engine (load, if necessary) + if ( CORBA::is_nil( MyEngine ) ) { + Engines::EngineComponent_var comp = + SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "PVSERVER" ); + MyEngine = PVSERVER_ORB::PVSERVER_Gen::_narrow( comp ); + } + return MyEngine; +} /*! \brief Create data model. @@ -663,7 +674,7 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) if ( myRecentMenuId != -1 ) menuMgr()->show(myRecentMenuId); - //ClientFindOrCreateParavisComponent(PARAVIS::GetCStudy(this)); + ClientFindOrCreateParavisComponent(PARAVIS::GetCStudy(this)); return isDone; } @@ -810,9 +821,8 @@ void PVGUI_Module::onModelOpened() */ QString PVGUI_Module::engineIOR() const { -// CORBA::String_var anIOR = GetCPPEngine()->GetIOR(); -// return QString(anIOR.in()); - return QString(""); + CORBA::String_var anIOR = GetCPPEngine()->GetIOR(); + return QString(anIOR.in()); } /*! diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index b5e93b96..b1a5fabe 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -27,9 +27,8 @@ #define PVGUI_Module_H #include -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(PARAVIS_Gen) +#include +#include CORBA_SERVER_HEADER(PVSERVER_Gen) #include #include @@ -166,6 +165,7 @@ public: virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle); inline static PVViewer_EngineWrapper * GetEngine(); + inline static PVSERVER_ORB::PVSERVER_Gen_var GetCPPEngine(); // to be removed once light! inline static pqPVApplicationCore * GetPVApplication(); virtual CAM_DataModel* createDataModel(); @@ -299,7 +299,8 @@ private: PVViewer_GUIElements * myGuiElements; - static PARAVIS_ORB::PARAVIS_Gen_var MyEngine; + static PVSERVER_ORB::PVSERVER_Gen_var MyEngine; + }; #endif // PVGUI_Module_H diff --git a/src/PV_SWIG/CMakeLists.txt b/src/PV_SWIG/CMakeLists.txt index da9f7cb5..4ff3e185 100644 --- a/src/PV_SWIG/CMakeLists.txt +++ b/src/PV_SWIG/CMakeLists.txt @@ -29,7 +29,7 @@ ELSE(SALOME_LIGHT_ONLY) # Use another set of Python files redirecting the API directly # to the original ParaView modules. LIST(APPEND _PYFILES_TO_INSTALL - no_wrap/paravis.py + no_wrap/pvserver.py no_wrap/pvsimple.py no_wrap/presentations.py no_wrap/paravisSM.py diff --git a/src/PV_SWIG/no_wrap/paravis.py b/src/PV_SWIG/no_wrap/paravis.py deleted file mode 100644 index 0562e666..00000000 --- a/src/PV_SWIG/no_wrap/paravis.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2010-2014 CEA/DEN, 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 -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : paravis.py -# Module : PARAVIS -# - -import PARAVIS_utils - -## Initialize PARAVIS interface -myParavisEngine = PARAVIS_utils.getEngine() diff --git a/src/PV_SWIG/no_wrap/pvserver.py b/src/PV_SWIG/no_wrap/pvserver.py new file mode 100644 index 00000000..01577752 --- /dev/null +++ b/src/PV_SWIG/no_wrap/pvserver.py @@ -0,0 +1,26 @@ +# Copyright (C) 2010-2014 CEA/DEN, 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : paravis.py +# Module : PARAVIS +# + +import PVSERVER_utils + +## Initialize PARAVIS interface +myParavisEngine = PVSERVER_utils.getEngine() diff --git a/src/PV_SWIG/no_wrap/pvsimple.py b/src/PV_SWIG/no_wrap/pvsimple.py index 470c8353..51bb1032 100644 --- a/src/PV_SWIG/no_wrap/pvsimple.py +++ b/src/PV_SWIG/no_wrap/pvsimple.py @@ -68,7 +68,7 @@ def ShowParaviewView(): ShowParaviewView() import paraview -import paravis +import pvserver from paraview import simple def SalomeConnectToPVServer():