[us-commits] r2751 - in trunk: programs/us_com_project programs/us_xpn_viewer sql

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Thu May 2 03:48:08 MDT 2019


Author: alexey
Date: 2019-05-02 09:48:07 +0000 (Thu, 02 May 2019)
New Revision: 2751

Modified:
   trunk/programs/us_com_project/us_com_project_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
   trunk/sql/us3_procedures.sql
Log:
minor updates



Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp	2019-05-01 21:36:51 UTC (rev 2750)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp	2019-05-02 09:48:07 UTC (rev 2751)
@@ -346,16 +346,17 @@
   // protocol_details[ "TripleNumber" ] = QString("38");
   // protocol_details[ "OptimaName" ] = QString("Optima 2");     // <-- Optima 2
   // protocol_details[ "duration" ]   = QString("36000");
+  // protocol_details[ "dataPath" ]   = QString("/home/alexey/ultrascan/imports/RxRPPARhet-PPRE-MWL_180419-run352");
   // protocol_details[ "invID_passed" ]  = QString("41");  //Nemetchek's ID
   
   // QString stage                        = "LIVE_UPDATE";
-  // QString currDir                      = "";
-  // QString ProtName                     = "";
+  // QString currDir                      = protocol_details[ "dataPath" ];
+  // QString ProtName                     = protocol_details[ "protocolName" ];
   // QString invID_passed                 = protocol_details[ "invID_passed" ];
 
   // --------------------------------------------------------------------------------------------
  
-    
+  
   // Query 'autoflow': get cout of records
   int autoflow_records = get_autoflow_records();
 
@@ -407,6 +408,8 @@
   QString currDir      = protocol_details[ "dataPath" ];
   QString invID_passed = protocol_details[ "invID_passed" ];
   QString ProtName     = protocol_details[ "protocolName" ];
