from PyQt4 import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
+import time
+from datetime import date
+
# Modules Eficas
if execution=="oui" :
print "il faut faire le run dans Salome"
- #-----------------------------#
- def saveRun(self):
- #-----------------------------#
- texte=self.run(execution="non")
- path=self.CONFIGURATION.savedir
- fn = QFileDialog.getSaveFileName( self,
+
+ #-----------------------------------------------------#
+ def determineNomFichier(self,path,extension):
+ #-----------------------------------------------------#
+ if DictExtensions.has_key(self.appli.code) :
+ chaine1="JDC (*"+DictExtensions[self.appli.code]+");;"
+ extensions= self.trUtf8(chaine1+ "All Files (*)")
+ else :
+ extensions= self.trUtf8("JDC (*.comm);;" "All Files (*)")
+
+ if self.appli.code == "MAP" :
+ extensions = extensions + ";;Schema Yacs (*.xml);; Run (*.py);;"
+
+ fn = QFileDialog.getSaveFileName( self,
self.trUtf8("sauvegarde"), path,
- self.trUtf8("Run (*.py);;" "All Files (*)"),None,
+ extensions,None,
QFileDialog.DontConfirmOverwrite)
- if fn.isNull(): return
- ext = QFileInfo(fn).suffix()
- if ext.isEmpty(): fn.append(".py")
-
- if QFileInfo(fn).exists():
- abort = QMessageBox.warning(self,
- self.trUtf8("Sauvegarde du Fichier"),
- self.trUtf8("Le fichier <b>%1</b> existe deja.").arg(fn),
- self.trUtf8("&Ecraser"),
- self.trUtf8("&Abandonner"))
- if abort == 1 : return
-
- fn = unicode(QDir.convertSeparators(fn))
- self.writeFile( fn, txt = texte)
+ print fn
+ if fn.isNull(): return (0, None)
+ ext = QFileInfo(fn).suffix()
+ if ext.isEmpty(): fn.append(extension)
+
+ if QFileInfo(fn).exists():
+ abort = QMessageBox.warning(self,
+ self.trUtf8("Sauvegarde du Fichier"),
+ self.trUtf8("Le fichier <b>%1</b> existe deja.").arg(fn),
+ self.trUtf8("&Ecraser"),
+ self.trUtf8("&Abandonner"))
+ if abort == 1 : return (0, "")
+ return (1,fn)
+
+ def saveRun(self):
+ #-----------------#
+ texte=self.run(execution="non")
+ extension=".py"
+
+ if hasattr(self,'fichierRun'):
+ self.writeFile( self.fichierRun, txt = texte)
+ return
+
+ if self.fichier == None :
+ path=self.CONFIGURATION.savedir
+ else :
+ path=QFileInfo(self.fichier).absolutePath()+"/"+QFileInfo(self.fichier).baseName()+".py"
+ bOK, fn=self.determineNomFichier(path,extension)
+ if fn == "" : return
+ self.fichierRun = unicode(QDir.convertSeparators(fn))
+ self.writeFile( self.fichierRun, txt = texte)
#-----------------------------#
def saveYACS(self):
#-----------------------------#
- path=self.CONFIGURATION.savedir
- fn = QFileDialog.getSaveFileName( self,
- self.trUtf8("sauvegarde"), path,
- self.trUtf8("Schema YACS (*.xml);;" "All Files (*)"),None,
- QFileDialog.DontConfirmOverwrite)
- if fn.isNull(): return
- ext = QFileInfo(fn).suffix()
- if ext.isEmpty(): fn.append(".xml")
-
- if QFileInfo(fn).exists():
- abort = QMessageBox.warning(self,
- self.trUtf8("Sauvegarde du Fichier"),
- self.trUtf8("Le fichier <b>%1</b> existe deja.").arg(fn),
- self.trUtf8("&Ecraser"),
- self.trUtf8("&Abandonner"))
- if abort == 1 : return
- fn = unicode(QDir.convertSeparators(fn))
-
- texte=self.runYACS(execution="non",nomFichier=fn)
+ if hasattr(self,'fichierYACS'):
+ self.runYACS(execution="non",nomFichier=self.fichierYACS)
+ return
+
+ today = str(date.today())
+ today = today.replace('-', '')
+ today+="-"+time.strftime("%H%M%S", time.localtime())
+ path=self.CONFIGURATION.PATH_STUDY+"/"+self.CONFIGURATION.NAME_SCHEME+"_"+today+".xml"
+ extension=".xml"
+
+ bOK, fn=self.determineNomFichier(path,extension)
+ if fn == "" : return
+ self.runYACS(execution="non",nomFichier=self.fichierYACS)
+
#-----------------------------------------#
def cherche_Groupes(self):
if not self.modified and not saveas:
return (0, None) # do nothing if text wasn't changed
+ extension='.py'
+ if DictExtensions.has_key(self.appli.code) :
+ extension=DictExtensions[self.appli.code]
+ else :
+ extension='.comm'
+
newName = None
+ fn = self.fichier
if self.fichier is None or saveas:
if path is None:
path=self.CONFIGURATION.savedir
- selectedFilter = QString('')
- if DictExtensions.has_key(self.appli.code) :
- chaine1="JDC (*"+DictExtensions[self.appli.code]+");;"
- extensions= self.trUtf8(chaine1+ "All Files (*)")
- else :
- extensions= self.trUtf8("JDC (*.comm);;" "All Files (*)")
- fn = QFileDialog.getSaveFileName( self,
- self.trUtf8("sauvegarde"), path,
- extensions,None,
- QFileDialog.DontConfirmOverwrite)
+ bOK, fn=self.determineNomFichier(path,extension)
if fn.isNull(): return (0, None)
+
ulfile = os.path.abspath(unicode(fn))
self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
-
- ext = QFileInfo(fn).suffix()
- if ext.isEmpty():
- if DictExtensions.has_key(self.appli.code) :
- fn.append(DictExtensions[self.appli.code])
- else :
- fn.append(".comm")
-
- if QFileInfo(fn).exists():
- abort = QMessageBox.warning(self,
- self.trUtf8("Sauvegarde du Fichier"),
- self.trUtf8("Le fichier <b>%1</b> existe deja.").arg(fn),
- self.trUtf8("&Ecraser"),
- self.trUtf8("&Abandonner"))
- if abort == 1 : return (0, None)
-
fn = unicode(QDir.convertSeparators(fn))
newName = fn
- else:
- fn = self.fichier
-
- if self.writeFile(fn):
- self.fichier = fn
- self.modified = False
- if self.fileInfo is None or saveas:
- self.fileInfo = QFileInfo(self.fichier)
- self.fileInfo.setCaching(0)
- self.lastModified = self.fileInfo.lastModified()
- if newName is not None:
- self.appliEficas.addToRecentList(newName)
- self.tree.racine.item.getObject().nom=os.path.basename(newName)
- self.tree.racine.update_node_label()
-
- if self.jdc.isvalid() != 0 :
- try :
- fileXML = fn[:fn.rfind(".")] + '.xml'
- self.generator.writeOpenturnsXML( fileXML )
- except :
- pass
+ if not (self.writeFile(fn)): return (0, None)
+ self.fichier = fn
+ self.modified = False
+ if self.fileInfo is None or saveas:
+ self.fileInfo = QFileInfo(self.fichier)
+ self.fileInfo.setCaching(0)
+ self.lastModified = self.fileInfo.lastModified()
+ if newName is not None:
+ self.appliEficas.addToRecentList(newName)
+ self.tree.racine.item.getObject().nom=os.path.basename(newName)
+ self.tree.racine.update_node_label()
- try :
- fileSTD = fn[:fn.rfind(".")] + '.py'
- self.generator.writeOpenturnsSTD( fileSTD )
- except :
- pass
-
- try:
- self.generator.writeDefault(fn)
- except:
- pass
-
- try :
- fileCuve2DG = fn[:fn.rfind(".")] + '.don'
- self.generator.writeCuve2DG(fileCuve2DG)
- except :
- pass
+ if self.jdc.isvalid() != 0 :
+ try:
+ self.generator.writeDefault(fn)
+ except:
+ pass
-
- if self.salome :
+ if self.salome :
self.appliEficas.addJdcInSalome( self.fichier)
-
- return (1, self.fichier)
- else:
- return (0, None)
+ return (1, self.fichier)
#
#---------------------------------#
def saveFileAs(self, path = None):
<script><code><![CDATA[import sys
import os
-sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'),'MAP/Templates/s_polymers_st_1'))
+#sys.path.append(os.path.join(os.getenv('EFICAS_ROOT'),'MAP/Templates/s_polymers_st_1'))
from s_polymers_st_1_YACS_nodes import *
lambda_x=component_fdvgrid(lambda_I, lambda_M, rve_size, file_inclusions, finesse)
]]></code></script>
<inport name="result_gmsh" type="string"/>
</inline>
- <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
<control> <fromnode>pygmee_v2</fromnode> <tonode>benhur</tonode> </control>
- <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
- <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
- <control> <fromnode>init</fromnode> <tonode>benhur</tonode> </control>
+ <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
<control> <fromnode>init</fromnode> <tonode>aster_s_polymers_st_1</tonode> </control>
+ <control> <fromnode>init</fromnode> <tonode>benhur</tonode> </control>
+ <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
+ <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
<control> <fromnode>benhur</fromnode> <tonode>aster_s_polymers_st_1</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>aster_s_polymers_st_1</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>benhur</tonode> </control>
+ <control> <fromnode>env</fromnode> <tonode>fdvgrid</tonode> </control>
<control> <fromnode>env</fromnode> <tonode>pygmee_v2</tonode> </control>
<control> <fromnode>env</fromnode> <tonode>init</tonode> </control>
- <control> <fromnode>env</fromnode> <tonode>fdvgrid</tonode> </control>
- <control> <fromnode>env</fromnode> <tonode>benhur</tonode> </control>
- <control> <fromnode>env</fromnode> <tonode>aster_s_polymers_st_1</tonode> </control>
<control> <fromnode>aster_s_polymers_st_1</fromnode> <tonode>gmsh_post</tonode> </control>
<datalink control="false">
<fromnode>pygmee_v2</fromnode> <fromport>result_inclusions</fromport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
+ <tonode>aster_s_polymers_st_1</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>fdvgrid</tonode> <toport>rve_size</toport>
+ <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>benhur</tonode> <toport>rve_size</toport>
+ <tonode>fdvgrid</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>rve_size</fromport>
- <tonode>aster_s_polymers_st_1</tonode> <toport>rve_size</toport>
+ <tonode>benhur</tonode> <toport>rve_size</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>finesse</fromport>
- <tonode>fdvgrid</tonode> <toport>finesse</toport>
+ <tonode>aster_s_polymers_st_1</tonode> <toport>finesse</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>finesse</fromport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>finesse</fromport>
- <tonode>aster_s_polymers_st_1</tonode> <toport>finesse</toport>
+ <tonode>fdvgrid</tonode> <toport>finesse</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>lambda_I</fromport>
- <tonode>fdvgrid</tonode> <toport>lambda_I</toport>
+ <tonode>aster_s_polymers_st_1</tonode> <toport>lambda_I</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>lambda_I</fromport>
- <tonode>aster_s_polymers_st_1</tonode> <toport>lambda_I</toport>
+ <tonode>fdvgrid</tonode> <toport>lambda_I</toport>
</datalink>
<datalink control="false">
<fromnode>init</fromnode> <fromport>lambda_M</fromport>
</datalink>
<datalink control="false">
<fromnode>env</fromnode> <fromport>study_name</fromport>
- <tonode>init</tonode> <toport>study_name</toport>
+ <tonode>fdvgrid</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
<fromnode>env</fromnode> <fromport>study_name</fromport>
- <tonode>fdvgrid</tonode> <toport>study_name</toport>
+ <tonode>benhur</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
<fromnode>env</fromnode> <fromport>study_name</fromport>
- <tonode>benhur</tonode> <toport>study_name</toport>
+ <tonode>init</tonode> <toport>study_name</toport>
</datalink>
<datalink control="false">
<fromnode>env</fromnode> <fromport>study_name</fromport>
<tonode>benhur</tonode><toport>file_inclusions</toport>
<value><string></string></value>
</parameter>
- <presentation name="pygmee_v2" x="583" y="470.25" width="158" height="279" expanded="1" expx="0" expy="0" expWidth="158" expHeight="279" shownState="0"/>
- <presentation name="init" x="273" y="199.75" width="158" height="306" expanded="1" expx="0" expy="0" expWidth="158" expHeight="306" shownState="0"/>
- <presentation name="fdvgrid" x="869" y="80.25" width="158" height="225" expanded="1" expx="0" expy="0" expWidth="158" expHeight="225" shownState="0"/>
+ <presentation name="aster_s_polymers_st_1" x="1132" y="271.75" width="158" height="252" expanded="1" expx="1132" expy="271.75" expWidth="158" expHeight="252" shownState="0"/>
<presentation name="benhur" x="869" y="510.25" width="158" height="171" expanded="1" expx="0" expy="0" expWidth="158" expHeight="171" shownState="0"/>
- <presentation name="env" x="9" y="301.25" width="158" height="117" expanded="1" expx="0" expy="0" expWidth="158" expHeight="117" shownState="0"/>
- <presentation name="aster_s_polymers_st_1" x="1133" y="271.75" width="158" height="252" expanded="1" expx="0" expy="0" expWidth="158" expHeight="252" shownState="0"/>
+ <presentation name="fdvgrid" x="869" y="80.25" width="158" height="225" expanded="1" expx="0" expy="0" expWidth="158" expHeight="225" shownState="0"/>
<presentation name="gmsh_post" x="1397.25" y="373.25" width="158" height="63" expanded="1" expx="0" expy="0" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="env" x="9" y="301.25" width="158" height="117" expanded="1" expx="0" expy="0" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="pygmee_v2" x="583" y="470.25" width="158" height="279" expanded="1" expx="0" expy="0" expWidth="158" expHeight="279" shownState="0"/>
+ <presentation name="init" x="273" y="199.75" width="158" height="306" expanded="1" expx="0" expy="0" expWidth="158" expHeight="306" shownState="0"/>
<presentation name="__ROOT__" x="0" y="0" width="1559.25" height="753.25" expanded="1" expx="0" expy="0" expWidth="1559.25" expHeight="753.25" shownState="0"/>
</proc>