]> SALOME platform Git repositories - tools/eficas.git/blob - InterfaceQT4/gereTraduction.py
Salome HOME
c93edcb0b38b6937146ce0c89fa4d635f39eb754
[tools/eficas.git] / InterfaceQT4 / gereTraduction.py
1 from PyQt4 import *
2 from PyQt4.QtGui import *
3 from PyQt4.QtCore import *
4 import os
5
6
7 def traduction(directPath,editor,version):
8     if version == "V7V8" : 
9        from Traducteur import traduitV7V8 
10        suffixe="v8.comm"
11     if version == "V8V9" : 
12        from Traducteur import traduitV8V9 
13        suffixe="v9.comm"
14     fn = QFileDialog.getOpenFileName( 
15                         editor.appliEficas,
16                         editor.appliEficas.trUtf8('Traduire Fichier'),
17                         QString(directPath) ,
18                         editor.appliEficas.trUtf8('JDC Files (*.comm);;''All Files (*)'))
19
20     FichieraTraduire=str(fn)
21     if (FichieraTraduire == "" or FichieraTraduire == () ) : return
22     i=FichieraTraduire.rfind(".")
23     Feuille=FichieraTraduire[0:i]
24     FichierTraduit=Feuille+suffixe
25
26     i=Feuille.rfind("/")
27     directLog=Feuille[0:i]
28     log=directLog+"/convert.log"
29     os.system("rm -rf "+log)
30     os.system("rm -rf "+FichierTraduit)
31     print "hhhhhhhhhhhhhhhhhhhhhhhhhhhh"
32
33     qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
34     if version == "V7V8" : traduitV7V8.traduc(FichieraTraduire,FichierTraduit,log)
35     if version == "V8V9" : traduitV8V9.traduc(FichieraTraduire,FichierTraduit,log)
36     qApp.setOverrideCursor(QCursor(Qt.ArrowCursor))
37
38     Entete="Fichier Traduit : "+FichierTraduit +"\n\n"
39     if  os.stat(log)[6] != 0L :
40         f=open(log)
41         texte= f.read()
42         f.close()
43     else :
44        texte = Entete  
45        commande="diff "+FichieraTraduire+" "+FichierTraduit+" >/dev/null"
46        try :
47          if os.system(commande) == 0 :
48             texte = texte + "Pas de difference entre le fichier origine et le fichier traduit"
49        except :
50          pass
51
52     from monVisu import DVisu
53     titre = "conversion de "+ FichieraTraduire
54     monVisuDialg=DVisu(parent=editor.appliEficas,fl=0)
55     monVisuDialg.setWindowTitle(titre)
56     monVisuDialg.TB.setText(texte)
57     monVisuDialg.show()
58