--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2012 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
+#
+"""
+ Ce module sert à lancer EFICAS configuré pour Code_Aster
+"""
+# Modules Python
+
+# Modules Eficas
+import prefs
+name='prefs_'+prefs.code
+__import__(name)
+
+from InterfaceQT4 import eficas_go
+
+eficas_go.lance_eficas_param(code=prefs.code,fichier="/local/noyret/Eficas_ASTER/adao.comm",version='V0')
Lance l'appli EFICAS pour trouver les noms des groupes
"""
# Analyse des arguments de la ligne de commande
+ from Editeur import session
options=session.parse(sys.argv)
code=options.code
monEditeur=JDCEditor(Eficas,fichier)
print monEditeur.cherche_Groupes()
-def lance_eficas_param(code='MAP',fichier='/local/noyret/Eficas_MAP/creation.comm',ssCode='Creation',version='creation'):
+def lance_eficas_param(code='Adao',fichier='/local/noyret/Eficas_ASTER/adao.comm',version='V0'):
"""
Lance l'appli EFICAS pour trouver les noms des groupes
"""
# Analyse des arguments de la ligne de commande
from Editeur import session
options=session.parse(sys.argv)
- if options.code!= None : code=options.code
- if options.ssCode!= None : ssCode=options.ssCode
from qtEficas import Appli
app = QApplication(sys.argv)
- Eficas=Appli(code=code,ssCode=ssCode)
+ Eficas=Appli(code=code,ssCode=None)
from ssIhm import QWParentSSIhm
parent=QWParentSSIhm(code,Eficas,version)
monreadercata = readercata.READERCATA( parent, Eficas )
Eficas.readercata=monreadercata
-
from editor import JDCEditor
monEditeur=JDCEditor(Eficas,fichier)
- print monEditeur.cherche_Dico()
+ texte=monEditeur.get_text_JDC('python')
+ texte2='jdc+"'+loadJDC(fichier)+'"'
+ print texte2
+ parameters=getJdcParameters(texte,'ASSIMILATION_STUDY')
+ #print getJdcParameters(texte,'CHECKING_STUDY')
+
+def getJdcParameters(jdc,macro):
+ """
+ This function converts the data from the specified macro of the
+ specified jdc text to a python dictionnary whose keys are the
+ names of the data of the macro.
+ """
+ context = {}
+ source = "def args_to_dict(**kwargs): return kwargs \n"
+ source+= "%s = _F = args_to_dict \n"%macro
+ source+= "parameters="+jdc+" \n"
+ source+= "context['parameters'] = parameters \n"
+ code = compile(source, 'file.py', 'exec')
+ eval(code)
+ parameters = context['parameters']
+ return parameters
+
+def loadJDC(filename):
+ """
+ This function loads the text from the specified JdC file. A JdC
+ file is the persistence file of Eficas (*.comm).
+ """
+ fcomm=open(filename,'r')
+ jdc = ""
+ for line in fcomm.readlines():
+ jdc+="%s"%line
+
+ # Warning, we have to make sure that the jdc comes as a simple
+ # string without any extra spaces/newlines
+ return jdc.strip()
if __name__ == "__main__":
import sys