From: LUCIE BERTHON Date: Mon, 15 Oct 2018 11:37:47 +0000 (+0200) Subject: gestion des dossier X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FMapIdentification;p=tools%2Feficas.git gestion des dossier --- diff --git a/MapIdentification/mesScripts_MAPIDENTIFICATION.py b/MapIdentification/mesScripts_MAPIDENTIFICATION.py index 868b61a2..8510046a 100644 --- a/MapIdentification/mesScripts_MAPIDENTIFICATION.py +++ b/MapIdentification/mesScripts_MAPIDENTIFICATION.py @@ -17,9 +17,6 @@ MAP_KEYS =["output_directory", def writeMAPinput(dictValeur, filename): """ """ - #print("je rentre dans writeMAPinput") - #print (dictValeur) - #print("-"*80) config = RawConfigParser() config.add_section("c_solver_constitutive_law_0d") if dictValeur["constitutive_law_parameters_status"]=="Existing": @@ -59,15 +56,12 @@ def writeMAPinput(dictValeur, filename): filename = os.path.abspath(os.path.splitext(filename)[0] + ".input") with open(filename,'w') as f_out : config.write(f_out) - print("je sauvegarde les inputs dans " + filename) - #os.system("head " + filename) + print("Saving MAP input into " + filename) def writeXMLmaterialparameters(param_dico, output_filename=None): """ """ - #print("je rentre dans writeXMLmaterialparameters") - param_list = ParametersList() param_list.add_law(param_dico["Parameters"]["constitutive_law_formulation"]) if param_dico["Parameters"].has_key("Description"): @@ -95,14 +89,11 @@ def writeXMLmaterialparameters(param_dico, output_filename=None): os.getenv('OLDPWD'), param_dico["constitutive_law_parameters_new"]) writer = ParametersListWriter(output_filename) writer.write(param_list) - print("je sauvegarde les parametres dans " + output_filename) + print("Saving material parameters into " + output_filename) def writeXMLexperiences(exp_dico, output_filename=None): """ """ - #print("je rentre dans writeXMLexperiences") - #for i, j in exp_dico.iteritems(): - #print(i,j) root = ET.Element("Experiences") root.set("map-version", getVersion()) @@ -112,9 +103,6 @@ def writeXMLexperiences(exp_dico, output_filename=None): for iel in [iel for iel in exp_dico["Experiences"].values() if isinstance(iel, dict)]: - #print("."*80) - #for i, j in iel.iteritems(): - #print(i,j) exp = ET.SubElement(root, "Experience") exp.set("name", iel["ExperienceName"]) exp.set("type", iel["Type"]) @@ -160,10 +148,10 @@ def writeXMLexperiences(exp_dico, output_filename=None): os.getenv('OLDPWD'), exp_dico["exp_filename_list_new"]) xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent=" ") - #print xmlstr + with open(output_filename,'w') as f_out : f_out.write(xmlstr) - print("je sauvegarde le plan d'experience dans " + output_filename) + print("Saving experimental plan into " + output_filename) def add_source(root, iel, section_name, var_name): @@ -181,7 +169,8 @@ def add_source(root, iel, section_name, var_name): source_elem.text = str(var["Variable"]["b_source_value"]["Value"]) def run(listeParam): - os.chdir(os.getenv('OLDPWD')) + if os.getenv('OLDPWD'): + os.chdir(os.getenv('OLDPWD')) listeParam[0].saveFile() command = "map -r sappli run -n c_solver_constitutive_law_0d -i " command += os.path.splitext(listeParam[0].fichier)[0]+".input" @@ -197,6 +186,6 @@ def run(listeParam): # - appelable depuis un item valide uniquement # - toolTip dict_commandes={ - 'MAP_input_file':((run,"run",('editor',),False,True,"lance run"),), + 'MAP_input_file':((run, "run", ('editor',) ,False, True, "lance run"),), }