From 033486a9e2423d56f3826d51add92fb898001960 Mon Sep 17 00:00:00 2001 From: alexsav815 Date: Tue, 10 Sep 2024 11:32:57 -0500 Subject: [PATCH] R&D : Labs/Rotor -- allow choosing operator... --- programs/us_experiment/us_exp_utils.cpp | 56 ++++++++++++++----- .../us_experiment_gui_optima.cpp | 2 +- .../us_experiment/us_experiment_gui_optima.h | 1 + 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/programs/us_experiment/us_exp_utils.cpp b/programs/us_experiment/us_exp_utils.cpp index 7d441b2ff..cad05b3ba 100644 --- a/programs/us_experiment/us_exp_utils.cpp +++ b/programs/us_experiment/us_exp_utils.cpp @@ -1016,9 +1016,13 @@ DbgLv(1) << "EGRo: inP: calib_entr" << cal_entr; //setCbCurrentText( cb_optima, optima_name ); // <-- NOT ENOUGH, no connection check //operator + qDebug() << "init Labs: operID + name -- " + << QString::number( rpRotor->operID ) + ": " + rpRotor->opername; + setCbCurrentText( cb_operator, QString::number( rpRotor->operID ) + ": " + rpRotor->opername ); + qDebug() << "init Labs: operator text: " << cb_operator->currentText(); setCbCurrentText( cb_exptype, rpRotor->exptype ); @@ -1076,9 +1080,13 @@ DbgLv(1) << "EGRo: inP: calib_entr" << cal_entr; lb_smes_to_assign -> hide(); te_smes_to_assign -> hide(); pb_remove_sme -> hide(); - + + //show Operator Info: + lb_operator -> setVisible(true); + cb_operator -> setVisible(true); } + expType_old = cb_exptype ->currentText(); qDebug() << "Rotor::initPanel(), expType_old -- " << expType_old; @@ -1453,7 +1461,40 @@ void US_ExperGuiRotor::savePanel() QString lab = cb_lab ->currentText(); QString rot = cb_rotor ->currentText(); QString cal = cb_calibr->currentText(); - QString oper = cb_operator->currentText(); + + //And save info on selected assigned oper(s) & rev(s) + QString oper_list = te_opers_to_assign->toPlainText(); + QString rev_list = te_revs_to_assign->toPlainText(); + QString appr_list = te_apprs_to_assign->toPlainText(); + QString sme_list = te_smes_to_assign->toPlainText(); + + rpRotor->operListAssign = oper_list; + rpRotor->revListAssign = rev_list; + rpRotor->apprListAssign = appr_list; + rpRotor->smeListAssign = sme_list; + + qDebug() << "Lists of o,r,a: " + << oper_list << rev_list << appr_list; + + //QString oper = cb_operator->currentText(); + QString oper; + if ( mainw->usmode ) + oper = cb_operator->currentText(); + else + { + QString oper_t = oper_list.split("\n")[0]; + qDebug() << "oper_t: " << oper_t; + if ( !oper_t.isEmpty() && oper_t.contains(".") ) + { + QString oper_t_id = oper_t.split(".")[0].simplified(); + QString oper_t_name = oper_t.split(".")[1].simplified(); + QString oper_t_lname = oper_t_name.split(",")[0].simplified(); + QString oper_t_fname = oper_t_name.split(",")[1].simplified(); + + oper = oper_t_id + ": " + oper_t_fname + " " + oper_t_lname; + } + } + QString exptype = cb_exptype ->currentText(); QString instr = cb_optima ->currentText(); @@ -1513,17 +1554,6 @@ DbgLv(1) << "EGRo: svP: calndx" << ii << "calGUID" << rpRotor->calGUID; qDebug() << "Rotor Save panel Done: " ; - //And save info on selected assigned oper(s) & rev(s) - QString oper_list = te_opers_to_assign->toPlainText(); - QString rev_list = te_revs_to_assign->toPlainText(); - QString appr_list = te_apprs_to_assign->toPlainText(); - QString sme_list = te_smes_to_assign->toPlainText(); - - rpRotor->operListAssign = oper_list; - rpRotor->revListAssign = rev_list; - rpRotor->apprListAssign = appr_list; - rpRotor->smeListAssign = sme_list; - //if ABDE expType -- translate to 8. AProfie bool expType_changed = ( exptype == expType_old ) ? false : true; diff --git a/programs/us_experiment/us_experiment_gui_optima.cpp b/programs/us_experiment/us_experiment_gui_optima.cpp index 2bdc975eb..177d2a1d2 100644 --- a/programs/us_experiment/us_experiment_gui_optima.cpp +++ b/programs/us_experiment/us_experiment_gui_optima.cpp @@ -1216,7 +1216,7 @@ US_ExperGuiRotor::US_ExperGuiRotor( QWidget* topw ) QLabel* lb_optima_connected = us_label( tr( "Connection Status: " ) ); le_optima_connected = us_lineedit( "", 0, true ); - QLabel* lb_operator = us_label( tr( "Select Operator:" ) ); + lb_operator = us_label( tr( "Select Operator:" ) ); cb_operator = new QComboBox( this ); QLabel* lb_exptype = us_label( tr( "Experiment Type:" ) ); diff --git a/programs/us_experiment/us_experiment_gui_optima.h b/programs/us_experiment/us_experiment_gui_optima.h index cda68ab1d..2845dc72f 100644 --- a/programs/us_experiment/us_experiment_gui_optima.h +++ b/programs/us_experiment/us_experiment_gui_optima.h @@ -161,6 +161,7 @@ class US_ExperGuiRotor : public US_WidgetsDialog QComboBox* cb_rotor; // Rotor combo box QComboBox* cb_calibr; // Calibration combo box QComboBox* cb_operator; // Operator combo box + QLabel* lb_operator; QComboBox* cb_exptype; // Exp. Type combo box QComboBox* cb_optima; QStringList sl_optimas;