mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-31 04:30:33 +05:00
best enregistreResultat
This commit is contained in:
parent
254a8bdcef
commit
0df6e9e468
@ -1,4 +1,4 @@
|
|||||||
# -*- coding: iso-8859-1 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2007-2013 EDF R&D
|
# Copyright (C) 2007-2013 EDF R&D
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
@ -30,19 +30,19 @@ from PyQt4.QtCore import *
|
|||||||
|
|
||||||
from ViewText import Ui_ViewExe
|
from ViewText import Ui_ViewExe
|
||||||
|
|
||||||
class MonViewText(Ui_ViewExe,QDialog):
|
class MonViewText(Ui_ViewExe, QDialog):
|
||||||
"""
|
"""
|
||||||
Classe permettant la visualisation de texte
|
Classe permettant la visualisation de texte
|
||||||
"""
|
"""
|
||||||
def __init__(self,parent,txt):
|
def __init__(self, parent, txt):
|
||||||
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.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.connect( self.PB_Save,SIGNAL("clicked()"), self.saveFile )
|
||||||
self.monExe=QProcess(self)
|
self.monExe=QProcess(self)
|
||||||
|
|
||||||
|
|
||||||
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
|
self.connect(self.monExe, SIGNAL("readyReadStandardOutput()"), self.readFromStdOut )
|
||||||
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
|
self.connect(self.monExe, SIGNAL("readyReadStandardError()"), self.readFromStdErr )
|
||||||
|
|
||||||
@ -66,7 +66,9 @@ class MonViewText(Ui_ViewExe,QDialog):
|
|||||||
else:
|
else:
|
||||||
cmds+="# $DISTENE_PATH_FOR_YAMS NOT SET\n"
|
cmds+="# $DISTENE_PATH_FOR_YAMS NOT SET\n"
|
||||||
#cmds+='env\n'
|
#cmds+='env\n'
|
||||||
|
cmds+='rm -f '+self.parent().fichierOut+'\n'
|
||||||
cmds+=txt+'\n'
|
cmds+=txt+'\n'
|
||||||
|
cmds+='echo END_OF_Yams\n'
|
||||||
pid=self.monExe.pid()
|
pid=self.monExe.pid()
|
||||||
nomFichier='/tmp/Yams_'+str(pid)+'.sh'
|
nomFichier='/tmp/Yams_'+str(pid)+'.sh'
|
||||||
f=open(nomFichier,'w')
|
f=open(nomFichier,'w')
|
||||||
@ -76,9 +78,9 @@ class MonViewText(Ui_ViewExe,QDialog):
|
|||||||
maBidouille='sh ' + nomFichier
|
maBidouille='sh ' + nomFichier
|
||||||
self.monExe.start(maBidouille)
|
self.monExe.start(maBidouille)
|
||||||
self.monExe.closeWriteChannel()
|
self.monExe.closeWriteChannel()
|
||||||
|
self.enregistreResultatsDone=False
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
|
||||||
def saveFile(self):
|
def saveFile(self):
|
||||||
#recuperation du nom du fichier
|
#recuperation du nom du fichier
|
||||||
savedir=os.environ['HOME']
|
savedir=os.environ['HOME']
|
||||||
@ -96,8 +98,19 @@ class MonViewText(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(QString.fromUtf8(a.data(),len(a)))
|
||||||
|
|
||||||
def readFromStdOut(self) :
|
def readFromStdOut(self) :
|
||||||
a=self.monExe.readAllStandardOutput()
|
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_Yams" 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()
|
||||||
|
@ -97,15 +97,18 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
try :
|
try :
|
||||||
mydir=os.environ["SMESH_ROOT_DIR"]
|
mydir=os.environ["SMESH_ROOT_DIR"]
|
||||||
except Exception:
|
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/yams/_downloads/YamsWhitePaper_3.2.pdf"
|
maDoc=mydir+"/share/doc/salome/gui/SMESH/yams/_downloads/YamsWhitePaper_3.2.pdf"
|
||||||
command="xdg-open "+maDoc+";"
|
command="xdg-open "+maDoc+";"
|
||||||
subprocess.call(command, shell=True)
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
def PBOKPressed(self):
|
def PBOKPressed(self):
|
||||||
if not(self.PrepareLigneCommande()) : return
|
if not(self.PrepareLigneCommande()):
|
||||||
|
#warning done yet
|
||||||
|
#QMessageBox.warning(self, "Compute", "Command not found")
|
||||||
|
return
|
||||||
maFenetre=MonViewText(self,self.commande)
|
maFenetre=MonViewText(self,self.commande)
|
||||||
if os.path.isfile(self.fichierOut): self.enregistreResultat()
|
|
||||||
|
|
||||||
def enregistreResultat(self):
|
def enregistreResultat(self):
|
||||||
import smesh
|
import smesh
|
||||||
@ -113,6 +116,9 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
import salome
|
import salome
|
||||||
from salome.kernel import studyedit
|
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()
|
maStudy=studyedit.getActiveStudy()
|
||||||
smesh.SetCurrentStudy(maStudy)
|
smesh.SetCurrentStudy(maStudy)
|
||||||
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
(outputMesh, status) = smesh.CreateMeshesFromGMF(self.fichierOut)
|
||||||
@ -327,7 +333,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
self.MeshIn=""
|
self.MeshIn=""
|
||||||
self.LE_MeshSmesh.setText("")
|
self.LE_MeshSmesh.setText("")
|
||||||
return
|
return
|
||||||
QMessageBox.warning( self, "Unknown File", "File doesn't exist")
|
QMessageBox.warning(self, "Mesh file", "File doesn't exist")
|
||||||
|
|
||||||
def meshSmeshNameChanged(self):
|
def meshSmeshNameChanged(self):
|
||||||
"""only change by GUI mouse selection, otherwise clear"""
|
"""only change by GUI mouse selection, otherwise clear"""
|
||||||
@ -396,7 +402,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
|
|||||||
self.commande+=" -O "+self.style.toLatin1()
|
self.commande+=" -O "+self.style.toLatin1()
|
||||||
|
|
||||||
deb=os.path.splitext(self.fichierIn)
|
deb=os.path.splitext(self.fichierIn)
|
||||||
self.fichierOut=deb[0]+".d.meshb"
|
self.fichierOut=deb[0] + ".d.meshb"
|
||||||
|
|
||||||
if self.RB_Absolute.isChecked()==True :
|
if self.RB_Absolute.isChecked()==True :
|
||||||
self.commande+=" -Dabsolute"
|
self.commande+=" -Dabsolute"
|
||||||
|
Loading…
Reference in New Issue
Block a user