+  
+  
 
   //ALEXEY: if stage=="EDITING" && curDir.isEmpty() (NULL)
   /*

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-05-01 21:36:51 UTC (rev 2750)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-05-02 09:48:07 UTC (rev 2751)
@@ -1531,7 +1531,7 @@
       timer_check_sysdata->setInterval(2000);
       timer_check_sysdata->moveToThread(sys_thread);
       //connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( )  ), Qt::QueuedConnection ) ; //Qt::DirectConnection );
-      connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( )  ) ) ; //Qt::DirectConnection );
+      connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( )  ) );//, Qt::QueuedConnection );
       //QThread's started() SIGNAL: before the run()/exec() function is called!!! Is this a potential issue, timer is started from a thread???
       connect( sys_thread, SIGNAL( started() ), timer_check_sysdata, SLOT( start() ));      
       sys_thread->start();
@@ -1662,7 +1662,8 @@
    //db->query( qry );
 
    // OR
-   
+
+   qDebug() << "Trying to Update Autoflow table AT LIVE_UPDATE!!";
    int status = db->statusQuery( qry );
    
    if ( status == US_DB2::NO_AUTOFLOW_RECORD )
@@ -1670,7 +1671,7 @@
        QMessageBox::warning( this,
 			     tr( "Autoflow Record Not Updated" ),
 			     tr( "No autoflow record\n"
-				 "associated with this experiment." ) );
+				 "associated with RunID %1 exists!" ).arg( RunID_to_retrieve ) );
        return;
      }
 }
@@ -1710,11 +1711,11 @@
   //RPM speed
   double rpm_for_meter = double(rpm/1000.0);
   rpm_box->setSpeed(rpm_for_meter);
-  //qApp->processEvents();
+  qApp->processEvents();
   
   //Temperature
   temperature_box->setTemp(temperature);
-  //qApp->processEvents();
+  qApp->processEvents();
   
   //Running Time
   QList< int > dhms_r;
@@ -1726,7 +1727,7 @@
   //ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
   running_time_text = QString::number(dhms_r[1]) + ":" + QString::number(dhms_r[2]) + ":" + QString::number(dhms_r[3]);
   le_running->setText( running_time_text );
-  //qApp->processEvents();
+  qApp->processEvents();
 
   //Elapsed Time
   qDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Elapsed Time Offset as read form autoflow table DB:" << ElapsedTimeOffset;
@@ -1739,7 +1740,7 @@
   //ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
   elapsed_time_text = QString::number(dhms_e[1]) + ":" + QString::number(dhms_e[2]) + ":" + QString::number(dhms_e[3]);
   le_elapsed->setText( elapsed_time_text );
-  // qApp->processEvents();
+  qApp->processEvents();
   
   //Remaining Time
   QList< int > dhms_remain;
@@ -1749,7 +1750,7 @@
   //ALEXEY: hh:mm:ss - OR do we need dd:hh:mm instead ?
   remaining_time_text = QString::number(dhms_remain[1]) + ":" + QString::number(dhms_remain[2]) + ":" + QString::number(dhms_remain[3]);
   le_remaining->setText( remaining_time_text );
-  //  qApp->processEvents();
+  qApp->processEvents();
   
   //RPM/Temp. Plots:
 
@@ -1791,7 +1792,7 @@
   qDebug() << "SYS_STAT: BEFORE replot(), BEFORE CheExpStat!! ";
    
   data_plot_rpm->replot();
-  //  qApp->processEvents();
+  qApp->processEvents();
 
   qDebug() << "SYS_STAT: After replot(), BEFORE CheExpStat!! ";
   
@@ -1800,17 +1801,22 @@
   if ( exp_status == 5 )
     {
       timer_check_sysdata->stop();
+      //ALEXEY: This timer cannot be stopped from another thread, but can be dealt with signal/slot upon Qthread termination..
+      //        disconnection maybe enough...
       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" );   
+      le_remaining->setText( "00:00:00" );
+      qApp->processEvents();
       
       if ( !timer_all_data_avail->isActive() ) // Check if reload_data Timer is stopped
 	{
 	  if ( !timer_data_reload->isActive() )
 	    {
+
+	      qDebug() << "TRY PROCEED INTO ==5 from check_for_sys_data()....";
 	      // 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();
 	      
@@ -1824,7 +1830,6 @@
 	      return;
 	    }
 	}
-      //expStatFive();
     }
   
   
@@ -1875,8 +1880,6 @@
 		  return;
 		}
 	    }  
-
-	  //expStatThree();
 	}
     }
   
@@ -1887,88 +1890,7 @@
   //qDebug() << "sys_timer RAN 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 );
-	  
-	  updateautoflow_record_atLiveUpdate();
-	  emit experiment_complete_auto( currentDir, ProtocolName, invID_passed  );  // Updtade later: what should be passed with signal ??
-	  
-	  return;
-	}
-    }
-}
 
-// Stop/reset all system panels and pass to stage 3 when exp_Status == 3
-void US_XpnDataViewer::expStatThree( void )
-{
-  // timer_check_sysdata->stop();
-  // disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
-  
-  // qDebug() << "ExpStat: 3  - 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)
-	    {
-	      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 );
-
-	      updateautoflow_record_atLiveUpdate();
-	      emit experiment_complete_auto( currentDir, ProtocolName, invID_passed  );  // Updtade later: what should be passed with signal ??
-	      return;
-	    }
-	  
-	  else if (msgBox.clickedButton() == Ignore)
-	    {
-	      reset();
-	      delete_autoflow_record();
-	      emit return_to_experiment( ProtocolName  ); 
-	      return;
-	    }
-	}
-    }  
-}
-
-
 // Function to convert from a time in sec. to days, hours, minutes, seconds 
 void US_XpnDataViewer::timeToList( int& sectime, QList< int >& dhms )
 {
@@ -2152,8 +2074,8 @@
    int ntsrows        = xpn_data->countOf( "scan_rows" );
 DbgLv(1) << "RDr:     ntsrows" << ntsrows;
 DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
+ qApp->processEvents();
 
-
    if ( ntsrows < 1 )
    {
       le_status->setText( tr( "Run %1 has no associated data..." )
@@ -2225,7 +2147,7 @@
       }
    }
 
-   // qApp->processEvents();  //ALEXEY: maybe this will help
+   qApp->processEvents();  //ALEXEY: maybe this will help
    
    qDebug() << "1. Crashes HERE!!!!";
      

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-05-01 21:36:51 UTC (rev 2750)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-05-02 09:48:07 UTC (rev 2751)
@@ -302,8 +302,8 @@
      void   delete_autoflow_record( void );
      void   updateautoflow_record_atLiveUpdate( void );
 
-     void   expStatFive( void );
-     void   expStatThree( void );
+     //void   expStatFive( void );
+     //void   expStatThree( void );
      
      void   load_auc_xpn   ( void );
      void   plot_current   ( void );

Modified: trunk/sql/us3_procedures.sql
===================================================================
--- trunk/sql/us3_procedures.sql	2019-05-01 21:36:51 UTC (rev 2750)
+++ trunk/sql/us3_procedures.sql	2019-05-02 09:48:07 UTC (rev 2751)
@@ -70,6 +70,7 @@
   SET @NO_ROTOR_CAL   = 527;
   SET @INSTRUMENT_IN_USE = 553;
   SET @PROTOCOL_IN_USE   = 554;
+  SET @NO_AUTOFLOW_RECORD = 555;  
 
   -- Some user levels
   SET @US3_USER       = 0;



More information about the us-commits mailing list