Salome HOME
fix abort on exex python script with progress indicator. Qt display was sometimes...
authorPaul RASCLE <paul.rascle@edf.fr>
Fri, 15 Nov 2019 11:44:01 +0000 (12:44 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Fri, 15 Nov 2019 11:44:01 +0000 (12:44 +0100)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROGUI/HYDROGUI_SIProgressIndicator.cxx
src/HYDROGUI/HYDROGUI_ZIProgressIndicator.cxx

index 9e79b797b9d2a6f6cd75b4fbc61124752b9cc201..adaeee141b5d69a2c171e97374bc7eed276c2954 100755 (executable)
@@ -1080,7 +1080,7 @@ NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
   NCollection_Sequence<double> 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<double> 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<double> 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<double> HYDROData_CalculationCase::GetStricklerCoefficientForPoints(
       QThread::msleep(200);
     }
   }
+  DEBTRACE("SI running finished");
+  if ( aSIProgress )
+    aSIProgress->Show( Standard_True );
 
   return theCoeffs;
 }
index 2a85c6630078c64b12bc388f27200478db75e0ef..f5ce6109f2ff79494e4babaa316ccde82da558ee 100755 (executable)
@@ -21,7 +21,7 @@
 #include <QProgressBar>
 #include <QVBoxLayout>
 #include <QApplication>
-#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();
   } 
 
index b19674e3e9a77c5958a98644098b05f246885f2c..0b90ff6fb2d7e3e9ec825273c4245d564020c6ff 100755 (executable)
@@ -25,7 +25,7 @@
 #include <QProgressBar>
 #include <QVBoxLayout>
 #include <QApplication>
-#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();
     }