from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog, QApplication, QSplitter, QLabel
-from PyQt5.QtGui import QPalette
+from PyQt5.QtGui import QPalette, QFont
from PyQt5.QtCore import QProcess, QFileInfo, QTimer, Qt, QDir, QSize, QProcessEnvironment
import traceback
#-----------------------------------------------------------------------------------------------#
def _viewTextExecute(self, txt, prefix, suffix, fichierExe=None, shell='sh', texteCommande=None):
#----------------------------------------------------------------------------------------------#
- self.w = ViewText( self.QWParent )
- self.w.setWindowTitle( "execution" )
- self.monExe=QProcess(self.w)
+ self.myWidget = ViewText( self.QWParent )
+ self.myWidget.setWindowTitle( "execution" )
+ self.myWidget.view.setFont(QFont("Monospace"))
+ self.monExe=QProcess(self.myWidget)
pid=self.monExe.pid()
if not fichierExe and txt :
fichierExe = self.generateTempFilename(prefix, suffix = ".sh")
- f=open(fichierExe,'w')
+ f=open(fichierExe,'self.myWidget')
f.write(txt)
f.close()
self.monExe.readyReadStandardOutput.connect( self.readFromStdOut)
self.monExe.readyReadStandardError.connect( self.readFromStdErr)
if texteCommande != None : exe=texteCommande
else : exe=shell + ' ' + fichierExe
- print (exe)
monEnv=QProcessEnvironment.systemEnvironment()
monEnv.insert('COLUMNS','500')
self.monExe.setProcessEnvironment(monEnv)
self.monExe.start(exe)
self.monExe.closeWriteChannel()
- self.w.exec_()
+ self.myWidget.exec_()
if self.monExe!=None:
self.monExe.readyReadStandardOutput.disconnect()
self.monExe.readyReadStandardError.disconnect()
def readFromStdErr(self):
a=self.monExe.readAllStandardError()
- chaine = str(a.data(), encoding="utf-8").rstrip()
- self.w.view.append(chaine)
- #self.w.view.append(str(a.data()))
+ chaine = str(a.data(), encoding="utf-8")
+ self.myWidget.view.append(chaine)
+ self.myWidget.view.append(chaine)
+ #self.myWidget.view.append(str(a.data()))
def readFromStdOut(self) :
a=self.monExe.readAllStandardOutput()
- chaine = str(a.data(), encoding="utf-8").rstrip()
- self.w.view.append(chaine)
- # self.w.view.append(str(a.data()))
+ chaine = str(a.data(), encoding="utf-8")
+ self.myWidget.view.append(chaine)
+ # self.wmyWidget.view.append(str(a.data()))
#-----------------------#
if not sauvegarde : return 0
#texteCommande=' export COLUMNS=200;'
texteCommande =' /home/A96028/salome/appli_V9_7_0_sysVersion/salome start -k -t python3 ' + self.generator.fichierUQExe
+ #texteCommande =' /home/A96028/salome/appli_V9_7_0_sysVersion/salome start -k -t python3 /home/A96028/QT5Dev/eficasRN/ReacteurNumerique/essaiPanda.py'
#self._viewTextExecute(None,None,None, fichierExe=self.generator.fichierUQExe, shell='python3')
#self._viewTextExecute('ls -l /tmp','essaiLs','.sh',)
#self._viewTextExecute(None,None,None, fichierExe='/home/A96028/QT5Dev/eficasRN/ReacteurNumerique/a.py',shell='python3',)