PyQt4/PyQt5 support.

This commit is contained in:
rnv 2016-01-28 17:40:22 +03:00
parent 63c75f2e20
commit 02593a6a3d
38 changed files with 195 additions and 251 deletions

View File

@ -24,8 +24,7 @@
import os, subprocess import os, subprocess
from MGCleanerPlugDialog_ui import Ui_MGCleanerPlugDialog from MGCleanerPlugDialog_ui import Ui_MGCleanerPlugDialog
from MGCleanerMonViewText import MGCleanerMonViewText from MGCleanerMonViewText import MGCleanerMonViewText
from PyQt4.QtGui import * from qtsalome import *
from PyQt4.QtCore import *
class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
@ -105,28 +104,28 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
self.clean() self.clean()
def connecterSignaux(self) : def connecterSignaux(self) :
self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed) self.PB_Cancel.clicked.connect(self.PBCancelPressed)
self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean) self.PB_Default.clicked.connect(self.clean)
self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed) self.PB_Help.clicked.connect(self.PBHelpPressed)
self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed) self.PB_OK.clicked.connect(self.PBOKPressed)
self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed) self.PB_Load.clicked.connect(self.PBLoadPressed)
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed) self.PB_Save.clicked.connect(self.PBSavePressed)
self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed) self.PB_LoadHyp.clicked.connect(self.PBLoadHypPressed)
self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed) self.PB_SaveHyp.clicked.connect(self.PBSaveHypPressed)
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed) self.PB_MeshFile.clicked.connect(self.PBMeshFilePressed)
self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed) self.PB_MeshSmesh.clicked.connect(self.PBMeshSmeshPressed)
self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged) self.LE_MeshSmesh.returnPressed.connect(self.meshSmeshNameChanged)
self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName) self.PB_ParamsFileExplorer.clicked.connect(self.setParamsFileName)
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged) self.LE_MeshFile.returnPressed.connect(self.meshFileNameChanged)
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged) self.LE_ParamsFile.returnPressed.connect(self.paramsFileNameChanged)
#QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL("stateChanged(int)"), self.change) #QtCore.QObject.connect(self.checkBox, QtCore.SIGNAL("stateChanged(int)"), self.change)
self.connect(self.CB_FillHoles,SIGNAL("stateChanged(int)"),self.SP_MinHoleSize.setEnabled) self.CB_FillHoles.stateChanged[int].connect(self.SP_MinHoleSize.setEnabled)
self.connect(self.CB_ComputedToleranceDisplacement,SIGNAL("stateChanged(int)"),self.SP_ToleranceDisplacement.setDisabled) self.CB_ComputedToleranceDisplacement.stateChanged[int].connect(self.SP_ToleranceDisplacement.setDisabled)
self.connect(self.CB_ComputedResolutionLength,SIGNAL("stateChanged(int)"),self.SP_ResolutionLength.setDisabled) self.CB_ComputedResolutionLength.stateChanged[int].connect(self.SP_ResolutionLength.setDisabled)
self.connect(self.CB_ComputedOverlapDistance,SIGNAL("stateChanged(int)"),self.SP_OverlapDistance.setDisabled) self.CB_ComputedOverlapDistance.stateChanged[int].connect(self.SP_OverlapDistance.setDisabled)
def PBHelpPressed(self): def PBHelpPressed(self):
import SalomePyQt import SalomePyQt
@ -406,7 +405,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_MeshFile.setText(infile) self.LE_MeshFile.setText(infile)
self.fichierIn=infile.toLatin1() self.fichierIn=unicode(infile).encode("latin-1")
self.MeshIn="" self.MeshIn=""
self.LE_MeshSmesh.setText("") self.LE_MeshSmesh.setText("")
@ -415,7 +414,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_ParamsFile.setText(infile) self.LE_ParamsFile.setText(infile)
self.paramsFile=infile.toLatin1() self.paramsFile=unicode(infile).encode("latin-1")
def meshFileNameChanged(self): def meshFileNameChanged(self):
self.fichierIn=str(self.LE_MeshFile.text()) self.fichierIn=str(self.LE_MeshFile.text())
@ -595,10 +594,9 @@ def TEST_standalone():
# #
def TEST_MGCleanerMonPlugDialog(): def TEST_MGCleanerMonPlugDialog():
import sys import sys
from PyQt4.QtGui import QApplication from qtsalome import QApplication
from PyQt4.QtCore import QObject, SIGNAL, SLOT
app = QApplication(sys.argv) app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.lastWindowClosed.connect(app.quit)
dlg=MGCleanerMonPlugDialog() dlg=MGCleanerMonPlugDialog()
dlg.show() dlg.show()

View File

@ -22,9 +22,7 @@
import string,types,os import string,types,os
import traceback import traceback
from PyQt4 import * from qtsalome import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
# Import des panels # Import des panels
@ -39,14 +37,14 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
self.setupUi(self) self.setupUi(self)
self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) ) self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
#self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") ) #self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") )
self.connect( self.PB_Ok,SIGNAL("clicked()"), self.theClose ) self.PB_Ok.clicked.connect( self.theClose )
self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile ) self.PB_Save.clicked.connect( self.saveFile )
self.PB_Save.setToolTip("Save trace in log file") self.PB_Save.setToolTip("Save trace in log file")
self.PB_Ok.setToolTip("Close view") self.PB_Ok.setToolTip("Close view")
self.monExe=QProcess(self) self.monExe=QProcess(self)
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut ) self.monExe.readyReadStandardOutput.connect( self.readFromStdOut )
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr ) self.monExe.readyReadStandardError.connect( self.readFromStdErr )
# Je n arrive pas a utiliser le setEnvironment du QProcess # Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ??? # fonctionne hors Salome mais pas dans Salome ???
@ -83,11 +81,11 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
def readFromStdErr(self): def readFromStdErr(self):
a=self.monExe.readAllStandardError() a=self.monExe.readAllStandardError()
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) self.TB_Exe.append(unicode(a.data()))
def readFromStdOut(self) : def readFromStdOut(self) :
a=self.monExe.readAllStandardOutput() a=self.monExe.readAllStandardOutput()
aa=QString.fromUtf8(a.data(),len(a)) aa=unicode(a.data())
self.TB_Exe.append(aa) self.TB_Exe.append(aa)
if "END_OF_MGCleaner" in aa: if "END_OF_MGCleaner" in aa:
self.parent().enregistreResultat() self.parent().enregistreResultat()

View File

@ -30,10 +30,7 @@ def MGCleanerLct(context):
import os import os
import subprocess import subprocess
import tempfile import tempfile
from PyQt4 import QtCore from qtsalome import QFileDialog, QMessageBox
from PyQt4 import QtGui
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QMessageBox
#prior test to avoid unnecessary user GUI work with ending crash #prior test to avoid unnecessary user GUI work with ending crash
try : try :

View File

