[us-commits] r2793 - in trunk: gui programs/us_com_project programs/us_experiment programs/us_xpn_viewer
svn at svn.aucsolutions.com
svn at svn.aucsolutions.com
Fri Jul 19 20:38:28 MDT 2019
Author: alexey
Date: 2019-07-20 02:38:26 +0000 (Sat, 20 Jul 2019)
New Revision: 2793
Modified:
trunk/gui/us_select_item.cpp
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_experiment_gui_optima.cpp
trunk/programs/us_experiment/us_experiment_gui_optima.h
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
Log:
Lots of logical updates for autoflow:
Modified: trunk/gui/us_select_item.cpp
===================================================================
--- trunk/gui/us_select_item.cpp 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/gui/us_select_item.cpp 2019-07-20 02:38:26 UTC (rev 2793)
@@ -265,6 +265,7 @@
{ // Return now if there are no list items
QString clabel = tr( "No data found." );
tw_data->setItem ( 0, 0, new QTableWidgetItem( clabel ) );
+ qApp->processEvents();
return;
}
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-07-20 02:38:26 UTC (rev 2793)
@@ -127,7 +127,10 @@
tabWidget->tabBar()->setStyleSheet( "QTabBar::tab {min-width: 70;} QTabBar::tab:selected {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } QTabBar::tab:hover {background: lightgray;} QTabBar::tab:first {background: blue; color: lightgray; min-width: 50;} ");
main->addWidget( tabWidget );
+
+ connect( tabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( initPanels( int ) ) );
+
logWidget = us_textedit();
logWidget->setMaximumHeight(30);
logWidget->setReadOnly(true);
@@ -284,7 +287,9 @@
//tabWidget->tabBar()->setTabTextColor(0, Qt::white);
main->addWidget( tabWidget );
-
+
+ connect( tabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( initPanels( int ) ) );
+
logWidget = us_textedit();
logWidget->setMaximumHeight(30);
logWidget->setReadOnly(true);
@@ -332,6 +337,25 @@
//check_current_stage();
}
+// Slot to init some panels (mainly Manage Opima Runs)
+void US_ComProjectMain::initPanels( int panx )
+{
+ qDebug() << "NEWPanel panx=" << panx << "OLDPanel curr_panx=" << curr_panx;
+
+ // if ( curr_panx == panx )
+ // return;
+
+ if ( panx == 0 ) //Autoflow Records
+ {
+ // Depending on from we jump to InitDialogue, we may need to stop/reset current stages:
+ // E.g., LIVE_UPDATE: stop all timers, reset GUI etc..
+ epanInit ->initAutoflowPanel();
+ }
+ // else
+ // return;
+
+ //curr_panx = panx; // Set new current panel
+}
void US_ComProjectMain::closeEvent( QCloseEvent* event )
{
@@ -347,7 +371,6 @@
}
-
void US_ComProjectMain::close_initDialogue( void )
{
epanInit->pdiag_autoflow->close();
@@ -463,11 +486,46 @@
// Slot to define new exp. (from initial dialog)
void US_ComProjectMain::define_new_experiment( QStringList & occupied_instruments )
{
+ msg_expsetup = new QMessageBox(this);
+ msg_expsetup->setIcon(QMessageBox::Information);
+ msg_expsetup->setWindowFlags ( Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint);
+ msg_expsetup->setStandardButtons(0);
+ msg_expsetup->setText(tr( "Setting up Experiment panel... Please wait...") );
+ msg_expsetup->setStyleSheet("background-color: #36454f; color : #D3D9DF;");
+
+ //msg_expsetup->setWindowModality(Qt::NonModal);
+ //msg_expsetup->setModal( false );
+ //msg_expsetup->setAttribute( Qt::WA_DeleteOnClose );
+ //msg_expsetup->raise();
+
+ int tab_width = this->tabWidget->tabBar()->width();
+ int upper_height = this->gen_banner->height() + //this->welcome->height()
+ + this->logWidget->height() + this->test_footer->height();
+
+ int pos_x = this->width()/2 - tab_width;
+ int pos_y = this->height()/2 - upper_height;
+ msg_expsetup->move(pos_x, pos_y);
+
+ msg_expsetup->show();
+ //msg_expsetup->repaint();
+ qApp->processEvents();
+
+
+ // //msg_expsetup->exec();
+
+ // diag_expsetup = new QDialog( this );
+ // Qt::WindowFlags flags = diag_expsetup->windowFlags();
+ // diag_expsetup->setWindowFlags(flags | Qt::Tool);
+ // diag_expsetup->show();
+
+
tabWidget->setCurrentIndex( 1 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
+ curr_panx = 1;
qDebug() << "In define_new_experiment( QStringList & occupied_instruments )";
-
+
emit pass_used_instruments( occupied_instruments );
+
}
@@ -476,21 +534,24 @@
void US_ComProjectMain::switch_to_live_update( QMap < QString, QString > & protocol_details)
{
tabWidget->setCurrentIndex( 2 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
+ curr_panx = 2;
- // ALEXEY:
+ // ALEXEY:
// (1) Make a record to 'autoflow' table - stage# = 1;
// (2) inside us_xpn_viewer - update 'curDirr' field with generated directory where .auc data saved
emit pass_to_live_update( protocol_details );
}
+
// Slot to pass submitted to Optima run info to the Live Update tab
void US_ComProjectMain::close_all( void )
{
tabWidget->setCurrentIndex( 0 );
- qDebug() << "CLOSING PROGRAM !!!";
+ epanInit ->initAutoflowPanel();
- close();
+ //qDebug() << "CLOSING PROGRAM !!!";
+ //close();
// QProcess process;
// QString pgm("pgrep");
@@ -525,7 +586,8 @@
void US_ComProjectMain::switch_to_post_processing( QMap < QString, QString > & protocol_details )
{
tabWidget->setCurrentIndex( 3 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
-
+ curr_panx = 3;
+
// ALEXEY: Make a record to 'autoflow' table: stage# = 2;
emit import_data_us_convert( protocol_details );
@@ -534,8 +596,8 @@
// Slot to switch back from the Live Update to Experiment tab
void US_ComProjectMain::switch_to_experiment( QString & protocolName )
{
- tabWidget->setCurrentIndex( 1 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
-
+ tabWidget->setCurrentIndex( 1 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
+ curr_panx = 1;
//delete_autoflow_record( runID );
emit clear_experiment( protocolName );
@@ -546,7 +608,8 @@
void US_ComProjectMain::switch_to_editing( QString & currDir, QString & protocolName)
{
tabWidget->setCurrentIndex( 4 ); // Maybe lock this panel from now on? i.e. tabWidget->tabBar()-setEnabled(false) ??
-
+ curr_panx = 4;
+
// ALEXEY: Make a record to 'autoflow' table: stage# = 3;
emit pass_to_editing( currDir, protocolName );
@@ -638,12 +701,19 @@
}
+// Init Autoflow Panel
+void US_InitDialogueGui::initAutoflowPanel( void )
+{
+ initRecords();
+ initRecordsDialogue();
+}
+
// Init Autoflow records
void US_InitDialogueGui::initRecords( void )
{
// Query 'autoflow': get count of records
- int autoflow_records = get_autoflow_records();
+ autoflow_records = get_autoflow_records();
qDebug() << "Autoflow record #: " << autoflow_records;
@@ -673,12 +743,31 @@
occupied_instruments << autoflowdata[ i ][ 2 ];
}
- qDebug() << "Init Autoflow Records: DONE";
+ qDebug() << "Init Autoflow Records: DONE, occupied instruments: " << occupied_instruments;
}
// Init AutoflowRecords Dialogue: call from _main.cpp
void US_InitDialogueGui::initRecordsDialogue( void )
{
+
+ if ( autoflow_records < 1 )
+ {
+ //ALEXEY: should close pdiag_autoflow if wasn't closed already
+
+ occupied_instruments.clear();
+
+ QMessageBox * msg_norec = new QMessageBox;
+ msg_norec->setIcon(QMessageBox::Information);
+ msg_norec->setText(tr( "There are no Optima runs to follow.<br><br>"
+ "You will be switched to <b>Experiment</b> stage to design and submit new protocol."
+ ));
+ msg_norec->exec();
+
+ emit define_new_experiment_init( occupied_instruments );
+
+ return;
+ }
+
QString pdtitle( tr( "Select Optima Run to Follow" ) );
QStringList hdrs;
int prx;
@@ -723,6 +812,8 @@
//disable 'Define Another Exp.' button if all instruments are in use
if ( occupied_instruments.size() >= instruments.size() )
pdiag_autoflow->pb_cancel->setEnabled( false );
+
+ qDebug() << "occupied_instruments.size(), instruments.size()" << occupied_instruments.size() << ", " << instruments.size();
QString autoflow_id_selected("");
@@ -757,7 +848,6 @@
emit define_new_experiment_init( occupied_instruments );
return;
}
-
}
// -------------------------------------------------------------------------------------------------
@@ -787,8 +877,7 @@
qDebug() << "Exp. Label: " << protocol_details[ "label" ];
qDebug() << "GMP Run ? " << protocol_details[ "gmpRun" ];
-
-
+
if ( stage == "LIVE_UPDATE" )
{
//do something
@@ -834,6 +923,30 @@
//Re-read autoflow records
list_all_autoflow_records( autoflowdata, dbP );
+ if ( autoflowdata.size() < 1 )
+ {
+ pdiag_autoflow->close();
+ pdiag_autoflow->close();
+ qApp->processEvents();
+
+ qDebug() << "Was pdiag closed ?? ";
+
+ occupied_instruments.clear();
+
+ QMessageBox * msg_norec_del = new QMessageBox;
+ msg_norec_del->setIcon(QMessageBox::Information);
+ msg_norec_del->setText(tr( "There are no Optima runs to follow.<br><br>"
+ "You will be switched to <b>Experiment</b> stage to design and submit new protocol."
+ ));
+ msg_norec_del->exec();
+
+ emit define_new_experiment_init( occupied_instruments );
+
+ return;
+ }
+
+
+
//Re-count instruments in use
occupied_instruments.clear();
for ( int i=0; i < autoflowdata.size(); i++ )
@@ -848,6 +961,7 @@
else
pdiag_autoflow->pb_cancel->setEnabled( true );
+
qDebug() << "Define Another Exp. button reset";
}
@@ -855,6 +969,8 @@
// Slot to read all Optima machines <------------------------------- // New
void US_InitDialogueGui::read_optima_machines( US_DB2* db )
{
+ this->instruments.clear();
+
QStringList q( "" );
q.clear();
q << QString( "get_instrument_names" )
@@ -1127,12 +1243,13 @@
sdiag->setParent(this, Qt::Widget);
-
-
+
connect( sdiag, SIGNAL( us_exp_is_closed() ), this, SLOT( us_exp_is_closed_set_button() ) );
//connect( this, SIGNAL( set_auto_mode() ), sdiag, SLOT( auto_mode_passed() ) );
connect( this, SIGNAL( define_used_instruments( QStringList & ) ), sdiag, SLOT( exclude_used_instruments( QStringList & ) ) );
+
+ connect( sdiag, SIGNAL( close_expsetup_msg() ), this, SLOT ( expsetup_msg_closed() ) );
connect( sdiag, SIGNAL( to_live_update( QMap < QString, QString > & ) ),
this, SLOT( to_live_update( QMap < QString, QString > & ) ) );
@@ -1221,7 +1338,15 @@
emit to_autoflow_records();
}
+//Close msg on setting up new EXP
+void US_ExperGui::expsetup_msg_closed( void )
+{
+ mainw->msg_expsetup->accept();
+ //mainw->diag_expsetup->close();
+}
+
+
// On click to open US_Experiment <-- NOT USED, us_experimnet is loaded immediately
void US_ExperGui::manageExperiment()
{
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-07-20 02:38:26 UTC (rev 2793)
@@ -78,11 +78,14 @@
void initRecordsDialogue( void );
bool initDialogueOpen;
+ void initAutoflowPanel( void );
private:
US_ComProjectMain* mainw; // Parent to all panels
int offset;
+ int autoflow_records;
+
void initRecords( void );
//void initRecordsDialogue( void );
@@ -138,6 +141,7 @@
void clear_experiment( QString & protocolName);
void exp_cleared( void );
void pass_used_instruments( QStringList & );
+ void expsetup_msg_closed( void );
signals:
void switch_to_live_update( QMap < QString, QString > & protocol_details );
@@ -145,6 +149,7 @@
void reset_experiment( QString & protocolName);
void to_autoflow_records( void );
void define_used_instruments( QStringList & );
+ //void close_expsetup_msg( void );
};
@@ -310,6 +315,9 @@
bool us_mode_bool;
+ QMessageBox * msg_expsetup;
+ QDialog * diag_expsetup;
+
//QList< QStringList > autoflowdata;
//void check_current_stage( void );
@@ -318,7 +326,7 @@
void close_initDialogue();
bool window_closed;
-
+ int curr_panx; // Current panel index (0-7)
//QStringList occupied_instruments;
//US_SelectItem* pdiag_autoflow;
@@ -334,7 +342,7 @@
//int statflag; // Composite panels status flag
//int dbg_level; // Debug print flag
- int curr_panx; // Current panel index (0-7)
+ //int curr_panx; // Current panel index (0-7)
//int get_autoflow_records( void );
//QMap < QString, QString > read_autoflow_record( int );
@@ -344,6 +352,7 @@
//QList< QMap<QString, QString> > instruments;
private slots:
+ void initPanels ( int ); // Move to a new panel
//void reset ( void );
//void newPanel ( int ); // Move to a new panel
//void statUpdate( void ); // Get a status flag update
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.cpp
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-07-20 02:38:26 UTC (rev 2793)
@@ -148,6 +148,8 @@
currProto = US_RunProtocol();
loadProto = US_RunProtocol();
+ epanGeneral->resetPanel();
+
epanRotor->setFirstLab(); //need to reset Lab && savePanel() for Rotors
epanAProfile->reset_sdiag(); //need to reset basic AProfile's protocol to defaults
@@ -186,6 +188,21 @@
void US_ExperimentMain::exclude_used_instruments( QStringList & occupied_instruments )
{
+
+ // QMessageBox * msg_expsetup = new QMessageBox;
+ // msg_expsetup->setIcon(QMessageBox::Information);
+ // msg_expsetup->setWindowFlags ( Qt::CustomizeWindowHint | Qt::WindowTitleHint);
+ // msg_expsetup->setWindowTitle(tr( "Setting Up Experiment Stage") );
+ // msg_expsetup->setText(tr( "Preparing to set up new Experiment...") );
+ // msg_expsetup-> setInformativeText( "<font color='red'>Preparing to set up new Experiment...</font>" );
+ // msg_expsetup->setModal(false);
+ // //msg_expsetup->raise();
+ // msg_expsetup->show();
+ // msg_expsetup->update();
+ // qApp->processEvents();
+
+ reset();
+
instruments_in_use.clear();
qDebug() << "OCCUPIED IINSTRUMENTS: " << occupied_instruments;
@@ -194,6 +211,10 @@
//Re-initialize Instruments based on the passed excluded list
epanRotor->setFirstLab();
+
+ //qApp->processEvents();
+ //msg_expsetup->close();
+ emit close_expsetup_msg();
}
void US_ExperimentMain::us_mode_passed( void )
@@ -397,6 +418,16 @@
}
+//resetPanel
+void US_ExperGuiGeneral::resetPanel( void )
+{
+ le_runid ->setText ("");
+ le_protocol ->setText ("");
+ le_project ->setText ("");
+ le_label ->setText ("");
+
+}
+
// Return detail information for a specific centerpiece as named
bool US_ExperGuiGeneral::centpInfo( const QString cpname,
US_AbstractCenterpiece& cpEntry )
@@ -552,6 +583,7 @@
initPanel();
le_protocol->setText( "" );
le_project ->setText( "" );
+ le_label ->setText( "" );
currProto->exp_label = "";
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.h
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-07-20 02:38:26 UTC (rev 2793)
@@ -65,6 +65,8 @@
QLabel* lb_label;
QLineEdit* le_label; // Run name line edit
+
+ void resetPanel( void );
private:
US_ExperimentMain* mainw; // Parent to all panels
@@ -968,6 +970,7 @@
void us_exp_is_closed( void );
void to_live_update( QMap < QString, QString > &protocol_details );
void exp_cleared ( void );
+ void close_expsetup_msg( void );
};
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-07-19 07:07:20 UTC (rev 2792)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-07-20 02:38:26 UTC (rev 2793)
@@ -2096,11 +2096,11 @@
// QPushButton *okButton = msg_data_avail->addButton(tr("Ok"), QMessageBox::AcceptRole);
// okButton->hide();
- QPushButton *Close = msg_data_avail->addButton(tr("Close Program Now?"), QMessageBox::RejectRole);
+ QPushButton *Close = msg_data_avail->addButton(tr("Return to Managing Optima Runs?"), QMessageBox::RejectRole);
msg_data_avail->setText(tr( "Run named <b>%1</b> was submitted to: <br>"
"<br><b>%2</b> <br>"
"<br>Please start this method scan from the instrument panel. <br>"
- "<br>You may close program now and reattach later by reopening and "
+ "<br>You may return to managing Optima runs now and reattach later by reopening and "
"selecting <b>%1</b> among the list of Optima runs to follow. "
"Alternatively, you can wait untill the method is started from "
"the Optima panel and monitor the progress.")
@@ -2120,7 +2120,8 @@
{
timer_data_init->stop();
disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
-
+
+ reset_auto();
emit close_program();
}
}
More information about the us-commits
mailing list