From: Paul RASCLE Date: Fri, 15 Nov 2019 11:44:01 +0000 (+0100) Subject: fix abort on exex python script with progress indicator. Qt display was sometimes... X-Git-Tag: SH_V2_2_0~99^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c023be897bbf7ddae9c968a71bc36972e398ff4d;p=modules%2Fhydro.git fix abort on exex python script with progress indicator. Qt display was sometimes invoqued from a different thread than the main thread --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 9e79b797..adaeee14 100755 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1080,7 +1080,7 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( NCollection_Sequence aResSeq; Handle(Message_ProgressIndicator) aZIProgress = HYDROData_Tool::GetZIProgress(); - //DEBTRACE("aZIProgress=" << aZIProgress); + DEBTRACE("aZIProgress before running"); if ( aZIProgress ) { aZIProgress->Reset(); } @@ -1104,7 +1104,7 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( QThread::msleep(200); } } - //DEBTRACE("aZIProgress=" << aZIProgress); + DEBTRACE("ZI running finished"); if ( aZIProgress ) aZIProgress->Show( Standard_True ); @@ -1155,6 +1155,7 @@ std::vector HYDROData_CalculationCase::GetStricklerCoefficientForPoints( return theCoeffs; Handle(Message_ProgressIndicator) aSIProgress = HYDROData_Tool::GetSIProgress(); + DEBTRACE("aSIProgress before running"); if ( aSIProgress ) { aSIProgress->Reset(); } @@ -1169,6 +1170,9 @@ std::vector HYDROData_CalculationCase::GetStricklerCoefficientForPoints( QThread::msleep(200); } } + DEBTRACE("SI running finished"); + if ( aSIProgress ) + aSIProgress->Show( Standard_True ); return theCoeffs; } diff --git a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx index 2a85c663..f5ce6109 100755 --- a/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx +++ b/src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx @@ -21,7 +21,7 @@ #include #include #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_SIProgressIndicator, Message_ProgressIndicator) @@ -50,6 +50,7 @@ HYDROGUI_SIProgressIndicator::~HYDROGUI_SIProgressIndicator() Standard_Boolean HYDROGUI_SIProgressIndicator::Show(const Standard_Boolean theForce) { + //DEBTRACE("..."); Standard_Real aPosition = GetPosition(); myCount++; if (theForce) @@ -57,11 +58,11 @@ Standard_Boolean HYDROGUI_SIProgressIndicator::Show(const Standard_Boolean theFo Standard_Boolean isUserBreak = UserBreak(); bool isFinished = aPosition >= 1 || ( isUserBreak && GetNbScopes() < 2 ); - if ( isFinished ) { + if ( isFinished && theForce ) { // theForce == true : call from main thread, Qt display safe if ( result() != Accepted ) { QDialog::accept(); } - } else if (!isVisible()) { + } else if (!isVisible() && theForce) { // theForce == true : call from main thread, Qt display safe open(); } diff --git a/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx b/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx index b19674e3..0b90ff6f 100755 --- a/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx +++ b/src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx @@ -25,7 +25,7 @@ #include #include #include -#define _DEVDEBUG_ +//#define _DEVDEBUG_ #include "HYDRO_trace.hxx" IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_ZIProgressIndicator, Message_ProgressIndicator) @@ -66,6 +66,7 @@ HYDROGUI_ZIProgressIndicator::~HYDROGUI_ZIProgressIndicator() Standard_Boolean HYDROGUI_ZIProgressIndicator::Show(const Standard_Boolean theForce) { + //DEBTRACE("..."); Standard_Boolean isUserBreak = UserBreak(); Standard_Real aPosition = GetPosition(); myCount++; @@ -100,11 +101,11 @@ Standard_Boolean HYDROGUI_ZIProgressIndicator::Show(const Standard_Boolean theFo } bool isFinished = aPosition >= 1 || ( isUserBreak && GetNbScopes() < 2 ); - if ( isFinished ) { + if ( isFinished && theForce ) { // theForce == true : call from main thread, Qt display safe if ( result() != Accepted ) { QDialog::accept(); } - } else if ( !isVisible() ) { + } else if ( !isVisible() && theForce ) { // theForce == true : call from main thread, Qt display safe open(); }