[us-commits] r2738 - in trunk/programs: us_analysis_profile us_com_project us_experiment us_xpn_viewer

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Wed Apr 24 00:11:56 MDT 2019


Author: alexey
Date: 2019-04-24 06:11:54 +0000 (Wed, 24 Apr 2019)
New Revision: 2738

Modified:
   trunk/programs/us_analysis_profile/us_analysis_profile.cpp
   trunk/programs/us_analysis_profile/us_analysis_profile.h
   trunk/programs/us_com_project/us_com_project_gui.cpp
   trunk/programs/us_com_project/us_com_project_gui.h
   trunk/programs/us_experiment/us_exp_utils.cpp
   trunk/programs/us_experiment/us_experiment_gui_optima.cpp
   trunk/programs/us_experiment/us_experiment_gui_optima.h
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
Automated flow: taking care of the manual abortion of the Optima Run...



Modified: trunk/programs/us_analysis_profile/us_analysis_profile.cpp
===================================================================
--- trunk/programs/us_analysis_profile/us_analysis_profile.cpp	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_analysis_profile/us_analysis_profile.cpp	2019-04-24 06:11:54 UTC (rev 2738)
@@ -116,7 +116,7 @@
    apanGeneral->check_runname();
 
 DbgLv(1) << "MAIN:  CALL reset()";
-   reset();
+//reset();
    resize( 500, 450 );
 }
 
@@ -124,6 +124,10 @@
 // Reset parameters to their defaults
 void US_AnalysisProfileGui::reset( void )
 {
+  qDebug() << "Resetting internal protocol...";
+  currProf = US_AnaProfile();
+  initPanels();
+  
 }
 
 // Set auto mode (comes from ComProject or Experiment)
@@ -155,9 +159,11 @@
    int nchs        = iProto->rpSolut.chsols.count();
    int ncho        = iProto->rpOptic.chopts.count();
 
+ DbgLv(1) << "APG00: ipro: kchn nchs ncho" << kchn << nchs << ncho;  
+
    if ( nchs < 1  ||  ncho < 1 )
-      return;
-
+     return;
+   
    int nchn        = 0;
 DbgLv(1) << "APG: ipro: kchn nchs ncho" << kchn << nchs << ncho;
 if(iProto->rpOptic.chopts.count()>0)
@@ -165,7 +171,7 @@
  << iProto->rpOptic.chopts[0].channel
  << iProto->rpOptic.chopts[0].scan1
  << iProto->rpOptic.chopts[0].scan2
- << iProto->rpOptic.chopts[0].scan3;
+ << iProto->rpOptic.chopts[0].scan3; 
 if(iProto->rpOptic.chopts.count()>1)
 DbgLv(1) << "APG: ipro: 1)ch s1 s2 s3"
  << iProto->rpOptic.chopts[1].channel

Modified: trunk/programs/us_analysis_profile/us_analysis_profile.h
===================================================================
--- trunk/programs/us_analysis_profile/us_analysis_profile.h	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_analysis_profile/us_analysis_profile.h	2019-04-24 06:11:54 UTC (rev 2738)
@@ -420,7 +420,7 @@
 
    private slots:
 
-      void reset     ( void );
+     //void reset     ( void );
       void newPanel  ( int  );     // Move to a new panel
       void statUpdate( void );     // Get a status flag update
       void panelUp   ( void );     // Move to next panel
@@ -432,6 +432,7 @@
       void enable_tabs_buttons( void);  // Slot to enable Tabs and Buttons after run_name is entered
       
     public slots:
+      void reset     ( void );
       void close_program( void );
       void apply_profile( void );
       //void auto_mode_passed( void ); 

Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp	2019-04-24 06:11:54 UTC (rev 2738)
@@ -144,6 +144,8 @@
 
    connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &) ), this, SLOT( switch_to_post_processing( QString &, QString & )  ) );
    connect( this, SIGNAL( import_data_us_convert( QString &, QString & ) ),  epanPostProd, SLOT( import_data_us_convert( QString &, QString & )  ) );
+   connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment(  QString & )  ) );
+   connect( this, SIGNAL( clear_experiment( QString & ) ),  epanExp, SLOT( clear_experiment( QString & )  ) );
 
    //connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ),  this, SLOT( switch_to_analysis( QString &, QString & )  ) );
    //connect( this, SIGNAL( pass_to_analysis( QString &, QString & ) ),   epanAnalysis, SLOT( do_analysis( QString &, QString & )  ) );
