Salome HOME
Fix for bug PAL7854: Editing() method is called on Main and Graph_Impl not BEFORE... V2_2_0b2
authorasv <asv@opencascade.com>
Mon, 31 Jan 2005 08:02:23 +0000 (08:02 +0000)
committerasv <asv@opencascade.com>
Mon, 31 Jan 2005 08:02:23 +0000 (08:02 +0000)
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/SUPERVGUI/SUPERVGUI_Main.h

index 811600dce436addfc3d69180e60fcd7d6a4551e6..a294f89c3c7f8f2dfade31e4de71fb4e5d9e739b 100644 (file)
@@ -478,62 +478,56 @@ bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) {
 }
 
 void SUPERVGUI::reloadDataflow() {
-    Trace("SUPERVGUI::reloadDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD"));
-    } else {
-        main->sync();
-    };
+  Trace("SUPERVGUI::reloadDataflow");
+  if ( main )  
+    main->sync();
+  else 
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD"));
 }
 
 void SUPERVGUI::runDataflow() {
-    Trace("SUPERVGUI::runDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
-    } else {
-        main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag 
-        main->run();
-    };
+  Trace("SUPERVGUI::runDataflow");
+  if ( main )
+    main->run( /*andSuspend=*/false );
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
 }
 
 void SUPERVGUI::stepByStep() {
-    Trace("SUPERVGUI::stepByStep")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
-    } else {
-        main->Editing(); // PAL6170: GUI->Engine: setting "Editing" flag 
-        main->startExecute();
-    }
+  Trace("SUPERVGUI::stepByStep");
+  if ( main )
+    main->run( /*andSuspend=*/true );
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
 }
 
 void SUPERVGUI::killDataflow() {
-    Trace("SUPERVGUI::killDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL"));
-    } else {
-        main->kill();
-    };
+  Trace("SUPERVGUI::killDataflow");
+  if ( main )
+    main->kill();
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL"));
 }
 
 void SUPERVGUI::suspendResumeDataflow() {
-    Trace("SUPERVGUI::suspendResumeDataflow")
-    if (main==0) {
-        QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND"));
-    } else {
-        main->suspendResume();
-    };
+  Trace("SUPERVGUI::suspendResumeDataflow");
+  if ( main )
+    main->suspendResume();
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND"));
 }
 
 void SUPERVGUI::showComponents() {
   Trace("SUPERVGUI::showComponents");
-  if (main==0) {
-    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD"));
-  } else {
-    if (main->isEditable())
+  if ( main ) {
+    if ( main->isEditable() )
       main->addNode();
     else
       QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTEDITABLE"));
   }
+  else
+    QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD"));
+
 }
 
 
index e7317460b29ac65c494ec039d415999c36315a4b..af9d7054fd7e68d9d6fb3a23781758758255aa0b 100644 (file)
@@ -489,12 +489,17 @@ void SUPERVGUI_Main::onSubGraphClosed(QAD_StudyFrame* theStudyFrame)
   }
 }
 
-void SUPERVGUI_Main::run() {
+void SUPERVGUI_Main::run( const bool andSuspend ) {
   Trace("SUPERVGUI_Main::run");
-    if ((SUPERV_isNull(dataflow))) return;
+  if ( SUPERV_isNull(dataflow) ) 
+    return;
   
-  if (dataflow->IsEditing()) {
-    if (!dataflow->IsValid()) {
+  if ( dataflow->IsEditing() ) { // not currently Executing
+
+    // asv 31.01.05 : fix for PAL7854, Editing moved from SUPERVGUI.cxx runDataflow(), stepByStep() to here..
+    Editing(); // remove old executor, update GUI (all nodes to "No Status")
+
+    if ( !dataflow->IsValid() ) {
       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID"));
     } 
     else if (!dataflow->IsExecutable()) {
@@ -505,7 +510,8 @@ void SUPERVGUI_Main::run() {
     } 
     else {
       myRunTime = QDateTime::currentDateTime();
-      if ( !dataflow->Run() ) {
+      const bool result = andSuspend ? dataflow->Start() : dataflow->Run();
+      if ( !result ) {
        QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
        if ( dataflow->State() == SUPERV::ErrorState ) {
          kill();
@@ -522,37 +528,6 @@ void SUPERVGUI_Main::run() {
 }
 
 
-
-void SUPERVGUI_Main::startExecute() {
-  Trace("SUPERVGUI_Main::startExecute");
-  if ((SUPERV_isNull(dataflow))) return;
-  
-  if (dataflow->IsEditing()) {
-    if (!dataflow->IsValid()) {
-      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTVALID"));
-    } 
-    else if (!dataflow->IsExecutable()) {
-      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_NOTEXECUTABLE"));
-    } 
-    else if (myCanvasView->isAnyLinkCreating()) {
-      QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CRL_NOTCOMPLETE"));
-    } 
-    else {
-      myRunTime = QDateTime::currentDateTime();
-      if (!dataflow->Start()) {
-       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_BADEXECUTE"));
-      } 
-      else {
-       myThread->startThread(tr("MSG_GRAPH_STARTED"));
-      }
-    }
-  } 
-  else {
-    QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_DF_RUNNING"));
-  }
-}
-
-
 void SUPERVGUI_Main::kill() {
   Trace("SUPERVGUI_Main::kill");
   if ((SUPERV_isNull(dataflow))) 
index 134bbb59d0f31d08bcaa529317bf30467ba68cea..db76c9cd220d3ac3969598b66bb15193d7fe9970 100644 (file)
@@ -58,8 +58,7 @@ class SUPERVGUI_Main: public SUPERVGraph_View {
     SUPERVGUI_Main(SUPERVGraph_ViewFrame*, QAD_Desktop*, SUPERV_Graph);
     virtual ~SUPERVGUI_Main();
 
-    void run();
-    void startExecute();
+    void run( const bool andSuspend );
     void kill();
     void suspendResume();
     //void stopRestart();