mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
best enregistreResultat
This commit is contained in:
parent
21bded888b
commit
e79c5fa3c5
@ -103,16 +103,18 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
||||
try:
|
||||
mydir=os.environ["SMESH_ROOT_DIR"]
|
||||
except Exception:
|
||||
QMessageBox.warning( self, "Help unavailable $SMESH_ROOT_DIR not found")
|
||||
QMessageBox.warning( self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
|
||||
return
|
||||
maDoc=mydir+"/share/doc/salome/gui/SMESH/MGCleaner/_downloads/mg-cleaner_user_manual.pdf"
|
||||
command="xdg-open "+maDoc+";"
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
def PBOKPressed(self):
|
||||
if not(self.PrepareLigneCommande()): return
|
||||
#print "compute Pressed"
|
||||
if not(self.PrepareLigneCommande()):
|
||||
#warning done yet
|
||||
#QMessageBox.warning(self, "Compute", "Command not found")
|
||||
return
|
||||
maFenetre=MGCleanerMonViewText(self, self.commande)
|
||||
if os.path.isfile(self.fichierOut): self.enregistreResultat()
|
||||
|
||||
def enregistreResultat(self):
|
||||
import smesh
|
||||
@ -120,6 +122,9 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
||||
import salome
|
||||
from salome.kernel import studyedit
|
||||
|
||||
if not os.path.isfile(self.fichierOut):
|
||||
QMessageBox.warning(self, "Compute", "Result file "+self.fichierOut+" not found")
|
||||
|
||||
maStudy=studyedit.getActiveStudy()
|
||||
smesh.SetCurrentStudy(maStudy)
|
||||
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
||||
@ -355,7 +360,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
|
||||
self.MeshIn=""
|
||||
self.LE_MeshSmesh.setText("")
|
||||
return
|
||||
QMessageBox.warning( self, "Unknown File", "File doesn't exist")
|
||||
QMessageBox.warning(self, "Mesh file", "File doesn't exist")
|
||||
|
||||
def meshSmeshNameChanged(self):
|
||||
"""only change by GUI mouse selection, otherwise clear"""
|
||||
|
@ -30,21 +30,21 @@ from PyQt4.QtCore import *
|
||||
|
||||
from MGCleanerViewText import Ui_ViewExe
|
||||
|
||||
class MGCleanerMonViewText(Ui_ViewExe,QDialog):
|
||||
class MGCleanerMonViewText(Ui_ViewExe, QDialog):
|
||||
"""
|
||||
Classe permettant la visualisation de texte
|
||||
"""
|
||||
def __init__(self,parent,txt):
|
||||
def __init__(self, parent, txt, ):
|
||||
QDialog.__init__(self,parent)
|
||||
self.setupUi(self)
|
||||
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.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
|
||||
self.PB_Save.setToolTip("Save trace in log file")
|
||||
self.PB_Ok.setToolTip("Close view")
|
||||
self.monExe=QProcess(self)
|
||||
|
||||
|
||||
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
|
||||
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
|
||||
|
||||
@ -68,7 +68,9 @@ class MGCleanerMonViewText(Ui_ViewExe,QDialog):
|
||||
else:
|
||||
cmds+="# $DISTENE_PATH_FOR_MGCLEANER NOT SET\n"
|
||||
#cmds+='env\n'
|
||||
cmds+='rm -f /tmp/ForMGCleaner*fix.mesh\n'
|
||||
cmds+=txt+'\n'
|
||||
cmds+='echo END_OF_MGCleaner\n'
|
||||
pid=self.monExe.pid()
|
||||
nomFichier='/tmp/MGCleaner_'+str(pid)+'.sh'
|
||||
f=open(nomFichier,'w')
|
||||
@ -78,9 +80,9 @@ class MGCleanerMonViewText(Ui_ViewExe,QDialog):
|
||||
maBidouille='sh ' + nomFichier
|
||||
self.monExe.start(maBidouille)
|
||||
self.monExe.closeWriteChannel()
|
||||
self.enregistreResultatsDone=False
|
||||
self.show()
|
||||
|
||||
|
||||
def saveFile(self):
|
||||
#recuperation du nom du fichier
|
||||
savedir=os.environ['HOME']
|
||||
@ -98,8 +100,19 @@ class MGCleanerMonViewText(Ui_ViewExe,QDialog):
|
||||
|
||||
def readFromStdErr(self):
|
||||
a=self.monExe.readAllStandardError()
|
||||
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
|
||||
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a)))
|
||||
|
||||
def readFromStdOut(self) :
|
||||
a=self.monExe.readAllStandardOutput()
|
||||
self.TB_Exe.append(QString.fromUtf8(a.data(),len(a))) ;
|
||||
aa=QString.fromUtf8(a.data(),len(a))
|
||||
self.TB_Exe.append(aa)
|
||||
if "END_OF_MGCleaner" in aa:
|
||||
self.parent().enregistreResultat()
|
||||
self.enregistreResultatsDone=True
|
||||
#self.theClose()
|
||||
|
||||
def theClose(self):
|
||||
if not self.enregistreResultatsDone:
|
||||
self.parent().enregistreResultat()
|
||||
self.enregistreResultatsDone=True
|
||||
self.close()
|
||||
|
Loading…
Reference in New Issue
Block a user