@ -29,26 +29,20 @@ def MeshCut(context):
import os import os
import subprocess import subprocess
import tempfile import tempfile
from PyQt4 import QtCore from qtsalome import QFileDialog, QMessageBox, QDialog
from PyQt4 import QtGui
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QMessageBox
from MeshCutDialog_ui import Ui_Dialog from MeshCutDialog_ui import Ui_Dialog
class CutDialog(QtGui.QDialog): class CutDialog(QDialog):
def __init__(self): def __init__(self):
QtGui.QDialog.__init__(self) 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)
# Connect up the buttons. # Connect up the buttons.
self.connect(self.ui.pb_origMeshFile, QtCore.SIGNAL("clicked()"), self.ui.pb_origMeshFile.clicked.connect(self.setInputFile)
self.setInputFile) self.ui.pb_cutMeshFile.clicked.connect(self.setOutputFile)
self.connect(self.ui.pb_cutMeshFile, QtCore.SIGNAL("clicked()"), self.ui.pb_help.clicked.connect(self.helpMessage)
self.setOutputFile)
self.connect(self.ui.pb_help, QtCore.SIGNAL("clicked()"),
self.helpMessage)
pass pass
def setInputFile(self): def setInputFile(self):
@ -56,7 +50,7 @@ def MeshCut(context):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.ui.le_origMeshFile.setText(infile) self.ui.le_origMeshFile.setText(infile)
insplit = os.path.splitext(infile.toLocal8Bit().data()) insplit = os.path.splitext(unicode(infile).encode())
outfile = insplit[0] + '_cut' + insplit[1] outfile = insplit[0] + '_cut' + insplit[1]
self.ui.le_cutMeshFile.setText(outfile) self.ui.le_cutMeshFile.setText(outfile)
pass pass
@ -103,11 +97,11 @@ and T the tolerance.
if result: if result:
# dialog accepted # dialog accepted
args = ['MeshCut'] args = ['MeshCut']
args += [window.ui.le_origMeshFile.text().toLocal8Bit().data()] args += [unicode(window.ui.le_origMeshFile.text()).encode()]
args += [window.ui.le_cutMeshFile.text().toLocal8Bit().data()] args += [unicode(window.ui.le_cutMeshFile.text()).encode()]
args += [window.ui.le_outMeshName.text().toLocal8Bit().data()] args += [unicode(window.ui.le_outMeshName.text()).encode()]
args += [window.ui.le_groupAbove.text().toLocal8Bit().data()] args += [unicode(window.ui.le_groupAbove.text()).encode()]
args += [window.ui.le_groupBelow.text().toLocal8Bit().data()] args += [unicode(window.ui.le_groupBelow.text()).encode()]
args += [str(window.ui.dsb_normX.value())] args += [str(window.ui.dsb_normX.value())]
args += [str(window.ui.dsb_normY.value())] args += [str(window.ui.dsb_normY.value())]
args += [str(window.ui.dsb_normZ.value())] args += [str(window.ui.dsb_normZ.value())]

View File

@ -4,7 +4,7 @@ import os
import datetime import datetime
import sys import sys
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableMaillages import TableMaillages from tableMaillages import TableMaillages
from tableMailleurs import TableMailleurs from tableMailleurs import TableMailleurs
from tableMachines import TableMachines from tableMachines import TableMachines
@ -23,7 +23,7 @@ from CreeDocuments.jobHtml import Document
class Base: class Base:
def __init__(self,file): def __init__(self,file):
self.db = QtSql.QSqlDatabase.addDatabase("QSQLITE") self.db = QSqlDatabase.addDatabase("QSQLITE")
self.db.setDatabaseName(file) self.db.setDatabaseName(file)
self.db.setHostName("localhost"); self.db.setHostName("localhost");
self.db.setUserName(""); self.db.setUserName("");

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys,os import sys,os
from PyQt4 import QtGui,QtCore
pathRacine=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..')) pathRacine=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..'))
if os.path.dirname(pathRacine) not in sys.path : if os.path.dirname(pathRacine) not in sys.path :

View File