@@ -272,7 +274,9 @@
 
    connect( epanObserv, SIGNAL( switch_to_post_processing( QString &, QString &) ), this, SLOT( switch_to_post_processing( QString &, QString & )  ) );
    connect( this, SIGNAL( import_data_us_convert( QString &, QString & ) ),  epanPostProd, SLOT( import_data_us_convert( QString &, QString & )  ) );
-
+   connect( epanObserv, SIGNAL( switch_to_experiment( QString &) ), this, SLOT( switch_to_experiment(  QString & )  ) );
+   connect( this, SIGNAL( clear_experiment( QString & ) ),  epanExp, SLOT( clear_experiment( QString & )  ) );
+   
    connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ),  this, SLOT( switch_to_analysis( QString &, QString & )  ) );
    connect( this, SIGNAL( pass_to_analysis( QString &, QString & ) ),   epanAnalysis, SLOT( do_analysis( QString &, QString & )  ) );
    
@@ -352,7 +356,17 @@
    emit import_data_us_convert( currDir, protocolName );
 }
      
+// Slot to switch back from the Live Update to Experiment tab
+void US_ComProjectMain::switch_to_experiment( QString & protocolName)
+{
+   tabWidget->setCurrentIndex( 0 );   // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
 
+   // ALEXEY: Make a record to 'autoflow' table: stage# = 2; 
+
+   emit clear_experiment( protocolName );
+}
+   
+
 // Slot to switch from the Editing to Analysis tab
 void US_ComProjectMain::switch_to_analysis( QString  & currDir, QString & protocolName)
 {
@@ -452,6 +466,8 @@
    connect( sdiag, SIGNAL( to_live_update( QMap < QString, QString > & ) ),
 	    this,  SLOT( to_live_update( QMap < QString, QString > & ) ) );
 
+   connect( this, SIGNAL( reset_experiment( QString & ) ), sdiag, SLOT( us_exp_clear( QString & ) ) );
+   
    sdiag->pb_close->setEnabled(false);  // Disable Close button
    offset = 0;
    sdiag->move(offset, 2*offset);
@@ -513,7 +529,13 @@
   mainw->logWidget->append("US_Experiment has been closed!");
 }
 
+//Clear Experiment after manual abortion & data not saved .. 
+void US_ExperGui::clear_experiment( QString & protocolName )
+{
+  emit reset_experiment( protocolName );
+}
 
+
 // On click to open US_Experiment  <-- NOT USED, us_experimnet is loaded immediately
 void US_ExperGui::manageExperiment()
 {
@@ -612,6 +634,9 @@
 
    //ALEXEY: devise SLOT saying what to do upon completion of experiment and exporting AUC data to hard drive - Import Experimental Data  !!! 
    connect( sdiag, SIGNAL( experiment_complete_auto( QString &, QString & ) ), this, SLOT( to_post_processing ( QString &, QString &) ) );
+
+   //ALEXEY: return to 1st panel when exp. aborted & no data saved..
+   connect( sdiag, SIGNAL( return_to_experiment( QString & ) ), this, SLOT( to_experiment ( QString &) ) );
    
    offset = 0;
    sdiag->move(offset, 2*offset);
@@ -672,8 +697,11 @@
   emit switch_to_post_processing( currDir, protocolName );
 }
 
+void US_ObservGui::to_experiment( QString & protocolName )
+{
+  emit switch_to_experiment( protocolName );
+}
 
-
 // US_PostProd
 US_PostProdGui::US_PostProdGui( QWidget* topw )
    : US_WidgetsDialog( topw, 0 )

Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_com_project/us_com_project_gui.h	2019-04-24 06:11:54 UTC (rev 2738)
@@ -87,11 +87,13 @@
    private slots:
       void manageExperiment ( void );        // Slot for exp.  button clicked
       void us_exp_is_closed_set_button( void );
-      void to_live_update( QMap < QString, QString > & protocol_details ); 
+      void to_live_update( QMap < QString, QString > & protocol_details );
+      void clear_experiment( QString & protocolName);
      
    signals:
       void switch_to_live_update( QMap < QString, QString > & protocol_details );
       void set_auto_mode( void );
