SUPERVGraph_View* view = supervFrame->getViewWidget();
SUPERVGUI_Main* aGraph = dynamic_cast<SUPERVGUI_Main*>(view);
if ( aGraph ) {
+ // mkr: PAL12449 --->
+ if ( !aGraph->isDataflowInStudy() ) {
+ const int aWarnResult = QMessageBox::information(application()->desktop(), tr("MSG_INFO"),
+ tr("MSG_GRAPH_UNSAVED"),
+ QMessageBox::Yes, QMessageBox::No);
+ if ( aWarnResult == QMessageBox::Yes ) {
+ aGraph->addDataflowToStudy();
+ updateObjBrowser();
+ }
+ }
+ // mkr: PAL12449 <---
+
unregisterGraph(aGraph);
SUPERV_Graph aDataFlow = aGraph->getDataflow();
if ( !SUPERV_isNull( aDataFlow ) ) {
- if ( aDataFlow->IsExecuting() ) {
- const int aMsgResult = QMessageBox::warning(application()->desktop(),
- tr("WARNING"),
- tr("MSG_DF_RUNNING"),
- tr("MSG_DF_EXECUTION"),
- tr("MSG_DF_KILL"));
- if ( aMsgResult == 1 ) {
- // KILL EXECUTION
- if ( aDataFlow->Kill() ) {
- // Kill() sends KillEvent and KillState to SUPERVGUI_Thread
- // while sets myIsActive flag to false when it receives such event/state
- // after myIsActive is false it calls QThread::exit() to terminate.
-
- // why while() { qApp->processEvents() } ?
- // because: SUPERVGUI_Thread::run() receives events, and calls myMain->execute()
- // method using SALOME_Event paradigm, ProcessVoidEvent() function -
- // it puts this event to the main application event loop, in which we are being now.
- // So if we block main GUI application thread (by calling aGraph->getMyThread()->wait() here)
- // then we will have a deadlock of 2 threads waiting for one another
- while (aGraph->getMyThread()->running())
- qApp->processEvents();
- }
- }
- else { // BACKGROUND EXECUTION
- emit KillMainThread(true); // set SUPERVGUI_Thread::myIsActive to false
- while ( aGraph->getMyThread()->running() )
- qApp->processEvents();
- }
- }
- else { // EXECUTION IS FINISHED, JUST DESTROY THE SUPERVGUI_Thread object and return.
- emit KillMainThread(true);
- while ( aGraph->getMyThread()->running() )
- qApp->processEvents();
- }
+ if ( aDataFlow->IsExecuting() ) {
+ const int aMsgResult = QMessageBox::warning(application()->desktop(),
+ tr("WARNING"),
+ tr("MSG_DF_RUNNING"),
+ tr("MSG_DF_EXECUTION"),
+ tr("MSG_DF_KILL"));
+ if ( aMsgResult == 1 ) {
+ // KILL EXECUTION
+ if ( aDataFlow->Kill() ) {
+ // Kill() sends KillEvent and KillState to SUPERVGUI_Thread
+ // while sets myIsActive flag to false when it receives such event/state
+ // after myIsActive is false it calls QThread::exit() to terminate.
+
+ // why while() { qApp->processEvents() } ?
+ // because: SUPERVGUI_Thread::run() receives events, and calls myMain->execute()
+ // method using SALOME_Event paradigm, ProcessVoidEvent() function -
+ // it puts this event to the main application event loop, in which we are being now.
+ // So if we block main GUI application thread (by calling aGraph->getMyThread()->wait() here)
+ // then we will have a deadlock of 2 threads waiting for one another
+ while (aGraph->getMyThread()->running())
+ qApp->processEvents();
+ }
+ }
+ else { // BACKGROUND EXECUTION
+ emit KillMainThread(true); // set SUPERVGUI_Thread::myIsActive to false
+ while ( aGraph->getMyThread()->running() )
+ qApp->processEvents();
+ }
+ }
+ else { // EXECUTION IS FINISHED, JUST DESTROY THE SUPERVGUI_Thread object and return.
+ emit KillMainThread(true);
+ while ( aGraph->getMyThread()->running() )
+ qApp->processEvents();
+ }
}
}
}