Salome HOME
fix abort on exex python script with progress indicator. Qt display was sometimes...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_SIProgressIndicator.cxx
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();
   }