1 # Copyright (C) 2007-2013 EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from PyQt4.QtGui import *
21 from PyQt4.QtCore import *
23 from Extensions.i18n import tr
26 def traduction(directPath,editor,version):
27 if version == "V9V10" :
28 from Traducteur import traduitV9V10
30 if version == "V10V11" :
31 from Traducteur import traduitV10V11
33 if version == "V11V12" :
34 from Traducteur import traduitV11V12
37 fn = QFileDialog.getOpenFileName(
39 tr('Traduire Fichier'),
41 tr('Fichiers JDC (*.comm);;''Tous les Fichiers (*)'))
44 FichieraTraduire=str(fn)
45 if (FichieraTraduire == "" or FichieraTraduire == () ) : return
46 i=FichieraTraduire.rfind(".")
47 Feuille=FichieraTraduire[0:i]
48 FichierTraduit=Feuille+suffixe
51 directLog=Feuille[0:i]
52 log=directLog+"/convert.log"
53 os.system("rm -rf "+log)
54 os.system("rm -rf "+FichierTraduit)
56 qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
57 if version == "V9V10" : traduitV9V10.traduc(FichieraTraduire,FichierTraduit,log)
58 if version == "V10V11" : traduitV10V11.traduc(FichieraTraduire,FichierTraduit,log)
59 if version == "V11V12" : traduitV11V12.traduc(FichieraTraduire,FichierTraduit,log)
60 qApp.setOverrideCursor(QCursor(Qt.ArrowCursor))
62 Entete=tr("Fichier Traduit : %s\n\n",str(FichierTraduit))
63 if os.stat(log)[6] != 0L :
69 commande="diff "+FichieraTraduire+" "+FichierTraduit+" >/dev/null"
71 if os.system(commande) == 0 :
72 texte = texte + tr("Pas de difference entre le fichier origine et le fichier traduit")
76 from monVisu import DVisu
77 titre = "conversion de "+ FichieraTraduire
78 monVisuDialg=DVisu(parent=editor.appliEficas,fl=0)
79 monVisuDialg.setWindowTitle(titre)
80 monVisuDialg.TB.setText(texte)