@ -1,5 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from PyQt4.QtSql import *
import datetime import datetime
class TableDeBase : class TableDeBase :

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableGroupeRatios (TableDeBase): class TableGroupeRatios (TableDeBase):
@ -8,7 +8,7 @@ class TableGroupeRatios (TableDeBase):
self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion','Groupe')) self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion','Groupe'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table GroupesRatios(idMaillage int, idVersion int, Groupe varchar(40)," texteQuery ="create table GroupesRatios(idMaillage int, idVersion int, Groupe varchar(40),"
texteQuery+="RatioMax float, RatioMin float, " texteQuery+="RatioMax float, RatioMin float, "
@ -23,7 +23,7 @@ class TableGroupeRatios (TableDeBase):
print "Creation de TableGroupeRatios : " , query.exec_(texteQuery) print "Creation de TableGroupeRatios : " , query.exec_(texteQuery)
def getVal(self,idMaillage, idVersion, Groupe, Entite): def getVal(self,idMaillage, idVersion, Groupe, Entite):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select '+ str(Entite) + ' from GroupesRatios where idMaillage='+str(idMaillage) texteQuery ='select '+ str(Entite) + ' from GroupesRatios where idMaillage='+str(idMaillage)
texteQuery+=' and idVersion='+str(idVersion) texteQuery+=' and idVersion='+str(idVersion)
texteQuery+=" and Groupe='" + str(Groupe) +"';" texteQuery+=" and Groupe='" + str(Groupe) +"';"

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableGroupeTailles (TableDeBase): class TableGroupeTailles (TableDeBase):
@ -8,7 +8,7 @@ class TableGroupeTailles (TableDeBase):
self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion')) self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table GroupeTailles(idMaillage int, idVersion int, " texteQuery ="create table GroupeTailles(idMaillage int, idVersion int, "
texteQuery+="Groupe varchar(40),TailleMax float, TailleMin float, " texteQuery+="Groupe varchar(40),TailleMax float, TailleMin float, "
@ -24,7 +24,7 @@ class TableGroupeTailles (TableDeBase):
print "Creation de TableGroupeTailles : " , query.exec_(texteQuery) print "Creation de TableGroupeTailles : " , query.exec_(texteQuery)
def getVal(self,idMaillage, idVersion, Groupe, Entite): def getVal(self,idMaillage, idVersion, Groupe, Entite):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select '+ str(Entite) + ' from GroupeTailles where idMaillage='+str(idMaillage) texteQuery ='select '+ str(Entite) + ' from GroupeTailles where idMaillage='+str(idMaillage)
texteQuery+=' and idVersion='+str(idVersion) texteQuery+=' and idVersion='+str(idVersion)
texteQuery+=" and Groupe='" + str(Groupe) +"';" texteQuery+=" and Groupe='" + str(Groupe) +"';"

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableGroupes (TableDeBase): class TableGroupes (TableDeBase):
@ -9,7 +9,7 @@ class TableGroupes (TableDeBase):
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Groupes( nomGroupe varchar(40),idMaillage int, idVersion int," texteQuery ="create table Groupes( nomGroupe varchar(40),idMaillage int, idVersion int,"
@ -23,7 +23,7 @@ class TableGroupes (TableDeBase):
def getVal(self,nomGroupe,idMaillage,idVersion,typeMaille): def getVal(self,nomGroupe,idMaillage,idVersion,typeMaille):
val=0 # Valeur si l enregistrement n existe pas val=0 # Valeur si l enregistrement n existe pas
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select NbEntite from Groupes where nomGroupe ="' + nomGroupe +'"' texteQuery ='select NbEntite from Groupes where nomGroupe ="' + nomGroupe +'"'
texteQuery +=' and idMaillage=' + str(idMaillage) texteQuery +=' and idMaillage=' + str(idMaillage)
texteQuery +=' and idVersion = ' + str(idVersion) texteQuery +=' and idVersion = ' + str(idVersion)
@ -37,7 +37,7 @@ class TableGroupes (TableDeBase):
def getAllEntity(self): def getAllEntity(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="select distinct Entite from Groupes;" texteQuery ="select distinct Entite from Groupes;"
query.exec_(texteQuery) query.exec_(texteQuery)
maListe=[] maListe=[]

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableGroupesRef (TableDeBase): class TableGroupesRef (TableDeBase):
@ -8,14 +8,14 @@ class TableGroupesRef (TableDeBase):
self.setTypeField(('str','int'),('nomGroupe')) self.setTypeField(('str','int'),('nomGroupe'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table GroupesRef(nomGroupe varchar(40), idMaillage int," texteQuery ="create table GroupesRef(nomGroupe varchar(40), idMaillage int,"
texteQuery+="foreign key (idMaillage) references Maillages(idMaillage)," texteQuery+="foreign key (idMaillage) references Maillages(idMaillage),"
texteQuery+="primary key (nomGroupe,idMaillage));" texteQuery+="primary key (nomGroupe,idMaillage));"
print "Creation de TableGroupesRef : " , query.exec_(texteQuery) print "Creation de TableGroupesRef : " , query.exec_(texteQuery)
def getVals(self,idMaillage): def getVals(self,idMaillage):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select NomGroupe from GroupesRef where idMaillage='+str(idMaillage) +";" texteQuery ='select NomGroupe from GroupesRef where idMaillage='+str(idMaillage) +";"
listeGroupes=[] listeGroupes=[]
query.exec_(texteQuery) query.exec_(texteQuery)

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
import os import os
@ -9,7 +9,7 @@ class TableMachines (TableDeBase):
self.setTypeField(('str','str'),('nomMachine')) self.setTypeField(('str','str'),('nomMachine'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
print "creation de TableMachine : ", query.exec_("create table Machines( nomMachine varchar(10) primary key, os varchar(10));") print "creation de TableMachine : ", query.exec_("create table Machines( nomMachine varchar(10) primary key, os varchar(10));")
def creeMachine(self): def creeMachine(self):
@ -18,7 +18,7 @@ class TableMachines (TableDeBase):
self.insereLigne((nomMachine,nomOs)) self.insereLigne((nomMachine,nomOs))
def chercheMachine(self): def chercheMachine(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
machine=os.uname()[1] machine=os.uname()[1]
texteQuery ="select nomMachine from Machines where nomMachine ='" + machine +"' ;" texteQuery ="select nomMachine from Machines where nomMachine ='" + machine +"' ;"
query.exec_(texteQuery) query.exec_(texteQuery)

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableMaillages (TableDeBase): class TableMaillages (TableDeBase):
@ -9,7 +9,7 @@ class TableMaillages (TableDeBase):
self.setTypeField(('int','str','str','str','int','int','int','int','int','int','str'),('id')) self.setTypeField(('int','str','str','str','int','int','int','int','int','int','str'),('id'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Maillages(id integer primary key autoincrement, nomMaillage varchar(10), " texteQuery ="create table Maillages(id integer primary key autoincrement, nomMaillage varchar(10), "
texteQuery+="nomScript varchar(40), medResultat varchar(15), idMailleur int, dimension int," texteQuery+="nomScript varchar(40), medResultat varchar(15), idMailleur int, dimension int,"
texteQuery+="seuilCPU int, seuilRatio int, seuilTaille int, seuilNbMaille int, commentaire varchar(60), " texteQuery+="seuilCPU int, seuilRatio int, seuilTaille int, seuilNbMaille int, commentaire varchar(60), "
@ -17,7 +17,7 @@ class TableMaillages (TableDeBase):
print "creation de TableMaillages : " , query.exec_(texteQuery) print "creation de TableMaillages : " , query.exec_(texteQuery)
def getVal(self,idMaillage, nomChamp): def getVal(self,idMaillage, nomChamp):
query=QtSql.QSqlQuery() query=QSqlQuery()
valeur=None valeur=None
texteQuery ='select '+ nomChamp + ' from Maillages where id=' + str(idMaillage) + ";" texteQuery ='select '+ nomChamp + ' from Maillages where id=' + str(idMaillage) + ";"
query.exec_(texteQuery) query.exec_(texteQuery)
@ -30,7 +30,7 @@ class TableMaillages (TableDeBase):
def dejaRemplie(self): def dejaRemplie(self):
texteQuery="select * from Maillages where medResultat='/tmp/tetra.med';" texteQuery="select * from Maillages where medResultat='/tmp/tetra.med';"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
nb=0 nb=0
while(maQuery.next()): nb=nb+1 while(maQuery.next()): nb=nb+1
@ -44,7 +44,7 @@ class TableMaillages (TableDeBase):
# self.insereLigneAutoId(('Fiche_7957_AILETTE', '/home/H77945/CAS_TEST/MAILLEUR/FICHE_7957_AILETTE/Fiche_7957_AILETTE.py', '/tmp/Fiche_7957_AILETTE.med', 1,2,10,10,10,10, 'Maillage d une attache d aillette')) # self.insereLigneAutoId(('Fiche_7957_AILETTE', '/home/H77945/CAS_TEST/MAILLEUR/FICHE_7957_AILETTE/Fiche_7957_AILETTE.py', '/tmp/Fiche_7957_AILETTE.med', 1,2,10,10,10,10, 'Maillage d une attache d aillette'))
def construitListeMaillages(self): def construitListeMaillages(self):
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
texteQuery="select id, nomScript,medResultat from Maillages;" texteQuery="select id, nomScript,medResultat from Maillages;"
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
listeMaillages=[] listeMaillages=[]
@ -54,7 +54,7 @@ class TableMaillages (TableDeBase):
def verifieListeMaillages(self,listeMaillage): def verifieListeMaillages(self,listeMaillage):
newListeMaillages=[] newListeMaillages=[]
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
for idM in listeMaillage: for idM in listeMaillage:
texteQuery="select id, nomScript,medResultat from Maillages where id = " + str(idM) +';' texteQuery="select id, nomScript,medResultat from Maillages where id = " + str(idM) +';'
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
@ -68,7 +68,7 @@ class TableMaillages (TableDeBase):
def getSeuilsPourMaillage(self,idMaillage): def getSeuilsPourMaillage(self,idMaillage):
texteQuery="select id,nomMaillage,seuilCPU,seuilRatio,seuilTaille,seuilNbMaille from Maillages where id = "+ str(idMaillage) +" ;" texteQuery="select id,nomMaillage,seuilCPU,seuilRatio,seuilTaille,seuilNbMaille from Maillages where id = "+ str(idMaillage) +" ;"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
while(maQuery.next()): while(maQuery.next()):
l1 = maQuery.value(0).toInt()[0] l1 = maQuery.value(0).toInt()[0]
@ -82,7 +82,7 @@ class TableMaillages (TableDeBase):
def getTous(self): def getTous(self):
maillagesIdListe=[]; maillagesNomListe=[] maillagesIdListe=[]; maillagesNomListe=[]
texteQuery="select id,nomMaillage from Maillages order by id;" texteQuery="select id,nomMaillage from Maillages order by id;"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
while(maQuery.next()): while(maQuery.next()):
maillagesIdListe.append( maQuery.value(0).toInt()[0]) maillagesIdListe.append( maQuery.value(0).toInt()[0])
@ -91,7 +91,7 @@ class TableMaillages (TableDeBase):
def getMailleurId(self,idMaillage): def getMailleurId(self,idMaillage):
texteQuery="select idMailleur from Maillages where id = "+ str(idMaillage) +" ;" texteQuery="select idMailleur from Maillages where id = "+ str(idMaillage) +" ;"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
print texteQuery print texteQuery
print maQuery.exec_(texteQuery) print maQuery.exec_(texteQuery)
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableMailles (TableDeBase): class TableMailles (TableDeBase):
@ -9,7 +9,7 @@ class TableMailles (TableDeBase):
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Mailles(idMaillage int, idVersion int, Entite var(40), NbEntite int, " texteQuery ="create table Mailles(idMaillage int, idVersion int, Entite var(40), NbEntite int, "
@ -21,7 +21,7 @@ class TableMailles (TableDeBase):
def getVal(self,idMaillage, idVersion, Entite): def getVal(self,idMaillage, idVersion, Entite):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select NbEntite from Mailles where idMaillage='+str(idMaillage) texteQuery ='select NbEntite from Mailles where idMaillage='+str(idMaillage)
texteQuery+=' and idVersion='+str(idVersion) texteQuery+=' and idVersion='+str(idVersion)
texteQuery+=" and Entite='" + str(Entite) +"';" texteQuery+=" and Entite='" + str(Entite) +"';"
@ -36,7 +36,7 @@ class TableMailles (TableDeBase):
def getAllEntity(self): def getAllEntity(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="select distinct Entite from Mailles;" texteQuery ="select distinct Entite from Mailles;"
query.exec_(texteQuery) query.exec_(texteQuery)
maListe=[] maListe=[]

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableMailleurs (TableDeBase): class TableMailleurs (TableDeBase):
@ -9,12 +9,12 @@ class TableMailleurs (TableDeBase):
self.setTypeField(("int","str"),('id')) self.setTypeField(("int","str"),('id'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
print "Creation de TableMailleurs", query.exec_("create table Mailleurs(id integer primary key autoincrement, nomMailleur varchar(40));") print "Creation de TableMailleurs", query.exec_("create table Mailleurs(id integer primary key autoincrement, nomMailleur varchar(40));")
def dejaRemplie(self): def dejaRemplie(self):
texteQuery="select * from Mailleurs where nomMailleur='Blsurf+Ghs3D';" texteQuery="select * from Mailleurs where nomMailleur='Blsurf+Ghs3D';"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
nb=0 nb=0
while(maQuery.next()): nb=nb+1 while(maQuery.next()): nb=nb+1
@ -33,7 +33,7 @@ class TableMailleurs (TableDeBase):
def insereLigneAutoId(self,valeurs,debug=False): def insereLigneAutoId(self,valeurs,debug=False):
# difficulte a construire le texte avec une seule valeur # difficulte a construire le texte avec une seule valeur
texteQuery='insert into Mailleurs (nomMailleur) values ("'+ str(valeurs[0])+ '");' texteQuery='insert into Mailleurs (nomMailleur) values ("'+ str(valeurs[0])+ '");'
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
if debug : print texteQuery, " " , maQuery.exec_(texteQuery) if debug : print texteQuery, " " , maQuery.exec_(texteQuery)
else : maQuery.exec_(texteQuery) else : maQuery.exec_(texteQuery)
@ -41,7 +41,7 @@ class TableMailleurs (TableDeBase):
l1=[] l1=[]
l2=[] l2=[]
texteQuery="select * from Mailleurs;" texteQuery="select * from Mailleurs;"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
while(maQuery.next()): while(maQuery.next()):
l1.append( maQuery.value(0).toInt()[0]) l1.append( maQuery.value(0).toInt()[0])
@ -50,7 +50,7 @@ class TableMailleurs (TableDeBase):
def getName(self,mailleurId): def getName(self,mailleurId):
texteQuery="select nomMailleur from Mailleurs where id = " + str(mailleurId) + " ;" texteQuery="select nomMailleur from Mailleurs where id = " + str(mailleurId) + " ;"
maQuery=QtSql.QSqlQuery() maQuery=QSqlQuery()
maQuery.exec_(texteQuery) maQuery.exec_(texteQuery)
while(maQuery.next()): while(maQuery.next()):
mailleurName=maQuery.value(0).toString() mailleurName=maQuery.value(0).toString()

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TablePerfs (TableDeBase): class TablePerfs (TableDeBase):
@ -8,7 +8,7 @@ class TablePerfs (TableDeBase):
self.setTypeField(('int','int','str','int','int'),('idMaillage','idVersion','Machine')) self.setTypeField(('int','int','str','int','int'),('idMaillage','idVersion','Machine'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Perfs(idMaillage int, idVersion int, Machine varchar(10), NbCpu int, Mem int, " texteQuery ="create table Perfs(idMaillage int, idVersion int, Machine varchar(10), NbCpu int, Mem int, "
texteQuery+="foreign key (idMaillage) references Maillages(id)," texteQuery+="foreign key (idMaillage) references Maillages(id),"
texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="foreign key (idVersion) references Versions(id),"
@ -18,7 +18,7 @@ class TablePerfs (TableDeBase):
print "Creation de TablePerfs : " , query.exec_(texteQuery) print "Creation de TablePerfs : " , query.exec_(texteQuery)
def getVal(self,idMaillage,idVersion,Machine): def getVal(self,idMaillage,idVersion,Machine):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select NbCpu from Perfs where idMaillage=' + str(idMaillage) texteQuery ='select NbCpu from Perfs where idMaillage=' + str(idMaillage)
texteQuery +=' and idVersion = ' + str(idVersion) texteQuery +=' and idVersion = ' + str(idVersion)
texteQuery +=" and Machine ='" + Machine + "';" texteQuery +=" and Machine ='" + Machine + "';"

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableRatios (TableDeBase): class TableRatios (TableDeBase):
@ -8,7 +8,7 @@ class TableRatios (TableDeBase):
self.setTypeField(('int','int','float','float','float','float','float','float'),('idMaillage','idVersion','Machine')) self.setTypeField(('int','int','float','float','float','float','float','float'),('idMaillage','idVersion','Machine'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Ratios(idMaillage int, idVersion int, " texteQuery ="create table Ratios(idMaillage int, idVersion int, "
texteQuery+="RatioMax float, RatioMin float, " texteQuery+="RatioMax float, RatioMin float, "
@ -23,7 +23,7 @@ class TableRatios (TableDeBase):
print "Creation de TableRatios : " , query.exec_(texteQuery) print "Creation de TableRatios : " , query.exec_(texteQuery)
def getVal(self,idMaillage, idVersion, Entite): def getVal(self,idMaillage, idVersion, Entite):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select '+ str(Entite) + ' from Ratios where idMaillage='+str(idMaillage) texteQuery ='select '+ str(Entite) + ' from Ratios where idMaillage='+str(idMaillage)
texteQuery+=' and idVersion='+str(idVersion) texteQuery+=' and idVersion='+str(idVersion)
query.exec_(texteQuery) query.exec_(texteQuery)

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableTailles (TableDeBase): class TableTailles (TableDeBase):
@ -8,7 +8,7 @@ class TableTailles (TableDeBase):
self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion')) self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion'))
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Tailles(idMaillage int, idVersion int, " texteQuery ="create table Tailles(idMaillage int, idVersion int, "
texteQuery+="TailleMax float, TailleMin float, " texteQuery+="TailleMax float, TailleMin float, "
@ -23,7 +23,7 @@ class TableTailles (TableDeBase):
print "Creation de TableTailles : " , query.exec_(texteQuery) print "Creation de TableTailles : " , query.exec_(texteQuery)
def getVal(self,idMaillage, idVersion, Entite): def getVal(self,idMaillage, idVersion, Entite):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ='select '+ str(Entite) + ' from Tailles where idMaillage='+str(idMaillage) texteQuery ='select '+ str(Entite) + ' from Tailles where idMaillage='+str(idMaillage)
texteQuery+=' and idVersion='+str(idVersion) texteQuery+=' and idVersion='+str(idVersion)
query.exec_(texteQuery) query.exec_(texteQuery)

View File

@ -1,4 +1,4 @@
from PyQt4 import QtSql, QtCore from qtsalome import QSqlQuery
from tableDeBase import TableDeBase from tableDeBase import TableDeBase
class TableVersions (TableDeBase): class TableVersions (TableDeBase):
@ -9,7 +9,7 @@ class TableVersions (TableDeBase):
self.cols=" (nomVersion, commentaire) " self.cols=" (nomVersion, commentaire) "
def createSqlTable(self): def createSqlTable(self):
query=QtSql.QSqlQuery() query=QSqlQuery()
texteQuery ="create table Versions(id integer primary key autoincrement, nomVersion varchar(10)," texteQuery ="create table Versions(id integer primary key autoincrement, nomVersion varchar(10),"
texteQuery+="commentaire varchar(30));" texteQuery+="commentaire varchar(30));"
print "Creation de TableVersions : " , query.exec_(texteQuery) print "Creation de TableVersions : " , query.exec_(texteQuery)
@ -25,9 +25,9 @@ class TableVersions (TableDeBase):
def chercheVersion(self,version): def chercheVersion(self,version):
query=QtSql.QSqlQuery() query=QSqlQuery()
version=str(version) version=str(version)
if QtCore.QString(version).toInt()[1]==True : if bool(version) == True :
texteQuery ="select id, nomVersion from Versions where id = " + str(version) +";" texteQuery ="select id, nomVersion from Versions where id = " + str(version) +";"
else: else:
texteQuery ="select id, nomVersion from Versions where nomVersion ='" + version +"' ;" texteQuery ="select id, nomVersion from Versions where nomVersion ='" + version +"' ;"

View File

@ -1,34 +1,32 @@
from desFenetreChoix_ui import Ui_Choix from desFenetreChoix_ui import Ui_Choix
from PyQt4 import * from qtsalome import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from monEditor import TableEditor from monEditor import TableEditor
# Import des panels # Import des panels
class MaFenetreChoix(Ui_Choix ,QtGui.QDialog): class MaFenetreChoix(Ui_Choix ,QDialog):
""" """
""" """
def __init__(self,db): def __init__(self,db):
QtGui.QDialog.__init__(self) QDialog.__init__(self)
self.setModal(True) self.setModal(True)
self.setupUi(self) self.setupUi(self)
self.db=db self.db=db
self.connecterSignaux() self.connecterSignaux()
def connecterSignaux(self): def connecterSignaux(self):
self.connect(self.PBMailleur,SIGNAL("clicked()"),self.MailleurPush) self.PBMailleur.clicked.connect(self.MailleurPush)
self.connect(self.PBMaillage,SIGNAL("clicked()"),self.MaillagePush) self.PBMaillage.clicked.connect(self.MaillagePush)
self.connect(self.PBVersion,SIGNAL("clicked()"),self.VersionPush) self.PBVersion.clicked.connect(self.VersionPush)
self.connect(self.PBMachine,SIGNAL("clicked()"),self.MachinePush) self.PBMachine.clicked.connect(self.MachinePush)
self.connect(self.PBGroupe,SIGNAL("clicked()"),self.GroupePush) self.PBGroupe.clicked.connect(self.GroupePush)
self.connect(self.PBRatio,SIGNAL("clicked()"),self.RatioPush) self.PBRatio.clicked.connect(self.RatioPush)
self.connect(self.PBGroupeRatio,SIGNAL("clicked()"),self.GroupeRatioPush) self.PBGroupeRatio.clicked.connect(self.GroupeRatioPush)
self.connect(self.PBGroupeTaille,SIGNAL("clicked()"),self.GroupeTaillePush) self.PBGroupeTaille.clicked.connect(self.GroupeTaillePush)
self.connect(self.PBPerf,SIGNAL("clicked()"),self.PerfPush) self.PBPerf.clicked.connect(self.PerfPush)
self.connect(self.PBMaille,SIGNAL("clicked()"),self.MaillePush) self.PBMaille.clicked.connect(self.MaillePush)
self.connect(self.PBTaille,SIGNAL("clicked()"),self.TaillePush) self.PBTaille.clicked.connect(self.TaillePush)
self.connect(self.PBGroupesRef,SIGNAL("clicked()"),self.GroupesRefPush) self.PBGroupesRef.clicked.connect(self.GroupesRefPush)
def MailleurPush(self): def MailleurPush(self):
editor=TableEditor(self.db.maTableMailleurs,self) editor=TableEditor(self.db.maTableMailleurs,self)

View File

@ -1,7 +1,4 @@
from PyQt4.QtCore import * from qtsalome import *
from PyQt4.QtGui import *
from PyQt4.QtSql import *
class TableEditor(QDialog): class TableEditor(QDialog):
@ -20,7 +17,7 @@ class TableEditor(QDialog):
quitButton=QPushButton("Quit") quitButton=QPushButton("Quit")
buttonBox=QDialogButtonBox(Qt.Vertical) buttonBox=QDialogButtonBox(Qt.Vertical)
buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole); buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole);
self.connect(quitButton, SIGNAL("clicked()"), self, SLOT("close()")) quitButton.clicked.connect(self.close())
mainLayout = QHBoxLayout(self) mainLayout = QHBoxLayout(self)
mainLayout.addWidget(self.view) mainLayout.addWidget(self.view)
@ -33,11 +30,11 @@ class TableEditor(QDialog):
self.view.resizeColumnsToContents() self.view.resizeColumnsToContents()
self.view.adjustSize() self.view.adjustSize()
self.adjustSize() self.adjustSize()
self.connect(self.view,SIGNAL("pressed(QModelIndex*)"),self.donneLigne) self.view.pressed[QModelIndex].connect(self.donneLigne)
self.connect(self.view,SIGNAL("itemPressed(QTableWidgetItem*)"),self.donneLigne) self.view.itemPressed[QTableWidgetItem].conect(self.donneLigne)
self.connect(self.view,SIGNAL("clicked(QModelIndex*)"),self.donneLigne) self.view.clicked[QModelIndex].connect(self.donneLigne)
self.connect(self.view,SIGNAL("clicked()"),self.donneLigne) self.view.clicked.connect(self.donneLigne)
self.connect(self.view,SIGNAL("pressed()"),self.donneLigne) self.view.pressed.connect(self.donneLigne)
def donneLigne(self): def donneLigne(self):
print "jjjjjjjjjjjjjjjj" print "jjjjjjjjjjjjjjjj"

View File

@ -1,6 +1,4 @@
from PyQt4.QtCore import * from qtsalome import *
from PyQt4.QtGui import *
from PyQt4.QtSql import *
from nomBase_ui import Ui_LEDataBaseName from nomBase_ui import Ui_LEDataBaseName
@ -11,7 +9,7 @@ class DataBaseName(Ui_LEDataBaseName,QDialog):
self.setupUi(self) self.setupUi(self)
self.setModal(True) self.setModal(True)
self.parent=parent self.parent=parent
self.connect(self.LEBaseName, SIGNAL("returnPressed()"), self.LEDBreturnPressed) self.LEBaseName.returnPressed.connect(self.LEDBreturnPressed)
def LEDBreturnPressed(self): def LEDBreturnPressed(self):

View File

@ -5,7 +5,7 @@ rep=os.path.dirname(os.path.abspath(__file__))
installDir=os.path.join(rep,'..') installDir=os.path.join(rep,'..')
sys.path.insert(0,installDir) sys.path.insert(0,installDir)
from PyQt4 import QtGui,QtCore from qtsalome import QApplication
from Gui.maFenetreChoix_ui import MaFenetreChoix from Gui.maFenetreChoix_ui import MaFenetreChoix
from Base.dataBase import Base from Base.dataBase import Base
@ -17,7 +17,7 @@ if __name__ == "__main__":
p.add_option('-d',dest='database',default="myMesh.db",help='nom de la database') p.add_option('-d',dest='database',default="myMesh.db",help='nom de la database')
options, args = p.parse_args() options, args = p.parse_args()
app = QtGui.QApplication(sys.argv) app = QApplication(sys.argv)
maBase=Base(options.database) maBase=Base(options.database)
maBase.initialise() maBase.initialise()
window = MaFenetreChoix(maBase) window = MaFenetreChoix(maBase)

View File

@ -1,9 +1,6 @@
import os import os
import subprocess import subprocess
import time import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class Job: class Job:
def __init__(self,listeParamMaillage,salomePath,versionId,mesGroupesRef): def __init__(self,listeParamMaillage,salomePath,versionId,mesGroupesRef):

View File

@ -1,10 +1,6 @@
import os import os
import subprocess import subprocess
import time import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtSql import *
class Ref: class Ref:
def __init__(self,maBase,idMaillage,idVersion,machine): def __init__(self,maBase,idMaillage,idVersion,machine):

View File

@ -5,7 +5,7 @@ rep=os.path.dirname(os.path.abspath(__file__))
installDir=os.path.join(rep,'..') installDir=os.path.join(rep,'..')
sys.path.insert(0,installDir) sys.path.insert(0,installDir)
from PyQt4 import QtGui,QtCore,QtSql from qtsalome import *
from Base.dataBase import Base from Base.dataBase import Base
def completeDatabase(fichier,table,enregistrement): def completeDatabase(fichier,table,enregistrement):
@ -13,7 +13,7 @@ def completeDatabase(fichier,table,enregistrement):
maBase.initialise() maBase.initialise()
nomTable="ma"+str(table) nomTable="ma"+str(table)
matable=getattr(maBase,nomTable) matable=getattr(maBase,nomTable)
model= QtSql.QSqlTableModel() model= QSqlTableModel()
model.setTable(matable.nom) model.setTable(matable.nom)
nbCols=model.columnCount() -1 nbCols=model.columnCount() -1
if table == "TableGroupesRef" : nbCols==nbCols+1 if table == "TableGroupesRef" : nbCols==nbCols+1

View File

@ -3,7 +3,6 @@
import sys import sys
import os import os
from PyQt4 import QtGui,QtCore
from Base.dataBase import Base from Base.dataBase import Base
from Base.versions import Chercheversion from Base.versions import Chercheversion

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
from PyQt4 import QtGui,QtCore
from Base.dataBase import Base from Base.dataBase import Base
def creeDatabase(fichier): def creeDatabase(fichier):

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
from PyQt4 import * from qtsalome import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Gui.myMain_ui import Ui_Gestion from Gui.myMain_ui import Ui_Gestion
import sys import sys
@ -18,11 +16,11 @@ class MonAppli(Ui_Gestion,QWidget):
self.version="" self.version=""
def connectSignaux(self) : def connectSignaux(self) :
self.connect(self.BExp,SIGNAL("clicked()"),self.BExpPressed) self.BExp.clicked.connect(self.BExpPressed)
self.connect(self.BImp,SIGNAL("clicked()"),self.BImpPressed) self.BImp.clicked.connect(self.BImpPressed)
self.connect(self.BCree,SIGNAL("clicked()"),self.BCreePressed) self.BCree.clicked.connect(self.BCreePressed)
self.connect(self.BVue,SIGNAL("clicked()"),self.BVuePressed) self.BVue.clicked.connect(BVuePressed)
self.connect(self.BStat,SIGNAL("clicked()"),self.BStatPressed) self.BStat.clicked.connect(BStatPressed)
def BExpPressed(self): def BExpPressed(self):

View File

@ -3,7 +3,6 @@
import sys import sys
import os import os
from PyQt4 import QtGui,QtCore
from Base.dataBase import Base from Base.dataBase import Base
from Base.versions import Chercheversion from Base.versions import Chercheversion

View File

@ -22,9 +22,7 @@
import string,types,os import string,types,os
import traceback import traceback
from PyQt4 import * from qtsalome import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
# Import des panels # Import des panels
@ -38,13 +36,13 @@ class MonViewText(Ui_ViewExe, QDialog):
QDialog.__init__(self,parent) QDialog.__init__(self,parent)
self.setupUi(self) self.setupUi(self)
self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) ) self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
#self.connect( self.PB_Ok,SIGNAL("clicked()"), self, SLOT("close()") ) # self.PB_Ok.clicked.connect(self.close)
self.connect( self.PB_Ok,SIGNAL("clicked()"), self.theClose ) self.PB_Ok.clicked.connect( self.theClose )
self.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile ) self.PB_Save.clicked.connect( self.saveFile )
self.monExe=QProcess(self) self.monExe=QProcess(self)
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut ) self.monExe.readyReadStandardOutput.connect( self.readFromStdOut )
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr ) self.monExe.readyReadStandardError.connect( self.readFromStdErr )
# Je n arrive pas a utiliser le setEnvironment du QProcess # Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ??? # fonctionne hors Salome mais pas dans Salome ???
@ -67,7 +65,7 @@ class MonViewText(Ui_ViewExe, QDialog):
def saveFile(self): def saveFile(self):
#recuperation du nom du fichier #recuperation du nom du fichier
savedir=os.environ['HOME'] savedir=os.environ['HOME']
fn = QFileDialog.getSaveFileName(None, self.trUtf8("Save File"),savedir) fn = QFileDialog.getSaveFileName(None,"Save File",savedir)
if fn.isNull() : return if fn.isNull() : return
ulfile = os.path.abspath(unicode(fn)) ulfile = os.path.abspath(unicode(fn))
try: try:
@ -75,17 +73,16 @@ class MonViewText(Ui_ViewExe, QDialog):
f.write(str(self.TB_Exe.toPlainText())) f.write(str(self.TB_Exe.toPlainText()))
f.close() f.close()
except IOError, why: except IOError, why:
QMessageBox.critical(self, self.trUtf8('Save File'), QMessageBox.critical(self, 'Save File',
self.trUtf8('The file <b>%1</b> could not be saved.<br>Reason: %2') 'The file <b>%1</b> could not be saved.<br>Reason: %2'%(unicode(fn), str(why)))
.arg(unicode(fn)).arg(str(why)))
def readFromStdErr(self): def readFromStdErr(self):
a=self.monExe.readAllStandardError() a=self.monExe.readAllStandardError()
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) self.TB_Exe.append(unicode(a.data().encode()))
def readFromStdOut(self) : def readFromStdOut(self) :
a=self.monExe.readAllStandardOutput() a=self.monExe.readAllStandardOutput()
aa=QString.fromUtf8(a.data(),len(a)) aa=unicode(a.data(),len(a))
self.TB_Exe.append(aa) self.TB_Exe.append(aa)
if "END_OF_Yams" in aa: if "END_OF_Yams" in aa:
self.parent().enregistreResultat() self.parent().enregistreResultat()

View File

@ -24,9 +24,7 @@
import os, subprocess import os, subprocess
from YamsPlugDialog_ui import Ui_YamsPlugDialog from YamsPlugDialog_ui import Ui_YamsPlugDialog
from monViewText import MonViewText from monViewText import MonViewText
from PyQt4.QtGui import * from qtsalome import *
from PyQt4.QtCore import *
class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
""" """
@ -84,22 +82,22 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
self.clean() self.clean()
def connecterSignaux(self) : def connecterSignaux(self) :
self.connect(self.PB_Cancel,SIGNAL("clicked()"),self.PBCancelPressed) self.PB_Cancel.clicked.connect(self.PBCancelPressed)
self.connect(self.PB_Default,SIGNAL("clicked()"),self.clean) self.PB_Default.clicked.connect(self.clean)
self.connect(self.PB_Help,SIGNAL("clicked()"),self.PBHelpPressed) self.PB_Help.clicked.connect(self.PBHelpPressed)
self.connect(self.PB_OK,SIGNAL("clicked()"),self.PBOKPressed) self.PB_OK.clicked.connect(self.PBOKPressed)
self.connect(self.PB_Load,SIGNAL("clicked()"),self.PBLoadPressed) self.PB_Load.clicked.connect(self.PBLoadPressed)
self.connect(self.PB_Save,SIGNAL("clicked()"),self.PBSavePressed) self.PB_Save.clicked.connect(self.PBSavePressed)
self.connect(self.PB_LoadHyp,SIGNAL("clicked()"),self.PBLoadHypPressed) self.PB_LoadHyp.clicked.connect(self.PBLoadHypPressed)
self.connect(self.PB_SaveHyp,SIGNAL("clicked()"),self.PBSaveHypPressed) self.PB_SaveHyp.clicked.connect(self.PBSaveHypPressed)
self.connect(self.PB_MeshFile,SIGNAL("clicked()"),self.PBMeshFilePressed) self.PB_MeshFile.clicked.connect(self.PBMeshFilePressed)
self.connect(self.PB_MeshSmesh,SIGNAL("clicked()"),self.PBMeshSmeshPressed) self.PB_MeshSmesh.clicked.connect(self.PBMeshSmeshPressed)
self.connect(self.LE_MeshSmesh,SIGNAL("returnPressed()"),self.meshSmeshNameChanged) self.LE_MeshSmesh.returnPressed.connect(self.meshSmeshNameChanged)
self.connect(self.PB_ParamsFileExplorer,SIGNAL("clicked()"),self.setParamsFileName) self.PB_ParamsFileExplorer.clicked.connect(self.setParamsFileName)
self.connect(self.LE_MeshFile,SIGNAL("returnPressed()"),self.meshFileNameChanged) self.LE_MeshFile.returnPressed.connect(self.meshFileNameChanged)
self.connect(self.LE_ParamsFile,SIGNAL("returnPressed()"),self.paramsFileNameChanged) self.LE_ParamsFile.returnPressed.connect(self.paramsFileNameChanged)
def PBHelpPressed(self): def PBHelpPressed(self):
import SalomePyQt import SalomePyQt
@ -364,7 +362,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_MeshFile.setText(infile) self.LE_MeshFile.setText(infile)
self.fichierIn=infile.toLatin1() self.fichierIn=unicode(infile).encode("latin-1")
self.MeshIn="" self.MeshIn=""
self.LE_MeshSmesh.setText("") self.LE_MeshSmesh.setText("")
@ -373,7 +371,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_ParamsFile.setText(infile) self.LE_ParamsFile.setText(infile)
self.paramsFile=infile.toLatin1() self.paramsFile=unicode(infile).encode("latin-1")
def meshFileNameChanged(self): def meshFileNameChanged(self):
self.fichierIn=str(self.LE_MeshFile.text()) self.fichierIn=str(self.LE_MeshFile.text())
@ -453,7 +451,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
except: except:
pass pass
style = self.style.toLatin1() style = unicode(self.style).encode("latin-1")
# Translation of old Yams options to new MG-SurfOpt options # Translation of old Yams options to new MG-SurfOpt options
if style == "0" : if style == "0" :
self.commande+= " --optimisation only" self.commande+= " --optimisation only"
@ -540,10 +538,9 @@ def getDialog():
# #
def TEST_MonYamsPlugDialog(): def TEST_MonYamsPlugDialog():
import sys import sys
from PyQt4.QtGui import QApplication from qtsalome import QApplication
from PyQt4.QtCore import QObject, SIGNAL, SLOT
app = QApplication(sys.argv) app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.lastWindowClosed.connect(app.quit)
dlg=MonYamsPlugDialog() dlg=MonYamsPlugDialog()
dlg.show() dlg.show()

View File

@ -30,10 +30,7 @@ def YamsLct(context):
import os import os
import subprocess import subprocess
import tempfile import tempfile
from PyQt4 import QtCore from qtsalome import QFileDialog, QMessageBox
from PyQt4 import QtGui
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QMessageBox
#prior test to avoid unnecessary user GUI work with ending crash #prior test to avoid unnecessary user GUI work with ending crash
try : try :

View File

@ -1017,7 +1017,7 @@
<sender>cb_optDiscrSain</sender> <sender>cb_optDiscrSain</sender>
<signal>clicked(bool)</signal> <signal>clicked(bool)</signal>
<receiver>gb_discrSain</receiver> <receiver>gb_discrSain</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>69</x> <x>69</x>
@ -1033,7 +1033,7 @@
<sender>cb_optDiscrFiss</sender> <sender>cb_optDiscrFiss</sender>
<signal>clicked(bool)</signal> <signal>clicked(bool)</signal>
<receiver>gb_discrFacesExternes</receiver> <receiver>gb_discrFacesExternes</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>1033</x> <x>1033</x>
@ -1049,7 +1049,7 @@
<sender>cb_optDiscrFiss</sender> <sender>cb_optDiscrFiss</sender>
<signal>clicked(bool)</signal> <signal>clicked(bool)</signal>
<receiver>gb_zoneRemail</receiver> <receiver>gb_zoneRemail</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>1033</x> <x>1033</x>

View File

@ -43,18 +43,13 @@ def fissureCoudeDlg(context):
import os import os
#import subprocess #import subprocess
#import tempfile #import tempfile
from PyQt4 import QtCore from qtsalome import QFileDialog, QMessageBox, QPalette, QColor, QDialog
from PyQt4 import QtGui
from PyQt4.QtGui import QFileDialog
from PyQt4.QtGui import QMessageBox
from PyQt4.QtGui import QPalette
from PyQt4.QtGui import QColor
from fissureCoude_ui import Ui_Dialog from fissureCoude_ui import Ui_Dialog
class fissureCoudeDialog(QtGui.QDialog): class fissureCoudeDialog(QDialog):
def __init__(self): def __init__(self):
QtGui.QDialog.__init__(self) 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)
@ -86,17 +81,12 @@ def fissureCoudeDlg(context):
self.ui.lb_calcul.hide() self.ui.lb_calcul.hide()
# Connect up the buttons. # Connect up the buttons.
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.buttonBox.accepted.disconnect(self.accept)
self.recharger) self.ui.buttonBox.accepted.connect(self.execute)
self.connect(self.ui.pb_sauver, QtCore.SIGNAL("clicked()"),
self.sauver)
self.disconnect(self.ui.buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
self.connect(self.ui.buttonBox, QtCore.SIGNAL("accepted()"),
self.execute)
def initDefaut(self): def initDefaut(self):
self.defaut = dict( self.defaut = dict(

View File

@ -30,8 +30,7 @@ from salome.smesh.smeshstudytools import SMeshStudyTools
from omniORB import CORBA from omniORB import CORBA
from PyQt4.QtCore import QObject, SIGNAL, SLOT from qtsalome import QIcon, QStandardItemModel, QStandardItem, QMessageBox, pyqtSignal
from PyQt4.QtGui import QIcon, QStandardItemModel, QStandardItem, QMessageBox
from inputframe_ui import Ui_InputFrame from inputframe_ui import Ui_InputFrame
from inputdata import InputData from inputdata import InputData
@ -42,6 +41,8 @@ GROUPNAME_MAXLENGTH=8
class InputDialog(GenericDialog): class InputDialog(GenericDialog):
TBL_HEADER_LABEL=["Input Mesh", "Output group name"] TBL_HEADER_LABEL=["Input Mesh", "Output group name"]
inputValidated = pyqtSignal()
def __init__(self, parent=None, name="InputDialog", modal=0): def __init__(self, parent=None, name="InputDialog", modal=0):
""" """
@ -100,9 +101,9 @@ class InputDialog(GenericDialog):
# The click on btnSmeshObject (signal clicked() emitted by the # The click on btnSmeshObject (signal clicked() emitted by the
# button btnSmeshObject) is connected to the slot # button btnSmeshObject) is connected to the slot
# onSelectSmeshObject, etc ... # onSelectSmeshObject, etc ...
self.connect(self.__ui.btnSmeshObject, SIGNAL('clicked()'), self.onSelectSmeshObject ) self.__ui.btnSmeshObject.clicked.connect( self.onSelectSmeshObject )
self.connect(self.__ui.btnAddInput, SIGNAL('clicked()'), self.onAddInput ) self.__ui.btnAddInput.clicked.connect( self.onAddInput )
self.connect(self.__ui.btnDeleteInput, SIGNAL('clicked()'), self.onDeleteInput ) self.__ui.btnDeleteInput.clicked.connect( self.onDeleteInput )
# Set up the model of the Qt table list # Set up the model of the Qt table list
self.__inputModel = QStandardItemModel(0,2) self.__inputModel = QStandardItemModel(0,2)
@ -148,7 +149,7 @@ class InputDialog(GenericDialog):
# been validated so that it can process the event # been validated so that it can process the event
GenericDialog.accept(self) GenericDialog.accept(self)
if self.wasOk(): if self.wasOk():
self.emit(SIGNAL('inputValidated()')) self.inputValidated.emit()
def onSelectSmeshObject(self): def onSelectSmeshObject(self):
''' '''
@ -188,10 +189,10 @@ class InputDialog(GenericDialog):
creates a new entry in the list of input data, or updates this creates a new entry in the list of input data, or updates this
entry if it already exists. entry if it already exists.
""" """
meshName = str(self.__ui.txtSmeshObject.text().trimmed()) meshName = str(self.__ui.txtSmeshObject.text()).strip()
meshObject = self.__selectedMesh meshObject = self.__selectedMesh
meshType = self.__ui.cmbMeshType.currentIndex() meshType = self.__ui.cmbMeshType.currentIndex()
groupName = str(self.__ui.txtGroupName.text().trimmed()) groupName = str(self.__ui.txtGroupName.text()).strip()
self.__addInputInGui(meshName, meshObject, meshType, groupName) self.__addInputInGui(meshName, meshObject, meshType, groupName)
self.__addInputInMap(meshName, meshObject, meshType, groupName) self.__addInputInMap(meshName, meshObject, meshType, groupName)
@ -331,10 +332,9 @@ class InputDialog(GenericDialog):
# #
def TEST_InputDialog(): def TEST_InputDialog():
import sys import sys
from PyQt4.QtCore import QObject, SIGNAL, SLOT from qtsalome import QApplication
from PyQt4.QtGui import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.lastWindowClosed.connect( app.quit )
dlg=InputDialog() dlg=InputDialog()
dlg.displayAndWait() dlg.displayAndWait()
@ -343,10 +343,9 @@ def TEST_InputDialog():
def TEST_InputDialog_setData(): def TEST_InputDialog_setData():
import sys import sys
from PyQt4.QtCore import QObject, SIGNAL, SLOT from qtsalome import QApplication
from PyQt4.QtGui import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.lastWindowClosed.connect( app.quit )
dlg=InputDialog() dlg=InputDialog()

View File

@ -20,8 +20,7 @@
# Author : Guillaume Boulant (EDF) # Author : Guillaume Boulant (EDF)
# #
from PyQt4.QtGui import QDialog, QIcon from qtsalome import QDialog, QIcon, Qt
from PyQt4.QtCore import QObject, SIGNAL, SLOT, Qt
from plugindialog_ui import Ui_PluginDialog from plugindialog_ui import Ui_PluginDialog
from inputdialog import InputDialog from inputdialog import InputDialog
@ -87,11 +86,11 @@ class PluginDialog(QDialog):
self.__ui.btnClear.setIcon(icon) self.__ui.btnClear.setIcon(icon)
# Then, we can connect the slot to there associated button event # Then, we can connect the slot to there associated button event
self.connect(self.__ui.btnInput, SIGNAL('clicked()'), self.onInput ) self.__ui.btnInput.clicked.connect( self.onInput )
self.connect(self.__ui.btnCompute, SIGNAL('clicked()'), self.onCompute ) self.__ui.btnCompute.clicked.connect( self.onCompute )
self.connect(self.__ui.btnRefresh, SIGNAL('clicked()'), self.onRefresh ) self.__ui.btnRefresh.clicked.connect( self.onRefresh )
self.connect(self.__ui.btnPublish, SIGNAL('clicked()'), self.onPublish ) self.__ui.btnPublish.clicked.connect( self.onPublish )
self.connect(self.__ui.btnClear, SIGNAL('clicked()'), self.onClear ) self.__ui.btnClear.clicked.connect( self.onClear )
self.clear() self.clear()
@ -140,7 +139,7 @@ class PluginDialog(QDialog):
self.__inputDialog.windowFlags() | Qt.WindowStaysOnTopHint) self.__inputDialog.windowFlags() | Qt.WindowStaysOnTopHint)
# The signal inputValidated emited from inputDialog is # The signal inputValidated emited from inputDialog is
# connected to the slot function onProcessInput: # connected to the slot function onProcessInput:
self.connect(self.__inputDialog, SIGNAL('inputValidated()'), self.onProcessInput) self.__inputDialog.inputValidated.connect( self.onProcessInput )
else: else:
self.__ui.frameInput.setVisible(True) self.__ui.frameInput.setVisible(True)
@ -393,10 +392,9 @@ def getDialog():
# #
def TEST_PluginDialog(): def TEST_PluginDialog():
import sys import sys
from PyQt4.QtGui import QApplication from qtsalome import QApplication
from PyQt4.QtCore import QObject, SIGNAL, SLOT
app = QApplication(sys.argv) app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.lastWindowClosed.connect( app.quit )
dlg=PluginDialog() dlg=PluginDialog()
dlg.exec_() dlg.exec_()

View File

@ -26,7 +26,7 @@ def runSpadderPlugin(context):
try: try:
dialog=plugindialog.getDialog() dialog=plugindialog.getDialog()
except UiException, err: except UiException, err:
from PyQt4.QtGui import QMessageBox from qtsalome import QMessageBox
QMessageBox.critical(None,"An error occurs during PADDER configuration", QMessageBox.critical(None,"An error occurs during PADDER configuration",
err.getUIMessage()) err.getUIMessage())
return return