Qt5 migration

This commit is contained in:
Paul RASCLE 2016-10-21 14:47:37 +02:00
parent 766145cb04
commit 0bd9fcdbe7
3 changed files with 56 additions and 65 deletions

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>959</width> <width>974</width>
<height>618</height> <height>618</height>
</rect> </rect>
</property> </property>

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>663</width> <width>664</width>
<height>624</height> <height>624</height>
</rect> </rect>
</property> </property>

View File

@ -35,20 +35,20 @@ def fissureGeneraleDlg(context):
import os import os
#import subprocess #import subprocess
#import tempfile #import tempfile
from PyQt4 import QtCore from PyQt5 import QtCore
from PyQt4 import QtGui from PyQt5 import QtWidgets
from PyQt4.QtGui import QFileDialog from PyQt5 import QtGui
from PyQt4.QtGui import QMessageBox from PyQt5.QtWidgets import QFileDialog
from PyQt4.QtGui import QPalette from PyQt5.QtWidgets import QMessageBox
from PyQt4.QtGui import QColor from PyQt5.QtGui import QPalette
from PyQt4.QtCore import QString from PyQt5.QtGui import QColor
from fissureGenerale_ui import Ui_Dialog from fissureGenerale_ui import Ui_Dialog
class fissureGeneraleDialog(QtGui.QDialog): class fissureGeneraleDialog(QtWidgets.QDialog):
def __init__(self): def __init__(self):
print "__init__" print "__init__"
QtGui.QDialog.__init__(self) QtWidgets.QDialog.__init__(self)
# Set up the user interface from Designer. # Set up the user interface from Designer.
self.ui = Ui_Dialog() self.ui = Ui_Dialog()
self.ui.setupUi(self) self.ui.setupUi(self)
@ -63,27 +63,17 @@ def fissureGeneraleDlg(context):
self.ui.lb_calcul.hide() self.ui.lb_calcul.hide()
# Connect up the buttons. # Connect up the buttons.
self.connect(self.ui.pb_exemple, QtCore.SIGNAL("clicked()"),
self.genereExemples) self.ui.pb_exemple.clicked.connect(self.genereExemples)
self.connect(self.ui.pb_valPrec, QtCore.SIGNAL("clicked()"), self.ui.pb_valPrec.clicked.connect(self.readValPrec)
self.readValPrec) self.ui.pb_reset.clicked.connect(self.resetVal)
self.connect(self.ui.pb_reset, QtCore.SIGNAL("clicked()"), self.ui.pb_recharger.clicked.connect(self.recharger)
self.resetVal) self.ui.pb_sauver.clicked.connect(self.sauver)
self.connect(self.ui.pb_recharger, QtCore.SIGNAL("clicked()"), self.ui.pb_maillage.clicked.connect(self.selectMaillage)
self.recharger) self.ui.pb_facefiss.clicked.connect(self.selectFacefiss)
self.connect(self.ui.pb_sauver, QtCore.SIGNAL("clicked()"), self.ui.pb_reptrav.clicked.connect(self.selectReptrav)
self.sauver) self.ui.bb_OkCancel.accepted.disconnect(self.accept)
self.connect(self.ui.pb_maillage, QtCore.SIGNAL("clicked()"), self.ui.bb_OkCancel.accepted.connect(self.execute)
self.selectMaillage)
self.connect(self.ui.pb_facefiss, QtCore.SIGNAL("clicked()"),
self.selectFacefiss)
self.connect(self.ui.pb_reptrav, QtCore.SIGNAL("clicked()"),
self.selectReptrav)
self.connect(self.ui.pb_nomres, QtCore.SIGNAL("clicked()"),
self.selectNomres)
self.disconnect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"), self.accept)
self.connect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"),
self.execute)
def initDefaut(self): def initDefaut(self):
self.defaut = dict( self.defaut = dict(
@ -241,6 +231,7 @@ def fissureGeneraleDlg(context):
fileDiag.setViewMode(QFileDialog.List) fileDiag.setViewMode(QFileDialog.List)
if fileDiag.exec_() : if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles() fileNames = fileDiag.selectedFiles()
print fileNames
filedef = fileNames[0] filedef = fileNames[0]
if filedef[-4:] not in ['.dic']: if filedef[-4:] not in ['.dic']:
filedef += '.dic' filedef += '.dic'
@ -370,7 +361,7 @@ def fissureGeneraleDlg(context):
# texte += repr(ligne) +"<br>" # texte += repr(ligne) +"<br>"
mbox = QMessageBox(self) mbox = QMessageBox(self)
mbox.setWindowTitle("erreur blocFissure") mbox.setWindowTitle("erreur blocFissure")
mbox.setText(QString.fromUtf8(texte)) mbox.setText(str(texte))
mbox.exec_() mbox.exec_()
# except Exception as erreur: # except Exception as erreur:
# print "exception non répertoriée" # print "exception non répertoriée"