X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=InterfaceQT4%2FmonViewTexte.py;h=ee796eb72db2c83f55e606bdc93934f6c2875b10;hb=4aec96ddfcd8ae0e817b0aaf827f008015a4bf5b;hp=e4c8e770b49d5a56d216ac8bfc20004ead4c12b0;hpb=45496e147f519f4e64795eff3f414cc65b72c1fd;p=tools%2Feficas.git
diff --git a/InterfaceQT4/monViewTexte.py b/InterfaceQT4/monViewTexte.py
index e4c8e770..ee796eb7 100644
--- a/InterfaceQT4/monViewTexte.py
+++ b/InterfaceQT4/monViewTexte.py
@@ -22,8 +22,14 @@ import string,types,os
import traceback
from Extensions.i18n import tr
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
+
+from determine import monEnvQT5
+if monEnvQT5 :
+ from PyQt5.QtWidgets import QDialog, QMessageBox, QFileDialog
+ from PyQt5.QtCore import QSize
+else :
+ from PyQt4.QtGui import *
+ from PyQt4.QtCore import *
from desViewTexte import Ui_dView
# ------------------------------- #
@@ -38,8 +44,12 @@ class ViewText(Ui_dView,QDialog):
self.setupUi(self)
self.resize( QSize(largeur,hauteur).expandedTo(self.minimumSizeHint()) )
- self.connect( self.bclose,SIGNAL("clicked()"), self, SLOT("close()") )
- self.connect( self.bsave,SIGNAL("clicked()"), self.saveFile )
+ if monEnvQT5 :
+ self.bclose.clicked.connect(self.close)
+ self.bsave.clicked.connect(self.saveFile )
+ else :
+ self.connect( self.bclose,SIGNAL("clicked()"), self, SLOT("close()") )
+ self.connect( self.bsave,SIGNAL("clicked()"), self.saveFile )
if entete != None : self.setWindowTitle (entete)
if entete != None : self.setText (texte)
@@ -56,7 +66,10 @@ class ViewText(Ui_dView,QDialog):
fn = QFileDialog.getSaveFileName(None,
tr("Sauvegarder le fichier"),
dir)
- if fn.isNull() : return
+ if monEnvQT5 : fn=fn[0]
+ if fn == "" : return
+ if fn == None : return (0, None)
+
ulfile = os.path.abspath(unicode(fn))
if self.editor != None :
self.editor.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
@@ -67,6 +80,8 @@ class ViewText(Ui_dView,QDialog):
return 1
except IOError, why:
QMessageBox.critical(self, tr("Sauvegarder le fichier"),
- tr("Le fichier %(v_1)s n'a pu etre sauvegarde.
Raison : %(v_2)s", {'v_1': unicode(fn), 'v_2': unicode(why)}))
+ tr('Le fichier')+str(fn) + tr('n a pas pu etre sauvegarde : ') + str(why))
return
+
+