+      void reset_experiment( QString & protocolName);
       
 };
 
@@ -115,11 +117,12 @@
       
  private slots:
       void process_protocol_details( QMap < QString, QString > & protocol_details );
-      void to_post_processing( QString & currDir, QString & protocolName );   
+      void to_post_processing( QString & currDir, QString & protocolName );
+      void to_experiment( QString & protocolName );
  signals:
       void to_xpn_viewer( QMap < QString, QString > & protocol_details );
       void switch_to_post_processing( QString & currDir, QString & protocolName );
-      
+      void switch_to_experiment( QString & protocolName );
 };
 
 
@@ -246,12 +249,14 @@
   //void enable_tabs_buttons( void);  // Slot to enable Tabs and Buttons after protocol is loaded
   void switch_to_live_update( QMap < QString, QString > & protocol_details );
   void switch_to_post_processing( QString & currDir, QString & protocolName );
-  void switch_to_analysis( QString & currDir, QString & protocolName ); 
+  void switch_to_analysis( QString & currDir, QString & protocolName );
+  void switch_to_experiment( QString & protocolName );
   
 signals:
   void pass_to_live_update( QMap < QString, QString > & protocol_details ); 
   void import_data_us_convert( QString & currDir, QString & protocolName );
   void pass_to_analysis( QString & currDir, QString & protocolName );
+  void clear_experiment( QString & protocolName);
 };
 
 

Modified: trunk/programs/us_experiment/us_exp_utils.cpp
===================================================================
--- trunk/programs/us_experiment/us_exp_utils.cpp	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_experiment/us_exp_utils.cpp	2019-04-24 06:11:54 UTC (rev 2738)
@@ -689,6 +689,11 @@
 {
    rpRotor             = &(mainw->currProto.rpRotor);
 
+   qDebug() << "GLOBAL RESET: " << mainw->global_reset;
+   if (mainw->global_reset)
+     mainw->global_reset = false;
+   qDebug() << "GLOBAL RESET: " << mainw->global_reset;
+   
    // Populate GUI settings from protocol controls
    bool was_changed     = changed;       // Save changed state
 DbgLv(1) << "EGRo: inP: was_changed" << was_changed;
@@ -2505,10 +2510,19 @@
 DbgLv(1) << "EGAp:inP:  protoname" << protoname << "aprofname" << aprofname;
 DbgLv(1) << "EGAp:inP:  sdiag" << sdiag;
    sdiag->auto_name_passed( protoname, aprofname );
+
+   
+   //sdiag->reset();
+   
    sdiag->inherit_protocol( currProto );
 DbgLv(1) << "EGAp:inP:  sdiag names passed";
 }
 
+void US_ExperGuiAProfile::reset_sdiag( void )
+{
+  sdiag->reset();
+}
+
 void US_ExperGuiAProfile::savePanel()
 {
 }

Modified: trunk/programs/us_experiment/us_experiment_gui_optima.cpp
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.cpp	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.cpp	2019-04-24 06:11:54 UTC (rev 2738)
@@ -44,7 +44,8 @@
    connection_status = false;
    automode = false;
    usmode = false;
-
+   global_reset = false;
+   
       // Create tab and panel widgets
    tabWidget           = us_tabwidget();
 
@@ -133,13 +134,53 @@
    epanGeneral->check_user_level();
    epanGeneral->check_runname();
 
-   reset();
+   //reset();
 }
 
 
 // Reset parameters to their defaults
 void US_ExperimentMain::reset( void )
 {
+  global_reset = true;
+  
+  //Clean Reset
+  currProto = US_RunProtocol();
+  loadProto = US_RunProtocol();
+
+  epanRotor->setFirstLab();  //need to reset Lab && savePanel() for Rotors
+
+  epanAProfile->reset_sdiag(); //need to reset basic AProfile's protocol to defaults
+  
+  /*
+  // Reset General panel
+  currProto.runname      = "";
+  currProto.protoname    = "";
+  currProto.project      = "";
+  currProto.temperature  = 20.0;
+  currProto.temeq_delay  = 10.0;
+  epanGeneral->initPanel();
+
+  //Cells
+  currProto.rpCells.ncell = 0;
+  epanCells->initPanel();
+
+  //Solutions
+  currProto.rpSolut.nschan = 0;
+  epanSolutions->initPanel();
+
+  //Optics
+  currProto.rpOptic.nochan = 0; 
+  epanOptical->initPanel();
+
+  //Ranges
+  currProto.rpRange.nranges = 0;
+  epanRanges->initPanel();
+  
+  //AProfile
+  //if ( !usmode )
+  epanAProfile->initPanel();
+  */
+
 }
 
 void US_ExperimentMain::us_mode_passed( void )
