From: Jean-Philippe ARGAUD Date: Sat, 11 May 2019 17:55:17 +0000 (+0200) Subject: Update standalone EFICAS/ADAO interface and installation X-Git-Tag: V9_4_0b1~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23362b0858fb506c318685dc72fd29eb0345ac5a;p=modules%2Fadao.git Update standalone EFICAS/ADAO interface and installation --- diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 54cce6a..f40cd7d 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -18,11 +18,15 @@ # # Author: Anthony Geay, anthony.geay@edf.fr, EDF R&D -set(EFICAS_DIR "${EFICAS_ROOT_DIR}") -set(PYTHON_SITE "${CMAKE_INSTALL_PREFIX}/${ADAO_SCRIPT_PYTHON}") -SALOME_CONFIGURE_FILE(qtEficas_adao_study.py.in qtEficas_adao_study.py) - -install(FILES AdaoYacsSchemaCreator.py ${CMAKE_CURRENT_BINARY_DIR}/qtEficas_adao_study.py DESTINATION ${ADAO_BIN}) +install( + FILES AdaoYacsSchemaCreator.py + DESTINATION ${ADAO_BIN} +) +install( + FILES gui_Adao_QT_Eficas.py + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + DESTINATION ${ADAO_BIN} +) INSTALL( CODE "MACRO(GENERATE_EFICAS_CATA_FOR_ADAO PY_EXE_CATA ADAO_CATA_GEN_FILE OUTPUT_DIR CATA_ADD_PYTHONPATH) set(ENV{PYTHONPATH} \${CATA_ADD_PYTHONPATH}:\$ENV{PYTHONPATH}) diff --git a/bin/Makefile.am b/bin/Makefile.am index 7f5ace2..a541c59 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -22,14 +22,15 @@ include $(top_srcdir)/adm_local/make_common_starter.am -bin_SCRIPTS = AdaoYacsSchemaCreator.py qtEficas_adao_study.py # AdaoCatalogGenerator.py module_version.py +bin_SCRIPTS = AdaoYacsSchemaCreator.py gui_Adao_QT_Eficas.py # AdaoCatalogGenerator.py module_version.py -EXTRA_DIST = AdaoYacsSchemaCreator.py qtEficas_adao_study.py.in # AdaoCatalogGenerator.py module_version.py +EXTRA_DIST = AdaoYacsSchemaCreator.py gui_Adao_QT_Eficas.py # AdaoCatalogGenerator.py module_version.py ADAODIR = $(DESTDIR)$(salomepythondir)/adao install-data-hook: @export PYTHONPATH="$(DESTDIR)${salomepythondir}:${PYTHONPATH}" && python${PYTHON_VERSION} $(top_srcdir)/bin/AdaoCatalogGenerator.py $(ADAODIR)/daEficas ADAO_Cata_V0.py + @chmod 755 $(top_srcdir)/bin/gui_Adao_QT_Eficas.py uninstall-hook: @rm $(ADAODIR)/daEficas/ADAO_Cata_V0.py diff --git a/bin/gui_Adao_QT_Eficas.py b/bin/gui_Adao_QT_Eficas.py new file mode 100755 index 0000000..26a73fb --- /dev/null +++ b/bin/gui_Adao_QT_Eficas.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2008-2019 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. +# +# 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: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +""" + Launching the standalone EFICAS/ADAO interface +""" + +import os, sys + +# ============================================================================== +# Chemin pour l'installation (ordre important) +if "EFICAS_ROOT" in os.environ: + EFICAS_ROOT = os.environ["EFICAS_ROOT"] + __path_ok = True +else: + print("\nKeyError:\n"+\ + " the required environment variable EFICAS_ROOT is unknown.\n"+\ + " You have either to be in SALOME environment, or to set this\n"+\ + " variable in your environment to the right path \"<...>\" to find\n"+\ + " an installed EFICAS application. For example:\n"+\ + " EFICAS_ROOT=\"<...>\" %s"%__file__ + ) + __path_ok = False +try: + import adao + __path_ok = True +except ImportError: + print("\nImportError:\n"+\ + " the required ADAO library can not be found to be imported.\n"+\ + " You have either to be in ADAO environment, or to be in SALOME\n"+\ + " environment, or to set manually in your Python 3 environment the\n"+\ + " right path \"<...>\" to find an installed ADAO application. For\n"+\ + " example:\n"+\ + " PYTHONPATH=\"<...>:${PYTHONPATH}\" %s"%__file__ + ) + __path_ok = False +try: + import PyQt5 + __path_ok = True +except ImportError: + print("\nImportError:\n"+\ + " the required PyQt5 library can not be found to be imported.\n"+\ + " You have either to have a raisonable up-to-date Python 3\n"+\ + " installation (less than 5 years), or to be in SALOME environment." + ) + __path_ok = False +if not __path_ok: + print("\nWarning:\n"+\ + " It seems you have some troubles with your installation. It may\n"+\ + " exists other errors than are not explained as above, like some\n"+\ + " incomplete or obsolete Python 3 and module installation.\n"+\ + " \n"+\ + " Please correct the above error(s) before launching the\n"+\ + " standalone EFICAS/ADAO interface \"%s\"\n"%__file__ + ) + sys.exit(2) +else: + print("Launching the standalone EFICAS/ADAO interface...") +sys.path.insert(0,EFICAS_ROOT) +sys.path.insert(0,os.path.join(adao.adao_py_dir,"daEficas")) + +# ============================================================================== +# Préférences et module EFICAS +from daEficas import prefs +from InterfaceQT4 import eficas_go + +eficas_go.lanceEficas(code=prefs.code) +# ============================================================================== diff --git a/bin/qtEficas_adao_study.py.in b/bin/qtEficas_adao_study.py.in deleted file mode 100644 index 6f97f41..0000000 --- a/bin/qtEficas_adao_study.py.in +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2008-2019 EDF R&D -# -# This file is part of SALOME ADAO module -# -# 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. -# -# 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: André Ribes, andre.ribes@edf.fr, EDF R&D - -""" - Ce module sert a lancer EFICAS pour Adao -""" - -import sys -# Configuration de l'installation -INSTALLDIR = "@EFICAS_DIR@" -sys.path.insert(0,INSTALLDIR) -ADAO_INSTALL_DIR = "@PYTHON_SITE@/adao/daEficas" -sys.path.insert(0,ADAO_INSTALL_DIR) - -# Configuration -import prefs -import prefs_ADAO - -# Modules Eficas -from InterfaceQT4 import eficas_go -eficas_go.lance_eficas(code=prefs.code) diff --git a/src/daSalome/__init__.py b/src/daSalome/__init__.py index 068c16d..efc21d9 100644 --- a/src/daSalome/__init__.py +++ b/src/daSalome/__init__.py @@ -124,7 +124,8 @@ requirement of quoting. """ import os, sys, logging -sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) +adao_py_dir = os.path.abspath(os.path.dirname(__file__)) +sys.path.insert(0, adao_py_dir) from daCore.version import name, version, year, date try: