From: André Ribes Date: Wed, 16 Jun 2010 10:05:34 +0000 (+0200) Subject: - daEficas: DATASSIM -> ADAO X-Git-Tag: V6_4_0rc3~143 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6a033450ee6ef0b1b9104db784707eeb551d7ca7;p=modules%2Fadao.git - daEficas: DATASSIM -> ADAO --- diff --git a/src/daEficas/ADAO_Cata_V0.py b/src/daEficas/ADAO_Cata_V0.py new file mode 100644 index 0000000..4d969c7 --- /dev/null +++ b/src/daEficas/ADAO_Cata_V0.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +import Accas +from Accas import * + +JdC = JDC_CATA (code = 'ADAO', + execmodul = None, + regles = ( AU_MOINS_UN ('ASSIM_STUDY')), + ) + +def F_VECTOR(statut) : return FACT(statut = statut, + FROM = SIMP(statut = "o", typ = "TXM", into=("String")), + DATA = SIMP(statut = "o", typ = "TXM"), + ) + +def F_MATRIX(statut) : return FACT(statut = statut, + FROM = SIMP(statut = "o", typ = "TXM", into=("String")), + DATA = SIMP(statut = "o", typ = "TXM"), + ) + +def F_BACKGROUND(statut) : return FACT(statut=statut, + regles = ( UN_PARMI ("VECTOR")), + VECTOR = F_VECTOR("o"), + ) + +def F_BACKGROUND_ERROR(statut) : return FACT(statut=statut, + regles = ( UN_PARMI ("MATRIX")), + MATRIX = F_MATRIX("o"), + ) + +def F_OBSERVATION(statut) : return FACT(statut=statut, + regles = ( UN_PARMI ("VECTOR")), + VECTOR = F_VECTOR("o"), + ) + +def F_OBSERVATION_ERROR(statut) : return FACT(statut=statut, + regles = ( UN_PARMI ("MATRIX")), + MATRIX = F_MATRIX("o"), + ) + +def F_OBSERVATION_OPERATOR(statut) : return FACT(statut=statut, + regles = ( UN_PARMI ("MATRIX", "FUNCTION")), + MATRIX = F_MATRIX("o"), + ) + +def F_ANALYSIS(statut) : return FACT(statut = statut, + FROM = SIMP(statut = "o", typ = "TXM", into=("String", "File")), + STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ", + + STRING = SIMP(statut = "o", typ = "TXM"), + ), + FILE_DATA = BLOC ( condition = " FROM in ( 'File', ) ", + + FILE = SIMP(statut = "o", typ = "Fichier"), + ), + ) + + +ASSIM_STUDY = PROC(nom="ASSIM_STUDY", + op=None, + repetable = "n", + STUDY_NAME = SIMP(statut="o", typ = "TXM"), + ALGORITHM = FACT(statut='o', + regles = ( UN_PARMI ("Blue", "ENSEMBLEBLUE"),), + + Blue = FACT(regles = ( ENSEMBLE ("Background", "BackgroundError", + "Observation", "ObservationError", + "ObservationOperator")), + Background = F_BACKGROUND("o"), + BackgroundError = F_BACKGROUND_ERROR("o"), + Observation = F_OBSERVATION("o"), + ObservationError = F_OBSERVATION_ERROR("o"), + ObservationOperator = F_OBSERVATION_OPERATOR("o"), + Analysis = F_ANALYSIS("f"), + ), + ENSEMBLEBLUE = FACT(BACKGROUND = F_BACKGROUND("o"), + ), + ), + ) + diff --git a/src/daEficas/DATASSIM_Cata_V0.py b/src/daEficas/DATASSIM_Cata_V0.py deleted file mode 100644 index 431e09b..0000000 --- a/src/daEficas/DATASSIM_Cata_V0.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -# -------------------------------------------------- -# debut entete -# -------------------------------------------------- - -import Accas -from Accas import * - -JdC = JDC_CATA (code = 'DATASSIM', - execmodul = None, - regles = ( AU_MOINS_UN ('ASSIM_STUDY')), - ) - -def F_VECTOR(statut) : return FACT(statut = statut, - FROM = SIMP(statut = "o", typ = "TXM", into=("String")), - DATA = SIMP(statut = "o", typ = "TXM"), - ) - -def F_MATRIX(statut) : return FACT(statut = statut, - FROM = SIMP(statut = "o", typ = "TXM", into=("String")), - DATA = SIMP(statut = "o", typ = "TXM"), - ) - -def F_BACKGROUND(statut) : return FACT(statut=statut, - regles = ( UN_PARMI ("VECTOR")), - VECTOR = F_VECTOR("o"), - ) - -def F_BACKGROUND_ERROR(statut) : return FACT(statut=statut, - regles = ( UN_PARMI ("MATRIX")), - MATRIX = F_MATRIX("o"), - ) - -def F_OBSERVATION(statut) : return FACT(statut=statut, - regles = ( UN_PARMI ("VECTOR")), - VECTOR = F_VECTOR("o"), - ) - -def F_OBSERVATION_ERROR(statut) : return FACT(statut=statut, - regles = ( UN_PARMI ("MATRIX")), - MATRIX = F_MATRIX("o"), - ) - -def F_OBSERVATION_OPERATOR(statut) : return FACT(statut=statut, - regles = ( UN_PARMI ("MATRIX", "FUNCTION")), - MATRIX = F_MATRIX("o"), - ) - -def F_ANALYSIS(statut) : return FACT(statut = statut, - FROM = SIMP(statut = "o", typ = "TXM", into=("String", "File")), - STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ", - - STRING = SIMP(statut = "o", typ = "TXM"), - ), - FILE_DATA = BLOC ( condition = " FROM in ( 'File', ) ", - - FILE = SIMP(statut = "o", typ = "Fichier"), - ), - ) - - -ASSIM_STUDY = PROC(nom="ASSIM_STUDY", - op=None, - repetable = "n", - STUDY_NAME = SIMP(statut="o", typ = "TXM"), - ALGORITHM = FACT(statut='o', - regles = ( UN_PARMI ("Blue", "ENSEMBLEBLUE"),), - - Blue = FACT(regles = ( ENSEMBLE ("Background", "BackgroundError", - "Observation", "ObservationError", - "ObservationOperator")), - Background = F_BACKGROUND("o"), - BackgroundError = F_BACKGROUND_ERROR("o"), - Observation = F_OBSERVATION("o"), - ObservationError = F_OBSERVATION_ERROR("o"), - ObservationOperator = F_OBSERVATION_OPERATOR("o"), - Analysis = F_ANALYSIS("f"), - ), - ENSEMBLEBLUE = FACT(BACKGROUND = F_BACKGROUND("o"), - ), - ), - ) - diff --git a/src/daEficas/Makefile.am b/src/daEficas/Makefile.am index bb1f4f5..ba14af5 100644 --- a/src/daEficas/Makefile.am +++ b/src/daEficas/Makefile.am @@ -22,12 +22,12 @@ include $(top_srcdir)/adm_local/make_common_starter.am mypkgpythondir =$(salomepythondir)/daEficas mypkgpython_PYTHON = \ - configuration_DATASSIM.py \ - convert_datassim.py \ - DATASSIM_Cata_V0.py \ - generator_datassim.py \ + configuration_ADAO.py \ + convert_adao.py \ + ADAO_Cata_V0.py \ + generator_adao.py \ __init__.py \ - prefs_DATASSIM.py \ + prefs_ADAO.py \ prefs.py -EXTRA_DIST = prefs_DATASSIM.py.in +EXTRA_DIST = prefs_ADAO.py.in diff --git a/src/daEficas/configuration_ADAO.py b/src/daEficas/configuration_ADAO.py new file mode 100644 index 0000000..a5a30c3 --- /dev/null +++ b/src/daEficas/configuration_ADAO.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +""" + Ce module sert pour charger les paramètres de configuration d'EFICAS +""" +# Modules Python +print "passage dans la surcharge de configuration pour Adao" +import os, sys, string, types, re +import traceback +from PyQt4.QtGui import * + +# Modules Eficas +from Editeur import utils + +# Classe de base permettant de lire, afficher +# et sauvegarder les fichiers utilisateurs +class CONFIG: + + def __init__(self,appli,repIni): + + self.rep_user = os.environ["HOME"] + self.appli = appli + self.code = appli.code + self.rep_ini = repIni + self.savedir = self.rep_user + self.generator_module = "generator_adao" + self.convert_module = "convert_adao" + + # Format des catalogues... + # (code,version,catalogue,formatIn) et ,formatOut) ? + self.catalogues = [] + self.catalogues.append(["ADAO", "V0", os.path.join(self.rep_ini, 'ADAO_Cata_V0.py'), "adao"]) + +def make_config(appli,rep): + + return CONFIG(appli,rep) + +def make_config_style(appli,rep): + + return None diff --git a/src/daEficas/configuration_DATASSIM.py b/src/daEficas/configuration_DATASSIM.py deleted file mode 100644 index 14eb428..0000000 --- a/src/daEficas/configuration_DATASSIM.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Ce module sert pour charger les paramètres de configuration d'EFICAS -""" -# Modules Python -print "passage dans la surcharge de configuration pour Datassim" -import os, sys, string, types, re -import traceback -from PyQt4.QtGui import * - -# Modules Eficas -from Editeur import utils - -# Classe de base permettant de lire, afficher -# et sauvegarder les fichiers utilisateurs -class CONFIG: - - def __init__(self,appli,repIni): - - self.rep_user = os.environ["HOME"] - self.appli = appli - self.code = appli.code - self.rep_ini = repIni - self.savedir = self.rep_user - self.generator_module = "generator_datassim" - self.convert_module = "convert_datassim" - - # Format des catalogues... - # (code,version,catalogue,formatIn) et ,formatOut) ? - self.catalogues = [] - self.catalogues.append(["DATASSIM", "V0", os.path.join(self.rep_ini, 'DATASSIM_Cata_V0.py'), "datassim"]) - -def make_config(appli,rep): - - return CONFIG(appli,rep) - -def make_config_style(appli,rep): - - return None diff --git a/src/daEficas/convert_adao.py b/src/daEficas/convert_adao.py new file mode 100644 index 0000000..d2ff8e4 --- /dev/null +++ b/src/daEficas/convert_adao.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +print "import convert_adao" + +import convert.parseur_python +from convert.convert_python import * + +def entryPoint(): + """ + Retourne les informations nécessaires pour le chargeur de plugins + Ces informations sont retournées dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'adao', + # La factory pour créer une instance du plugin + 'factory' : PythonParser, + } + + diff --git a/src/daEficas/convert_datassim.py b/src/daEficas/convert_datassim.py deleted file mode 100644 index ea64a72..0000000 --- a/src/daEficas/convert_datassim.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -print "import convert_datassim" - -import convert.parseur_python -from convert.convert_python import * - -def entryPoint(): - """ - Retourne les informations nécessaires pour le chargeur de plugins - Ces informations sont retournées dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'datassim', - # La factory pour créer une instance du plugin - 'factory' : PythonParser, - } - - diff --git a/src/daEficas/generator_adao.py b/src/daEficas/generator_adao.py new file mode 100644 index 0000000..b23cf68 --- /dev/null +++ b/src/daEficas/generator_adao.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +print "import generator_adao" + +from generator.generator_python import PythonGenerator + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'adao', + # La factory pour creer une instance du plugin + 'factory' : AdaoGenerator, + } + +class AdaoGenerator(PythonGenerator): + + def __init__(self,cr=None): + PythonGenerator.__init__(self, cr) + self.dictMCVal={} + self.text_comm = "" + self.text_da = "" + self.text_da_status = False + + def gener(self,obj,format='brut',config=None): + print "AdaoGenerator gener" + self.text_comm = PythonGenerator.gener(self, obj, format, config) + + print "Dictionnaire" + print self.dictMCVal + + try : + self.text_da_status = False + self.generate_da() + self.text_da_status = True + except: + print "Case seems not be correct" + pass + return self.text_comm + + def writeDefault(self, fn): + if self.text_da_status: + print "write adao python command file" + filename = fn[:fn.rfind(".")] + '.py' + f = open( str(filename), 'wb') + f.write( self.text_da ) + f.close() + + def generMCSIMP(self,obj) : + """ + Convertit un objet MCSIMP en texte python + """ + clef="" + for i in obj.get_genealogie() : + clef=clef+"__"+i + self.dictMCVal[clef]=obj.valeur + + s=PythonGenerator.generMCSIMP(self,obj) + return s + + def generMCFACT(self,obj): + + if obj.parent.nom == "ALGORITHM": + self.dictMCVal["ALGORITHM_NAME"] = obj.nom + + s=PythonGenerator.generMCFACT(self,obj) + return s + + def generate_da(self): + + self.text_da += "#-*-coding:iso-8859-1-*- \n" + self.text_da += "study_config = {} \n" + self.text_da += "study_config[\"Name\"] = \"" + self.dictMCVal["__ASSIM_STUDY__STUDY_NAME"] + "\"\n" + self.text_da += "study_config[\"Algorithm\"] = \"" + self.dictMCVal["ALGORITHM_NAME"] + "\"\n" + + + self.add_data("Background") + self.add_data("BackgroundError") + self.add_data("Observation") + self.add_data("ObservationError") + self.add_data("ObservationOperator") + self.add_analysis() + + def add_data(self, data_name): + search_text = "__ASSIM_STUDY__ALGORITHM__" + self.dictMCVal["ALGORITHM_NAME"] + "__" + back_search_text = search_text + data_name + "__" + try : + back_from = self.dictMCVal[back_search_text + "VECTOR__FROM"] + back_data = self.dictMCVal[back_search_text + "VECTOR__DATA"] + + self.text_da += data_name + "_config = {} \n" + self.text_da += data_name + "_config[\"Type\"] = \"Vector\" \n" + self.text_da += data_name + "_config[\"From\"] = \"" + back_from + "\" \n" + self.text_da += data_name + "_config[\"Data\"] = \"" + back_data + "\" \n" + self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n" + except: + pass + try : + back_from = self.dictMCVal[back_search_text + "MATRIX__FROM"] + back_data = self.dictMCVal[back_search_text + "MATRIX__DATA"] + + self.text_da += data_name + "_config = {} \n" + self.text_da += data_name + "_config[\"Type\"] = \"Matrix\" \n" + self.text_da += data_name + "_config[\"From\"] = \"" + back_from + "\" \n" + self.text_da += data_name + "_config[\"Data\"] = \"" + back_data + "\" \n" + self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n" + except: + pass + + def add_analysis(self): + search_text = "__ASSIM_STUDY__ALGORITHM__" + self.dictMCVal["ALGORITHM_NAME"] + "__Analysis__" + try : + ana_from = self.dictMCVal[search_text + "FROM"] + print ana_from + if ana_from == "String": + ana_data = self.dictMCVal[search_text + "STRING_DATA__STRING"] + self.text_da += "Analysis_config = {} \n" + self.text_da += "Analysis_config[\"From\"] = \"String\" \n" + self.text_da += "Analysis_config[\"Data\"] = \"\"\"" + ana_data + "\"\"\" \n" + self.text_da += "study_config[\"Analysis\"] = Analysis_config \n" + pass + if ana_from == "File": + ana_data = self.dictMCVal[search_text + "FILE_DATA__FILE"] + self.text_da += "Analysis_config = {} \n" + self.text_da += "Analysis_config[\"From\"] = \"File\" \n" + self.text_da += "Analysis_config[\"Data\"] = \"" + ana_data + "\" \n" + self.text_da += "study_config[\"Analysis\"] = Analysis_config \n" + pass + except: + pass + diff --git a/src/daEficas/generator_datassim.py b/src/daEficas/generator_datassim.py deleted file mode 100644 index 1520939..0000000 --- a/src/daEficas/generator_datassim.py +++ /dev/null @@ -1,134 +0,0 @@ -# -*- coding: utf-8 -*- -print "import generator_datassim" - -from generator.generator_python import PythonGenerator - -def entryPoint(): - """ - Retourne les informations necessaires pour le chargeur de plugins - - Ces informations sont retournees dans un dictionnaire - """ - return { - # Le nom du plugin - 'name' : 'datassim', - # La factory pour creer une instance du plugin - 'factory' : DatassimGenerator, - } - -class DatassimGenerator(PythonGenerator): - - def __init__(self,cr=None): - PythonGenerator.__init__(self, cr) - self.dictMCVal={} - self.text_comm = "" - self.text_da = "" - self.text_da_status = False - - def gener(self,obj,format='brut',config=None): - print "DatassimGenerator gener" - self.text_comm = PythonGenerator.gener(self, obj, format, config) - - print "Dictionnaire" - print self.dictMCVal - - try : - self.text_da_status = False - self.generate_da() - self.text_da_status = True - except: - print "Case seems not be correct" - pass - return self.text_comm - - def writeDefault(self, fn): - if self.text_da_status: - print "write datassim python command file" - filename = fn[:fn.rfind(".")] + '.py' - f = open( str(filename), 'wb') - f.write( self.text_da ) - f.close() - - def generMCSIMP(self,obj) : - """ - Convertit un objet MCSIMP en texte python - """ - clef="" - for i in obj.get_genealogie() : - clef=clef+"__"+i - self.dictMCVal[clef]=obj.valeur - - s=PythonGenerator.generMCSIMP(self,obj) - return s - - def generMCFACT(self,obj): - - if obj.parent.nom == "ALGORITHM": - self.dictMCVal["ALGORITHM_NAME"] = obj.nom - - s=PythonGenerator.generMCFACT(self,obj) - return s - - def generate_da(self): - - self.text_da += "#-*-coding:iso-8859-1-*- \n" - self.text_da += "study_config = {} \n" - self.text_da += "study_config[\"Name\"] = \"" + self.dictMCVal["__ASSIM_STUDY__STUDY_NAME"] + "\"\n" - self.text_da += "study_config[\"Algorithm\"] = \"" + self.dictMCVal["ALGORITHM_NAME"] + "\"\n" - - - self.add_data("Background") - self.add_data("BackgroundError") - self.add_data("Observation") - self.add_data("ObservationError") - self.add_data("ObservationOperator") - self.add_analysis() - - def add_data(self, data_name): - search_text = "__ASSIM_STUDY__ALGORITHM__" + self.dictMCVal["ALGORITHM_NAME"] + "__" - back_search_text = search_text + data_name + "__" - try : - back_from = self.dictMCVal[back_search_text + "VECTOR__FROM"] - back_data = self.dictMCVal[back_search_text + "VECTOR__DATA"] - - self.text_da += data_name + "_config = {} \n" - self.text_da += data_name + "_config[\"Type\"] = \"Vector\" \n" - self.text_da += data_name + "_config[\"From\"] = \"" + back_from + "\" \n" - self.text_da += data_name + "_config[\"Data\"] = \"" + back_data + "\" \n" - self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n" - except: - pass - try : - back_from = self.dictMCVal[back_search_text + "MATRIX__FROM"] - back_data = self.dictMCVal[back_search_text + "MATRIX__DATA"] - - self.text_da += data_name + "_config = {} \n" - self.text_da += data_name + "_config[\"Type\"] = \"Matrix\" \n" - self.text_da += data_name + "_config[\"From\"] = \"" + back_from + "\" \n" - self.text_da += data_name + "_config[\"Data\"] = \"" + back_data + "\" \n" - self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n" - except: - pass - - def add_analysis(self): - search_text = "__ASSIM_STUDY__ALGORITHM__" + self.dictMCVal["ALGORITHM_NAME"] + "__Analysis__" - try : - ana_from = self.dictMCVal[search_text + "FROM"] - print ana_from - if ana_from == "String": - ana_data = self.dictMCVal[search_text + "STRING_DATA__STRING"] - self.text_da += "Analysis_config = {} \n" - self.text_da += "Analysis_config[\"From\"] = \"String\" \n" - self.text_da += "Analysis_config[\"Data\"] = \"\"\"" + ana_data + "\"\"\" \n" - self.text_da += "study_config[\"Analysis\"] = Analysis_config \n" - pass - if ana_from == "File": - ana_data = self.dictMCVal[search_text + "FILE_DATA__FILE"] - self.text_da += "Analysis_config = {} \n" - self.text_da += "Analysis_config[\"From\"] = \"File\" \n" - self.text_da += "Analysis_config[\"Data\"] = \"" + ana_data + "\" \n" - self.text_da += "study_config[\"Analysis\"] = Analysis_config \n" - pass - except: - pass - diff --git a/src/daEficas/prefs.py b/src/daEficas/prefs.py index 5f7de2f..b4c2182 100644 --- a/src/daEficas/prefs.py +++ b/src/daEficas/prefs.py @@ -1,2 +1,2 @@ # Fichier obligatoire ne devant que contenir la variable code... -code = "DATASSIM" +code = "ADAO" diff --git a/src/daEficas/prefs_ADAO.py.in b/src/daEficas/prefs_ADAO.py.in index 801e5fa..182b0f7 100644 --- a/src/daEficas/prefs_ADAO.py.in +++ b/src/daEficas/prefs_ADAO.py.in @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import os, sys -print "import des prefs de Datassim" +print "import des prefs de Adao" # Configuration de Eficas # INSTALLDIR, REPINI est obligatoire