@@ -168,20 +209,28 @@
 // Reset parameters to their defaults
 void US_ExperimentMain::close_program( void )
 {
-
-
   emit us_exp_is_closed();
   close();
 }
 
 // When run submitted to Optima
+void US_ExperimentMain::us_exp_clear( QString &protocolName )
+{
+  tabWidget->setCurrentIndex( 0 );
+  qDebug() << "Protocol Name to be cleared: " << protocolName;
+
+  // ALEXEY: do proper reset of everything
+  reset();
+  //emit to_live_update( protocol_details );
+}
+
+// When run submitted to Optima
 void US_ExperimentMain::optima_submitted( QMap < QString, QString > &protocol_details )
 {
   tabWidget->setCurrentIndex( 0 );
   emit to_live_update( protocol_details );
 }
 
-
 // Panel for run and other general parameters
 US_ExperGuiGeneral::US_ExperGuiGeneral( QWidget* topw )
    : US_WidgetsDialog( topw, 0 )
@@ -474,6 +523,8 @@
       initPanel();
       le_protocol->setText( "" );
       le_project ->setText( "" );
+
+      /////mainw->reset();  //testing
    }
 #endif
 #if 0  // GARY: Rebuild protocol list after investigator change
@@ -765,6 +816,13 @@
 }
 
 // Slot for change in Lab selection
