added color to collapse in actions, changed angular for number of data to be received, corrected constant size scan widget

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@48 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d
2012-09-04 10:30:18 +00:00
parent a754e419fe
commit 63fadd3633
11 changed files with 683 additions and 135 deletions

View File

@ -80,6 +80,7 @@ void qActionsWidget::SetMode(int mode){
if(mode) myDet->setActionScript(id,fName.toAscii().constData());
else myDet->setActionScript(id,"");
//mode is not set when fname is blank
if(!fName.isEmpty()){
//check if mode didnt get set
if(mode!=myDet->getActionMode(id)){
@ -95,6 +96,7 @@ void qActionsWidget::SetMode(int mode){
}
}
}
}
@ -189,9 +191,10 @@ void qActionsWidget::Refresh(){
string script = myDet->getActionScript(id);
string parameter = myDet->getActionParameter(id);
//settings values and checking for none
dispScript->setText(QString(script.c_str()));
SetScriptFile();
if(mode)SetScriptFile();
dispParameter->setText(QString(parameter.c_str()));
SetParameter();
//set mode which also checks everything

View File

@ -398,7 +398,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
else if(action==actionSaveTrimbits){
#ifdef VERBOSE
cout << "Saving Trimbits" << endl;
#endif
#endif//different output directory so as not to overwrite
QString fName = QString(myDet->getSettingsDir());
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Trimbits"),fName,
@ -428,8 +428,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
else if(action==actionSaveCalibration){
#ifdef VERBOSE
cout << "Saving Calibration Data" << endl;
#endif
QString fName = QString(myDet->getCalDir())+QString("/newTrims");
#endif//different output directory so as not to overwrite
QString fName = QString(myDet->getCalDir());
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Calibration Data"),fName,
tr("Calibration files (*.cal *.sn*) "));

View File

@ -214,11 +214,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
number_of_exposures = number_of_frames * numScan0 * numScan1;
if(anglePlot) {
int numPos = myDet->getPositions(); //numPos = ((numPos==0) ?1:numPos);
number_of_exposures = numScan0 * numScan1;/*number_of_exposures * numPos;*/
if(anglePlot) number_of_exposures = numScan0 * numScan1;
}
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
// ExposureTime

View File

@ -231,7 +231,7 @@ void qScanWidget::EnableSizeWidgets(){
#ifdef VERBOSE
cout << "Constant Range Values" << endl;
#endif
spinSteps->setMinimum(2);
radioCustom->setText("Specific Values");
radioCustom->setPalette(normal);
radioCustom->setToolTip(customTip);
@ -245,7 +245,11 @@ void qScanWidget::EnableSizeWidgets(){
stackedLayout->setCurrentIndex(RangeValues);
SetRangeSteps();
int oldNumSteps = spinSteps->value();
//if the steps change, it calls SetRangeSteps on its own.
RangeCalculateNumSteps();
if(oldNumSteps==spinSteps->value()) SetRangeSteps();
spinSteps->setMinimum(2);
}
//custom values
else if(radioCustom->isChecked()){
@ -887,6 +891,15 @@ void qScanWidget::SetFileSteps(){
}
}
}
//ERROR IN WRITING FILENAME OR READING FILE
else{
actualNumSteps=0;
positions.resize(0);
SetScan(comboScript->currentIndex());
disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
spinSteps->setValue(actualNumSteps);
connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps()));
}
}
@ -997,7 +1010,7 @@ void qScanWidget::Refresh(){
//settings values and checking for none
dispScript->setText(QString(script.c_str()));
SetScriptFile();
if(mode) SetScriptFile();
dispParameter->setText(QString(parameter.c_str()));
SetParameter();
spinPrecision->setValue(precision);

View File

@ -211,14 +211,26 @@ void qTabActions::Expand(QAbstractButton *button ){
if(index==NumPositions) {
positionWidget->hide();
setFixedHeight(height()-30);//-80 if the checkboxes are included
if(myDet->getPositions()) {
palette->setColor(QPalette::WindowText,Qt::darkGreen);
lblName[index]->setPalette(*palette);
}
}
else if((index==Scan0)||(index==Scan1)) {
scanWidget[GetActualIndex(index)]->hide();
setFixedHeight(height()-130);
if(myDet->getScanMode(GetActualIndex(index))){
palette->setColor(QPalette::WindowText,Qt::darkGreen);
lblName[index]->setPalette(*palette);
}
}
else {
actionWidget[GetActualIndex(index)]->hide();
setFixedHeight(height()-30);
if(myDet->getActionMode(GetActualIndex(index))){
palette->setColor(QPalette::WindowText,Qt::darkGreen);
lblName[index]->setPalette(*palette);
}
}
}else{
// Expand
@ -349,7 +361,7 @@ void qTabActions::Refresh(){
//delete existing positions
if (positions) delete [] positions;
//get number of positions
int numPos=myDet->getPositions();cout<<"numPOs:"<<numPos<<endl;
int numPos=myDet->getPositions();
comboPos->setMaxCount(numPos);
//set the number of positions in the gui
@ -383,6 +395,8 @@ void qTabActions::Refresh(){
scanWidget[i]->Refresh();
for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++)
actionWidget[i]->Refresh();
UpdateCollapseColors();
}
@ -405,3 +419,35 @@ int qTabActions::GetActualIndex(int index){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabActions::UpdateCollapseColors(){
#ifdef VERYVERBOSE
cout << "Updating Collapse Colors" << endl;
#endif
for(int i=0;i<NumTotalActions;i++){
//num positions
if(i==NumPositions){
//if its disabled
if(lblName[i]->isEnabled()){
if(myDet->getPositions()) palette->setColor(QPalette::WindowText,Qt::darkGreen);
else palette->setColor(QPalette::WindowText,Qt::black);
lblName[i]->setPalette(*palette);
}
}
//scans
else if((i==Scan0)||(i==Scan1)){
if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen);
else palette->setColor(QPalette::WindowText,Qt::black);
lblName[i]->setPalette(*palette);
}
//actions
else{
if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen);
else palette->setColor(QPalette::WindowText,Qt::black);
lblName[i]->setPalette(*palette);
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -14,6 +14,7 @@
using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
@ -23,6 +24,8 @@ qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabAdvanced::~qTabAdvanced(){
@ -30,6 +33,7 @@ qTabAdvanced::~qTabAdvanced(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetupWidgetWindow(){
@ -37,8 +41,41 @@ void qTabAdvanced::SetupWidgetWindow(){
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Initialization(){
//energy/angular logs
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetLogs(){
QCheckBox *checkedBox = qobject_cast<QCheckBox *>(sender());
int index = ((!checkedBox->text().compare("Energy Calibration"))?slsDetectorDefs::enCalLog:slsDetectorDefs::angCalLog);
bool enable = checkedBox->isChecked();
#ifdef VERBOSE
if(index==slsDetectorDefs::enCalLog)
cout << "Setting Energy Calibration Logs to " << enable << endl;
else
cout << "Setting Angular Calibration Logs to " << enable << endl;
#endif
//set/unset the log
myDet->setAction(index,(enable?"set":"none"));
//verify
if(myDet->getActionMode(index)!=(enable)){
#ifdef VERBOSE
cout << "Could not set/reset Log." << endl;
#endif
qDefs::WarningMessage("Could not set/reset Log.","Advanced");
checkedBox->setChecked(!enable);
}
}
@ -47,6 +84,14 @@ void qTabAdvanced::Initialization(){
void qTabAdvanced::Refresh(){
//energy/angular logs
chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog));
chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog));
#ifdef VERBOSE
cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl;
cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl;
#endif
}