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