+void US_ExperGuiRotor::setFirstLab( void )
+{
+  changeLab( 0 );
+  savePanel();
+}
+
+// Slot for change in Lab selection
 void US_ExperGuiRotor::changeLab( int ndx )
 {
 DbgLv(1) << "EGR:chgLab  ndx" << ndx << "rotorID" << rpRotor->rotID
@@ -960,7 +1018,7 @@
    int cndx            = qMax( sl_calibs.indexOf( calib_ent ), 0 );
    cb_calibr->setCurrentIndex( cndx );
 
-   if ( !first_time_init  &&  changed  &&  ( curr_rotor != ndx ) )
+   if ( !first_time_init  && !mainw->global_reset  &&  changed  &&  ( curr_rotor != ndx ) )
    {
       QMessageBox::information( this,
          tr( "NOTE:  Rotor Changed" ),

Modified: trunk/programs/us_experiment/us_experiment_gui_optima.h
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.h	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.h	2019-04-24 06:11:54 UTC (rev 2738)
@@ -118,6 +118,9 @@
 
       void        initPanel( void );    // Standard panel utilities
       void        savePanel( void );
+      void        setFirstLab( void );
+      
+           
       QString     getSValue( const QString );
       int         getIValue( const QString );
       double      getDValue( const QString );
@@ -827,6 +830,8 @@
       QPushButton* pb_saverp;
 
       QGridLayout* genL;
+
+      void reset_sdiag( void );
       
    private:
       US_ExperimentMain*    mainw;
@@ -903,6 +908,8 @@
       
       bool    automode;
       bool    usmode;
+      bool    global_reset;
+      
       void    auto_mode_passed( void );
       void    us_mode_passed( void );
 
@@ -929,7 +936,7 @@
 
    private slots:
 
-      void reset     ( void );
+     //void reset     ( void );
       void newPanel  ( int  );     // Move to a new panel
       void statUpdate( void );     // Get a status flag update
       void panelUp   ( void );     // Move to next panel
@@ -943,8 +950,10 @@
     public slots:
       void close_program( void );
       void optima_submitted( QMap < QString, QString > &protocol_details );
+      void us_exp_clear( QString &protocolName );
       //void auto_mode_passed( void ); 
-
+      void reset     ( void );
+      
     signals:
       void us_exp_is_closed( void );
       void to_live_update( QMap < QString, QString > &protocol_details );

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-04-24 06:11:54 UTC (rev 2738)
@@ -1617,40 +1617,103 @@
   
   //ALEXEY: no plot rescaling to bounds...
   data_plot_rpm->replot();
+
+  int exp_status = CheckExpComplete_auto( RunID_to_retrieve  );
    
-  if ( CheckExpComplete_auto( RunID_to_retrieve  ) )
+  if ( exp_status == 5 )
     {
-      timer_check_sysdata->stop();
-      disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+      expStatFive();
+      return;
+    }
+   if ( exp_status == 2 )
+    {
+      expStatTwo();
+      return;
+    } 
+  
+  in_reload_check_sysdata   = false;
+  
+  qDebug() << "sys_timer RAN here: ";
+}
 
-      qDebug() << "sys_timer STOPPED here: ";
+// Stop/reset all system panels and pass to stage 3 when exp_Status == 5
+void US_XpnDataViewer::expStatFive( void )
+{
+  timer_check_sysdata->stop();
+  disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+  
+  qDebug() << "ExpStat: 5  - sys_timer STOPPED here: ";
+  
+  rpm_box->setSpeed( 0 );
+  le_remaining->setText( "00:00:00" );
+  
+  if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
+    {
+      if ( !timer_data_reload->isActive() )
+	{
+	  // ALEXEY Export AUC data: devise export_auc_auto() function which would return directory name with saved data - to pass to emit signal below... 
+	  export_auc_auto();
+	  
+	  QString mtitle_complete  = tr( "Complete!" );
+	  QString message_done     = tr( "Experiment was completed. Optima data saved..." );
+	  QMessageBox::information( this, mtitle_complete, message_done );
+	  
+	  emit experiment_complete_auto( currentDir, ProtocolName  );  // Updtade later: what should be passed with signal ??
+	  
+	  return;
+	}
+    }
+}
 
-      rpm_box->setSpeed( 0 );
-      le_remaining->setText( "00:00:00" );
+// Stop/reset all system panels and pass to stage 3 when exp_Status == 2
+void US_XpnDataViewer::expStatTwo( void )
+{
+  timer_check_sysdata->stop();
+  disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
   
-      if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
-       	{
-	  if ( !timer_data_reload->isActive() )
+  qDebug() << "ExpStat: 2  - sys_timer STOPPED here: ";
+  
+  rpm_box->setSpeed( 0 );
+  le_remaining->setText( "00:00:00" );
+
+  if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
+    {
+      if ( !timer_data_reload->isActive() )
+	{
+	  // Ask if data retrived so far should be saved:
+
+	  QMessageBox msgBox;
+	  msgBox.setText(tr("Experiment was aborted!"));
+	  msgBox.setInformativeText("The data retrieved so far can be saved or disregarded. If saved, the program will proceed to the next stage (Editing). Otherwise, it will return to the initial stage (Experiment).");
+	  msgBox.setWindowTitle(tr("Experiment Abortion"));
+	  QPushButton *Save      = msgBox.addButton(tr("Save Data"), QMessageBox::YesRole);
+	  QPushButton *Ignore    = msgBox.addButton(tr("Ignore Data"), QMessageBox::RejectRole);
+	  
+	  msgBox.setIcon(QMessageBox::Question);
+	  msgBox.exec();
+	  
+	  if (msgBox.clickedButton() == Save)
 	    {
-	      // ALEXEY Export AUC data: devise export_auc_auto() function which would return directory name with saved data - to pass to emit signal below... 
 	      export_auc_auto();
 	      
 	      QString mtitle_complete  = tr( "Complete!" );
 	      QString message_done     = tr( "Experiment was completed. Optima data saved..." );
 	      QMessageBox::information( this, mtitle_complete, message_done );
-	      
 	      emit experiment_complete_auto( currentDir, ProtocolName  );  // Updtade later: what should be passed with signal ??
-	      
 	      return;
 	    }
+	  
+	  else if (msgBox.clickedButton() == Ignore)
+	    {
+	      reset();
+	      emit return_to_experiment( ProtocolName  ); 
+	      return;
+	    }
 	}
-    }
-  
-  in_reload_check_sysdata   = false;
-  
-  qDebug() << "sys_timer RAN here: ";
+    }  
 }
 
+
 // Function to convert from a time in sec. to days, hours, minutes, seconds 
 void US_XpnDataViewer::timeToList( int& sectime, QList< int >& dhms )
 {
@@ -3254,18 +3317,13 @@
 }
 
 
-bool US_XpnDataViewer::CheckExpComplete_auto( QString & runid )
+int US_XpnDataViewer::CheckExpComplete_auto( QString & runid )
 {
-  bool status = false;
-
   // Implement Optima's ExperimentRun query for RunStatus field [enum: 0 - NoRunInfo; 2- InProgress; 5- CompleteOK], look in db_defines.h of Dennis's util
   // in utils/us_xpn_data.cpp
   int exp_status =  xpn_data->checkExpStatus( runid );
 
-  if (exp_status == 5)
-    status = true;
-
-  return status;
+  return exp_status;
 }
 
 // Slot to reload data
@@ -3307,12 +3365,8 @@
 DbgLv(1) << "RLd:       NO CHANGE";
 
       /*** Check Experiement Status: if completed, kill the timer, export the data into AUC format, return, signal to switch panels in US_comproject ***/
-      if ( CheckExpComplete_auto( RunID_to_retrieve  ) )
+      if ( CheckExpComplete_auto( RunID_to_retrieve  ) == 5 )
 	{
-	  // //ALEXEY: stop another timer - for live update of SysData (RPM, Temperature etc. )
-	  // timer_check_sysdata->stop();
-	  // disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
-	  
 	  timer_data_reload->stop();
 	  disconnect(timer_data_reload, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
 
@@ -3334,6 +3388,46 @@
 	    }
 	}
 
+      /** Experiment Aborted ***/
+      if ( CheckExpComplete_auto( RunID_to_retrieve  ) == 2 )
+	{
+	  timer_data_reload->stop();
+	  disconnect(timer_data_reload, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+
+	  if ( !timer_check_sysdata->isActive()  ) // Check if sys_data Timer is stopped
+	    {
+	      // Ask if data retrived so far should be saved:
+	      
+	      QMessageBox msgBox;
+	      msgBox.setText(tr("Experiment was aborted!"));
+	      msgBox.setInformativeText("The data retrieved so far can be saved or disregarded. If saved, the program will proceed to the next stage (Editing). Otherwise, it will return to the initial stage (Experiment).");
+	      msgBox.setWindowTitle(tr("Experiment Abortion"));
+	      QPushButton *Save      = msgBox.addButton(tr("Save Data"), QMessageBox::YesRole);
+	      QPushButton *Ignore    = msgBox.addButton(tr("Ignore Data"), QMessageBox::RejectRole);
+	      
+	      msgBox.setIcon(QMessageBox::Question);
+	      msgBox.exec();
+	      
+	      if (msgBox.clickedButton() == Save)
+		{
+		  export_auc_auto();
+		  
+		  QString mtitle_complete  = tr( "Complete!" );
+		  QString message_done     = tr( "Experiment was completed. Optima data saved..." );
+		  QMessageBox::information( this, mtitle_complete, message_done );
+		  emit experiment_complete_auto( currentDir, ProtocolName  );  // Updtade later: what should be passed with signal ??
+		  return;
+		}
+	      
+	      else if (msgBox.clickedButton() == Ignore)
+		{
+		  reset();
+		  emit return_to_experiment( ProtocolName  ); 
+		  return;
+		}
+	    }
+	}      
+
        in_reload_auto   = false;         // Flag no longer in the midst of reload
        return;     // Return with no change in AUC data
    }

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-04-23 17:05:18 UTC (rev 2737)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-04-24 06:11:54 UTC (rev 2738)
@@ -294,7 +294,10 @@
      //void   retrieve_xpn_raw_auto ( QString & );
      void   retrieve_xpn_raw_auto ( void );
      void   reloadData_auto     ( void );
-     bool   CheckExpComplete_auto( QString & );
+     int    CheckExpComplete_auto( QString & );
+
+     void   expStatFive( void );
+     void   expStatTwo( void );
      
      void   load_auc_xpn   ( void );
      void   plot_current   ( void );
@@ -339,6 +342,7 @@
      
    signals:
      void experiment_complete_auto( QString &, QString & );
+     void return_to_experiment( QString & );
 };
 #endif
 



More information about the us-commits mailing list