From: akl Date: Tue, 27 May 2008 14:39:42 +0000 (+0000) Subject: Fix and some improve of a process management mechanism. X-Git-Tag: V4_1_3~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c428d82e4c9209cb9aa48cfeb49e16175fb3d6f1;p=tools%2Finstall.git Fix and some improve of a process management mechanism. --- diff --git a/bin/SALOME_InstallWizard b/bin/SALOME_InstallWizard index 575c854..b916a56 100755 Binary files a/bin/SALOME_InstallWizard and b/bin/SALOME_InstallWizard differ diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index d3a27ca..2713780 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -547,17 +547,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, // create instance of class for starting shell script to get available disk space diskSpaceProc = new QProcess( this, "procDiskSpace" ); - connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) ); - // create instance of class for starting shell install script shellProcess = new QProcess( this, "shellProcess" ); - // create instance of class for starting shell script to modify SALOME *.la files modifyLaProc = new QProcess( this, "modifyLaProc" ); - connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) ); // create instance of class for starting shell script to check Fortran libraries checkFLibProc = new QProcess( this, "checkFLibProc" ); - connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) ); // create introduction page setupIntroPage(); @@ -589,11 +584,21 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, connect( this, SIGNAL( helpClicked() ), this, SLOT( helpClicked() ) ); connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) ); - // catch signals from launched script + // catch signals from launched diskSpaceProc + connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) ); + // catch signals from launched shellProcess connect(shellProcess, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) ); connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) ); connect(shellProcess, SIGNAL( processExited() ), this, SLOT( productInstalled() ) ); connect(shellProcess, SIGNAL( wroteToStdin() ), this, SLOT( wroteToStdin() ) ); + // catch signals from launched modifyLaProc + connect(modifyLaProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) ); + connect(modifyLaProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) ); + connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) ); + // catch signals from launched checkFLibProc + connect(checkFLibProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) ); + connect(checkFLibProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) ); + connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) ); // create validation thread myThread = new ProcessThread( this ); @@ -1747,6 +1752,7 @@ void SALOME_InstallWizard::updateAvailableSpace() // ================================================================ void SALOME_InstallWizard::runModifyLaFiles() { + modifyLaProc->clearArguments(); // ... update status label statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) ); // set process arguments @@ -1775,10 +1781,20 @@ void SALOME_InstallWizard::checkModifyLaResult() statusLab->setText( tr( "Installation has been aborted" ) ); QMessageBox::critical( this, tr( "Error" ), - tr( "There is a problem during modification of *.la SALOME files"), + tr( "Modification of *.la SALOME files has not been completed."), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); + // enable button + setNextEnabled( true ); + nextButton()->setText( tr( "&Start" ) ); + setAboutInfo( nextButton(), tr( "Start installation process" ) ); + // reconnect Next button - to use it as Start button + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable button + setBackEnabled( true ); } } // ================================================================ @@ -1790,6 +1806,7 @@ void SALOME_InstallWizard::checkModifyLaResult() void SALOME_InstallWizard::runCheckFLib() { // Check Fortran libraries + checkFLibProc->clearArguments(); // ... update status label statusLab->setText( tr( "Check Fortran libraries..." ) ); // ... search "not found" libraries @@ -2663,6 +2680,7 @@ void SALOME_InstallWizard::onStart() if ( nextButton()->text() == tr( "&Stop" ) ) { statusLab->setText( tr( "Aborting installation..." ) ); shellProcess->kill(); + modifyLaProc->kill(); while( shellProcess->isRunning() ); statusLab->setText( tr( "Installation has been aborted by user" ) ); return; @@ -2923,6 +2941,8 @@ void SALOME_InstallWizard::tryTerminate() void SALOME_InstallWizard::onCancel() { shellProcess->kill(); + modifyLaProc->kill(); + checkFLibProc->kill(); reject(); } // ================================================================ @@ -3001,11 +3021,12 @@ void SALOME_InstallWizard::wroteToStdin( ) void SALOME_InstallWizard::readFromStdout( ) { ___MESSAGE___( "Something was sent to stdout" ); - while ( shellProcess->canReadLineStdout() ) { - installInfo->append( QString( shellProcess->readLineStdout() ) ); + QProcess* theProcess = ( QProcess* )sender(); + while ( theProcess->canReadLineStdout() ) { + installInfo->append( QString( theProcess->readLineStdout() ) ); installInfo->scrollToBottom(); } - QString str( shellProcess->readStdout() ); + QString str( theProcess->readStdout() ); if ( !str.isEmpty() ) { installInfo->append( str ); installInfo->scrollToBottom(); @@ -3023,12 +3044,13 @@ void SALOME_InstallWizard::readFromStdout( ) void SALOME_InstallWizard::readFromStderr( ) { ___MESSAGE___( "Something was sent to stderr" ); - while ( shellProcess->canReadLineStderr() ) { - installInfo->append( OUTLINE_TEXT( QString( shellProcess->readLineStderr() ) ) ); + QProcess* theProcess = ( QProcess* )sender(); + while ( theProcess->canReadLineStderr() ) { + installInfo->append( OUTLINE_TEXT( QString( theProcess->readLineStderr() ) ) ); installInfo->scrollToBottom(); hasErrors = true; } - QString str( shellProcess->readStderr() ); + QString str( theProcess->readStderr() ); if ( !str.isEmpty() ) { installInfo->append( OUTLINE_TEXT( str ) ); installInfo->scrollToBottom();