Salome HOME
Adding ParallelFunctionTest algorithm and improve parallel modes
[modules/adao.git] / bin / gui_Adao_QT_Eficas.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright (C) 2008-2019 EDF R&D
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 """
25    Launching the standalone EFICAS/ADAO interface
26 """
27
28 import os, sys
29
30 # ==============================================================================
31 # Chemin pour l'installation (ordre important)
32 if "EFICAS_ROOT" in os.environ:
33     EFICAS_ROOT = os.environ["EFICAS_ROOT"]
34     __path_ok = True
35 else:
36     print("\nKeyError:\n"+\
37         "  the required environment variable EFICAS_ROOT is unknown.\n"+\
38         "  You have either to be in SALOME environment, or to set this\n"+\
39         "  variable in your environment to the right path \"<...>\" to find\n"+\
40         "  an installed EFICAS application. For example:\n"+\
41         "    EFICAS_ROOT=\"<...>\" %s"%__file__
42         )
43     __path_ok = False
44 try:
45     import adao
46     __path_ok = True
47 except ImportError:
48     print("\nImportError:\n"+\
49         "  the required ADAO library can not be found to be imported.\n"+\
50         "  You have either to be in ADAO environment, or to be in SALOME\n"+\
51         "  environment, or to set manually in your Python 3 environment the\n"+\
52         "  right path \"<...>\" to find an installed ADAO application. For\n"+\
53         "  example:\n"+\
54         "    PYTHONPATH=\"<...>:${PYTHONPATH}\" %s"%__file__
55         )
56     __path_ok = False
57 try:
58     import PyQt5
59     __path_ok = True
60 except ImportError:
61     print("\nImportError:\n"+\
62         "  the required PyQt5 library can not be found to be imported.\n"+\
63         "  You have either to have a raisonable up-to-date Python 3\n"+\
64         "  installation (less than 5 years), or to be in SALOME environment."
65         )
66     __path_ok = False
67 if not __path_ok:
68     print("\nWarning:\n"+\
69         "  It seems you have some troubles with your installation. It may\n"+\
70         "  exists other errors than are not explained as above, like some\n"+\
71         "  incomplete or obsolete Python 3 and module installation.\n"+\
72         "  \n"+\
73         "  Please correct the above error(s) before launching the\n"+\
74         "  standalone EFICAS/ADAO interface \"%s\"\n"%__file__
75           )
76     sys.exit(2)
77 else:
78     print("Launching the standalone EFICAS/ADAO interface...")
79 sys.path.insert(0,EFICAS_ROOT)
80 sys.path.insert(0,os.path.join(adao.adao_py_dir,"daEficas"))
81
82 # ==============================================================================
83 # Préférences et module EFICAS
84 from daEficas import prefs
85 from InterfaceQT4 import eficas_go
86
87 eficas_go.lanceEficas(code=prefs.code)
88 # ==============================================================================