From 40c908ed14b6d8caa39de2d8012798d5af073b63 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Mon, 22 Jul 2019 09:42:11 +0200 Subject: [PATCH] Minor message and documentation corrections --- doc/en/advanced.rst | 30 ++++++++++ doc/fr/advanced.rst | 32 ++++++++++- src/daComposant/daCore/Aidsm.py | 2 + src/daComposant/daCore/Interfaces.py | 73 ++++++++++++++---------- src/daComposant/daCore/NumericObjects.py | 3 +- 5 files changed, 107 insertions(+), 33 deletions(-) diff --git a/doc/en/advanced.rst b/doc/en/advanced.rst index 5dc694d..f0a4e18 100644 --- a/doc/en/advanced.rst +++ b/doc/en/advanced.rst @@ -290,6 +290,32 @@ The most comprehensive cases, proposed in :ref:`subsection_tui_advanced`, can be executed in the same way, and they give the same result as in the standard Python interface. +.. _section_advanced_eficas_gui: + +Using the EFICAS graphical interface as an ADAO TUI command +----------------------------------------------------------- + +To make it easier to quickly edit an ADAO command file with EFICAS (JDC, or +pair of files ".comm/.py", that are together in a directory), you can launch +the graphical user interface from the Python interpreter. To do this, in a +Python interpreter obtained from the "SALOME shell", the following commands are +used:: + + from adao import adaoBuilder + adaoBuilder.Gui() + +If necessary, explicit messages can be used to identify the required +environment variables that are missing. However, this command should not be run +in the SALOME Python console (because in this case it is enough to activate the +module...) but it can be done in a "SALOME shell" session obtained from the +"Tools/Extensions" menu of SALOME. As a reminder, the easiest way to get a +Python interpreter included in a "SALOME shell" session is to run the following +command in a terminal:: + + $SALOMEDIR/salome shell -- python + +with ``SALOMEDIR`` the ````. + .. _section_advanced_execution_mode: Change the default execution mode of nodes in YACS @@ -358,6 +384,8 @@ of the ADAO calculation. To implement these "*observer*" efficiently, one can look to the :ref:`section_ref_observers_requirements`. +.. _section_advanced_logging: + Getting more information when running a calculation --------------------------------------------------- @@ -454,6 +482,8 @@ operator function before and during enabling parallelism... It is also recalled that one have to choose the type "*multi*" for the default container in order to launch the scheme, to allow a really parallel execution. +.. _subsection_new_adao_version: + Switching from a version of ADAO to a newer one ----------------------------------------------- diff --git a/doc/fr/advanced.rst b/doc/fr/advanced.rst index 4bd3ba6..3da11c8 100644 --- a/doc/fr/advanced.rst +++ b/doc/fr/advanced.rst @@ -41,7 +41,7 @@ paire de fichiers ".comm/.py", qui se trouvent dans le répertoire ````) automatiquement en utilisant un script de commandes Shell "type" contenant toutes les étapes requises. Si la commande principale de lancement de SALOME, nommée ``salome``, n'est pas couramment accessible dans un -terminal courant, l'utilisateur doit savoir où se trouvent les principaux +terminal standard, l'utilisateur doit savoir où se trouvent les principaux fichiers de lancement de SALOME, et en particulier ce fichier ``salome``. Le répertoire dans lequel ce fichier réside est symboliquement nommé ```` et doit être remplacé par le bon dans le @@ -305,6 +305,32 @@ Les cas plus complets, proposés dans les :ref:`subsection_tui_advanced`, peuven être exécutés de la même manière, et ils donnent le même résultat que dans l'interface API/TUI en Python standard. +.. _section_advanced_eficas_gui: + +Utiliser l'interface graphique EFICAS comme une commande TUI d'ADAO +------------------------------------------------------------------- + +Pour faciliter l'édition rapide avec EFICAS d'un fichier de commandes ADAO +(JDC, ou paire de fichiers ".comm/.py", qui se trouvent ensemble dans un +répertoire), on peut lancer l'interface graphique depuis l'interpréteur Python. +Pour cela, dans un interpréteur Python obtenu depuis le "SALOME shell", on +utilise les commandes suivantes:: + + from adao import adaoBuilder + adaoBuilder.Gui() + +si nécessaire, des messages explicites permettent d'identifier les variables +d'environnement requises qui seraient absentes. Cette commande ne doit +néanmoins pas être lancée dans la console Python de SALOME (car dans ce cas il +suffit d'activer le module...), mais elle peut l'être dans une session "SALOME +shell" obtenue depuis le menu "Outils/Extensions" de SALOME. Pour mémoire, le +moyen le plus simple d'obtenir un interpréteur Python inclu dans une session +"SALOME shell" est de lancer la commande suivante dans un terminal:: + + $SALOMEDIR/salome shell -- python + +avec ``SALOMEDIR`` le ````. + .. _section_advanced_execution_mode: Changer le mode par défaut d'exécution de noeuds dans YACS @@ -379,6 +405,8 @@ d'exécution de SALOME. Pour mettre en oeuvre ces "*observer*" de manière efficace, on se reportera aux :ref:`section_ref_observers_requirements`. +.. _section_advanced_logging: + Obtenir plus d'information lors du déroulement d'un calcul ---------------------------------------------------------- @@ -484,6 +512,8 @@ On rappelle aussi qu'il faut choisir dans YACS un container par défaut de type "*multi*" pour le lancement du schéma, pour permettre une exécution véritablement parallèle. +.. _subsection_new_adao_version: + Passer d'une version d'ADAO à une nouvelle ------------------------------------------ diff --git a/src/daComposant/daCore/Aidsm.py b/src/daComposant/daCore/Aidsm.py index e753bc4..c669e55 100644 --- a/src/daComposant/daCore/Aidsm.py +++ b/src/daComposant/daCore/Aidsm.py @@ -76,6 +76,8 @@ class Aidsm(object): for ename in ("Observer",): self.__adaoObject[ename] = [] self.__StoredInputs[ename] = [] + self.__StoredInputs["Name"] = self.__name + self.__StoredInputs["Directory"] = self.__directory # # Récupère le chemin du répertoire parent et l'ajoute au path # (Cela complète l'action de la classe PathManagement dans PlatformInfo, diff --git a/src/daComposant/daCore/Interfaces.py b/src/daComposant/daCore/Interfaces.py index 5a47dcf..c84f9d5 100644 --- a/src/daComposant/daCore/Interfaces.py +++ b/src/daComposant/daCore/Interfaces.py @@ -969,64 +969,75 @@ class EficasGUI(object): """ def __init__(self, __addpath = None): # Chemin pour l'installation (ordre important) + self.__msg = "" + self.__path_settings_ok = False + #---------------- if "EFICAS_ROOT" in os.environ: __EFICAS_ROOT = os.environ["EFICAS_ROOT"] __path_ok = True else: - print("\nKeyError:\n"+\ + self.__msg += "\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__ - ) + " You have either to be in SALOME environment, or to set\n"+\ + " this variable in your environment to the right path \"<...>\"\n"+\ + " to find an installed EFICAS application. For example:\n"+\ + " EFICAS_ROOT=\"<...>\" command\n" __path_ok = False try: import adao - __path_ok = True + __path_ok = True and __path_ok except ImportError: - print("\nImportError:\n"+\ + self.__msg += "\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__ - ) + " PYTHONPATH=\"<...>:${PYTHONPATH}\" command\n" __path_ok = False try: import PyQt5 - __path_ok = True + __path_ok = True and __path_ok except ImportError: - print("\nImportError:\n"+\ + self.__msg += "\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." - ) + " installation (less than 5 years), or to be in SALOME environment.\n" __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 that are not explained as above, like some\n"+\ - " incomplete or obsolete Python 3 and module installation.\n"+\ + self.__msg += "\nWarning:\n"+\ + " It seems you have some troubles with your installation.\n"+\ + " Be aware that some other errors may exist, that are not\n"+\ + " explained as above, like some incomplete or obsolete\n"+\ + " Python 3, or incomplete module installation.\n"+\ " \n"+\ " Please correct the above error(s) before launching the\n"+\ - " standalone EFICAS/ADAO interface \"%s\"\n"%__file__ - ) - sys.exit(2) + " standalone EFICAS/ADAO interface.\n" + logging.debug("Some of the ADAO/EFICAS/QT5 paths have not been found") + self.__path_settings_ok = False else: logging.debug("All the ADAO/EFICAS/QT5 paths have been found") - sys.path.insert(0,__EFICAS_ROOT) - sys.path.insert(0,os.path.join(adao.adao_py_dir,"daEficas")) - if __addpath is not None and os.path.exists(os.path.abspath(__addpath)): - sys.path.insert(0,os.path.abspath(__addpath)) - logging.debug("All the paths have been correctly set up") - # + self.__path_settings_ok = True + #---------------- + if self.__path_settings_ok: + sys.path.insert(0,__EFICAS_ROOT) + sys.path.insert(0,os.path.join(adao.adao_py_dir,"daEficas")) + if __addpath is not None and os.path.exists(os.path.abspath(__addpath)): + sys.path.insert(0,os.path.abspath(__addpath)) + logging.debug("All the paths have been correctly set up") + else: + print(self.__msg) + logging.debug("Errors in path settings have been found") + def gui(self): - logging.debug("Launching the standalone EFICAS/ADAO interface...") - from daEficas import prefs - from InterfaceQT4 import eficas_go - eficas_go.lanceEficas(code=prefs.code) + if self.__path_settings_ok: + logging.debug("Launching standalone EFICAS/ADAO interface...") + from daEficas import prefs + from InterfaceQT4 import eficas_go + eficas_go.lanceEficas(code=prefs.code) + else: + logging.debug("Can not launch standalone EFICAS/ADAO interface for path errors.") # ============================================================================== if __name__ == "__main__": diff --git a/src/daComposant/daCore/NumericObjects.py b/src/daComposant/daCore/NumericObjects.py index 0fc96ef..725498b 100644 --- a/src/daComposant/daCore/NumericObjects.py +++ b/src/daComposant/daCore/NumericObjects.py @@ -25,7 +25,8 @@ __doc__ = """ """ __author__ = "Jean-Philippe ARGAUD" -import os, numpy, time, copy, types, sys, math, logging +import os, time, copy, types, sys, logging +import math, numpy, scipy from daCore.BasicObjects import Operator from daCore.PlatformInfo import PlatformInfo mpr = PlatformInfo().MachinePrecision() -- 2.39.2