[us-commits] r2809 - in trunk/programs: us_com_project us_xpn_viewer
svn at svn.aucsolutions.com
svn at svn.aucsolutions.com
Tue Aug 13 14:56:23 MDT 2019
Author: alexey
Date: 2019-08-13 20:56:22 +0000 (Tue, 13 Aug 2019)
New Revision: 2809
Modified:
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_com_project/us_com_project_gui.h
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
Autoflow: proper closing/resetting lvie_update stage processes when clicking Manage Optima Runs; needs testing
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-13 20:56:22 UTC (rev 2809)
@@ -384,12 +384,16 @@
/*
1. Avaiting for run to be launched ("Back to Managing Optima Runs") -- SET
2. More complex: Back to Managing runs from active LIVE_UPDATE stage -- stop all timers and other processes...
- */
+ */
+
qDebug() << "Jumping from LIVE UPDATE.";
//2. Stop all timers/threads, reset GUI - when stopping fully working LIVE UPDATE
if ( !xpn_viewer_closed_soft )
- emit reset_live_update();
+ {
+ //emit reset_live_update();
+ epanObserv->sdiag->reset_liveupdate_panel_public();
+ }
}
if ( curr_panx == 3 )
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-08-13 20:56:22 UTC (rev 2809)
@@ -172,9 +172,11 @@
US_ObservGui( QWidget* );
~US_ObservGui() {};
+ US_XpnDataViewer* sdiag;
+
private:
US_ComProjectMain* mainw; // Parent to all panels
- US_XpnDataViewer* sdiag;
+ //US_XpnDataViewer* sdiag;
int offset;
protected:
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 20:56:22 UTC (rev 2809)
@@ -244,7 +244,8 @@
in_reload_all_data = false;
in_reload_data_init = false;
in_reload_check_sysdata = false;
-
+ in_reload_end_processes = false;
+
ElapsedTimeOffset = 0;
//ALEXEY: new way
@@ -2141,7 +2142,15 @@
}
}
+
// Reset LIVE UPDATE panel && stop timers && quit threads
+void US_XpnDataViewer::reset_liveupdate_panel_public ( void )
+{
+ reset_liveupdate_panel();
+}
+
+
+// Reset LIVE UPDATE panel && stop timers && quit threads
void US_XpnDataViewer::reset_liveupdate_panel ( void )
{
//Quit sys_thread, emit finished() to stop timer_check_sysdata from withing thread
@@ -2195,17 +2204,44 @@
if ( !timer_data_reload->isActive() )
qDebug() << "QTimer timer_data_reload STOPPED by clickig Manage Optima runs !!! ";
/*************************************/
+
+ qDebug() << "BEFORE: " << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
- reset_auto();
+ //ALEXEY: should wait for execution of all below variables to be false (end of all timer functions) BEFORE reset_all();
+ // Introduce QTimer which checks for all abpve vartibales to be false (check all related functions to always reset them to false on completion)
+ // Put reset_auto() into the timer && and stop/disconnect timer from within connected SLOT.
+ timer_end_processes = new QTimer;
+ connect(timer_end_processes, SIGNAL(timeout()), this, SLOT( end_processes ( ) ));
+ timer_end_processes->start(2000); // 5 sec
+
+ //reset_auto();
+ //qApp->processEvents();
+}
- qDebug() << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
+//to end all existing update processes
+void US_XpnDataViewer::end_processes( void )
+{
+ if ( in_reload_end_processes ) // If already doing a reload,
+ return; // skip starting a new one
- in_reload_auto = false;
- in_reload_all_data = false;
- in_reload_data_init = false;
- in_reload_check_sysdata = false;
+ in_reload_end_processes = true; // Flag in the midst of a reload
- qApp->processEvents();
+ if ( !in_reload_auto && !in_reload_all_data && !in_reload_data_init && !in_reload_check_sysdata )
+ {
+
+ timer_end_processes->stop();
+ disconnect(timer_end_processes, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ reset_auto();
+ qDebug() << "LIVE UPDATE panel has been reset!";
+ qDebug() << "AFTER: " << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
+
+ qApp->processEvents();
+
+ //in_reload_end_processes = false;
+ }
+ else
+ in_reload_end_processes = false;
}
@@ -3928,6 +3964,8 @@
updateautoflow_record_atLiveUpdate();
reset_auto();
+
+ in_reload_auto = false;
//emit experiment_complete_auto( currentDir, ProtocolName, invID_passed, correctRadii ); // Updtade later: what should be passed with signal ??
emit experiment_complete_auto( details_at_live_update );
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-08-13 20:56:22 UTC (rev 2809)
@@ -95,6 +95,8 @@
// New constructor for automated read/upload/update
US_XpnDataViewer(QString auto_mode);
+ void reset_liveupdate_panel_public ( void );
+
private:
bool auto_mode_bool;
@@ -253,6 +255,7 @@
bool in_reload_data_init;
bool in_reload_all_data;
bool in_reload_check_sysdata;
+ bool in_reload_end_processes;
double last_xmin;
@@ -267,6 +270,8 @@
QTimer* timer_all_data_avail;
QTimer* timer_check_sysdata;
+ QTimer* timer_end_processes;
+
QElapsedTimer* elapsed_timer;
QTimer* timer_sys_thread;
@@ -308,6 +313,7 @@
//void retrieve_xpn_raw_auto ( QString & );
void retrieve_xpn_raw_auto ( void );
+ void end_processes ( void );
void reloadData_auto ( void );
int CheckExpComplete_auto( QString & );
void update_autoflow_runId_timeStarted( void );
More information about the us-commits
mailing list