Esempio n. 1
0
void VESPERSBeamline::flowSwitchConnected(bool connected)
{
	if (connected){

		connect(flowSwitchSet_, SIGNAL(controlSetValuesChanged()), this, SLOT(flowSwitchError()));
		flowSwitchError();
	}
}
Esempio n. 2
0
void VESPERSBeamline::valveConnected(bool connected)
{
	if (connected){

		connect(valveSet_, SIGNAL(controlSetValuesChanged()), this, SLOT(valveError()));
		valveError();
	}
}
Esempio n. 3
0
void VESPERSBeamline::ionPumpConnected(bool connected)
{
	if (connected){

		connect(ionPumpSet_, SIGNAL(controlSetValuesChanged()), this, SLOT(ionPumpError()));
		ionPumpError();
	}
}
Esempio n. 4
0
VESPERSPersistentView::VESPERSPersistentView(QWidget *parent) :
	QWidget(parent)
{
	// The shutter buttons.
	psh1_ = new CLSStopLightButton(qobject_cast<CLSBiStateControl *>(VESPERSBeamline::vespers()->photonShutter1()));
	connect(psh1_, SIGNAL(clicked()), this, SLOT(onPSH1Clicked()));
	psh2_ = new CLSStopLightButton(qobject_cast<CLSBiStateControl *>(VESPERSBeamline::vespers()->photonShutter2()));
	connect(psh2_, SIGNAL(clicked()), this, SLOT(onPSH2Clicked()));
	ssh1_ = new CLSStopLightButton(qobject_cast<CLSBiStateControl *>(VESPERSBeamline::vespers()->safetyShutter1()));
	connect(ssh1_, SIGNAL(clicked()), this, SLOT(onSSH1Clicked()));
	ssh2_ = new CLSStopLightButton(qobject_cast<CLSBiStateControl *>(VESPERSBeamline::vespers()->safetyShutter2()));
	connect(ssh2_, SIGNAL(clicked()), this, SLOT(onSSH2Clicked()));

	// Sample stage widget.
	pseudoMotors_ = new VESPERSSampleStageView(VESPERSBeamline::vespers()->pseudoSampleStage());
	pseudoMotors_->setTitle("H & V");
	pseudoMotors_->setHorizontalTitle("H");
	pseudoMotors_->setVerticalTitle("V");

	realMotors_ = new VESPERSSampleStageView(VESPERSBeamline::vespers()->realSampleStage());
	realMotors_->setTitle("X & Z");
	realMotors_->setHorizontalTitle("X");
	realMotors_->setVerticalTitle("Z");
	realMotors_->hide();

	// PID control view widget.
	VESPERSPIDLoopControlView *pidView = new VESPERSPIDLoopControlView(VESPERSBeamline::vespers()->sampleStagePID());
	connect(VESPERSBeamline::vespers()->sampleStagePID(), SIGNAL(stateChanged(bool)), pseudoMotors_, SLOT(setEnabled(bool)));
	connect(VESPERSBeamline::vespers()->sampleStagePID(), SIGNAL(stateChanged(bool)), realMotors_, SLOT(setEnabled(bool)));

	// The temperature control.
	temperature_ = VESPERSBeamline::vespers()->temperatureSet();
	connect(temperature_, SIGNAL(controlSetValuesChanged()), this, SLOT(onTemperatureStateChanged()));

	// The pressure control.
	pressure_ = VESPERSBeamline::vespers()->pressureSet();
	connect(pressure_, SIGNAL(controlSetValuesChanged()), this, SLOT(onPressureStateChanged()));

	// The flow switches.
	flowSwitches_ = VESPERSBeamline::vespers()->flowSwitchSet();
	connect(flowSwitches_, SIGNAL(controlSetValuesChanged()), this, SLOT(onWaterStateChanged()));

	// The flow transducers.
	flowTransducers_ = VESPERSBeamline::vespers()->flowTransducerSet();
	connect(flowTransducers_, SIGNAL(controlSetValuesChanged()), this, SLOT(onWaterStateChanged()));

	QFont font(this->font());
	font.setBold(true);

	QLabel *pshShutterLabel = new QLabel("Front End Shutters");
	pshShutterLabel->setFont(font);
	QLabel *sshShutterLabel = new QLabel("Beamline Shutters");
	sshShutterLabel->setFont(font);
	QLabel *beamSelectionLabel = new QLabel("Beam Selection");
	beamSelectionLabel->setFont(font);
	QLabel *slitsLabel = new QLabel("Intermediate Slit Gaps");
	slitsLabel->setFont(font);
	QLabel *endstationShutterLabel = new QLabel("Endstation");
	endstationShutterLabel->setFont(font);
	QLabel *statusLabel = new QLabel("Beamline Status");
	statusLabel->setFont(font);
	QLabel *experimentReadyLabel = new QLabel("Experiment Ready Status");
	experimentReadyLabel->setFont(font);
	QLabel *ionChamberLabel = new QLabel("Ion Chamber Calibration");
	ionChamberLabel->setFont(font);

	// Shutter layout.
	QGridLayout *shutterLayout = new QGridLayout;
	shutterLayout->addWidget(pshShutterLabel, 0, 0, 1, 2);
	shutterLayout->addWidget(sshShutterLabel, 0, 2, 1, 2);
	shutterLayout->addWidget(psh1_);
	shutterLayout->addWidget(ssh1_);
	shutterLayout->addWidget(psh2_);
	shutterLayout->addWidget(ssh2_);

	// Beam selection and mono energy setting.
	VESPERSBeamSelectorView *beamSelectorView = new VESPERSBeamSelectorView;
	connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onBeamChanged(VESPERS::Beam)));

	// Energy (Eo) selection
	energySetpoint_ = new QDoubleSpinBox;
	energySetpoint_->setSuffix(" eV");
	energySetpoint_->setMinimum(0);
	energySetpoint_->setMaximum(30000);
	energySetpoint_->setAlignment(Qt::AlignCenter);
	connect(energySetpoint_, SIGNAL(editingFinished()), this, SLOT(setEnergy()));
	connect(VESPERSBeamline::vespers()->mono(), SIGNAL(EoChanged(double)), this, SLOT(onEnergyChanged(double)));

	energyFeedback_ = new QLabel;
	energyFeedback_->setAlignment(Qt::AlignCenter);
	connect(VESPERSBeamline::vespers()->mono(), SIGNAL(energyChanged(double)), this, SLOT(onEnergyFeedbackChanged(double)));

	QHBoxLayout *energySetpointLayout = new QHBoxLayout;
	energySetpointLayout->addWidget(new QLabel("Energy:"));
	energySetpointLayout->addWidget(energySetpoint_);
	energySetpointLayout->addWidget(energyFeedback_);
	energySetpointLayout->setContentsMargins(15, 11, 11, 11);

	QVBoxLayout *beamSelectionLayout = new QVBoxLayout;
	beamSelectionLayout->addWidget(beamSelectionLabel);
	beamSelectionLayout->addWidget(beamSelectorView, 0, Qt::AlignCenter);
	beamSelectionLayout->addLayout(energySetpointLayout);

	// The intermediate slits.
	slits_ = VESPERSBeamline::vespers()->intermediateSlits();

	xSlit_ = new QDoubleSpinBox;
	xSlit_->setSuffix(" mm");
	xSlit_->setDecimals(3);
	xSlit_->setSingleStep(0.001);
	connect(slits_, SIGNAL(gapXChanged(double)), xSlit_, SLOT(setValue(double)));
	connect(xSlit_, SIGNAL(editingFinished()), this, SLOT(setXGap()));

	zSlit_ = new QDoubleSpinBox;
	zSlit_->setSuffix(" mm");
	zSlit_->setDecimals(3);
	zSlit_->setSingleStep(0.001);
	connect(slits_, SIGNAL(gapZChanged(double)), zSlit_, SLOT(setValue(double)));
	connect(zSlit_, SIGNAL(editingFinished()), this, SLOT(setZGap()));

	QHBoxLayout *slitsLayout = new QHBoxLayout;
	slitsLayout->addWidget(new QLabel("H:"), 0, Qt::AlignRight);
	slitsLayout->addWidget(xSlit_);
	slitsLayout->addWidget(new QLabel("V:"), 0, Qt::AlignRight);
	slitsLayout->addWidget(zSlit_);
	slitsLayout->setContentsMargins(15, 11, 11, 11);

	// The Experiment Ready Status
	experimentReady_ = new QLabel;
	experimentReady_->setPixmap(QIcon(":/RED.png").pixmap(25));
	connect(VESPERSBeamline::vespers()->experimentConfiguration(), SIGNAL(experimentReady(bool)), this, SLOT(onExperimentStatusChanged(bool)));

	QHBoxLayout *experimentReadyLayout = new QHBoxLayout;
	experimentReadyLayout->addWidget(experimentReady_);
	experimentReadyLayout->addWidget(experimentReadyLabel);
	experimentReadyLayout->setSpacing(10);
	experimentReadyLayout->setContentsMargins(15, 11, 11, 11);
	experimentReadyLayout->addStretch();

	// Endstation shutter control.
	filterLowerButton_ = new QPushButton("Open Shutter");
	filterLowerButton_->setCheckable(true);
	connect(filterLowerButton_, SIGNAL(clicked()), this, SLOT(toggleShutterState()));

	filterLabel_ = new QLabel;
	filterLabel_->setPixmap(QIcon(":/RED.png").pixmap(25));
	connect(VESPERSBeamline::vespers()->endstation(), SIGNAL(shutterChanged(bool)), this, SLOT(onShutterStateChanged(bool)));

	// Setup the filters.
	filterComboBox_ = new QComboBox;
	filterComboBox_->addItem("None");
	filterComboBox_->addItem(QString::fromUtf8("50 μm"));
	filterComboBox_->addItem(QString::fromUtf8("100 μm"));
	filterComboBox_->addItem(QString::fromUtf8("150 μm"));
	filterComboBox_->addItem(QString::fromUtf8("200 μm"));
	filterComboBox_->addItem(QString::fromUtf8("250 μm"));
	filterComboBox_->addItem(QString::fromUtf8("300 μm"));
	filterComboBox_->addItem(QString::fromUtf8("350 μm"));
	filterComboBox_->addItem(QString::fromUtf8("400 μm"));
	filterComboBox_->addItem(QString::fromUtf8("450 μm"));
	filterComboBox_->addItem(QString::fromUtf8("500 μm"));
	filterComboBox_->addItem(QString::fromUtf8("550 μm"));
	filterComboBox_->addItem(QString::fromUtf8("600 μm"));
	filterComboBox_->addItem(QString::fromUtf8("650 μm"));
	filterComboBox_->addItem(QString::fromUtf8("700 μm"));
	filterComboBox_->addItem(QString::fromUtf8("750 μm"));
	filterComboBox_->addItem(QString::fromUtf8("800 μm"));
	connect(filterComboBox_, SIGNAL(currentIndexChanged(int)), VESPERSBeamline::vespers()->endstation(), SLOT(setFilterThickness(int)));
	connect(VESPERSBeamline::vespers()->endstation(), SIGNAL(filterThicknessChanged(int)), this, SLOT(onFiltersChanged(int)));

	QHBoxLayout *filterLayout = new QHBoxLayout;
	filterLayout->addWidget(filterLabel_);
	filterLayout->addWidget(filterLowerButton_);
	filterLayout->addWidget(new QLabel("Filters:"));
	filterLayout->addWidget(filterComboBox_);
	filterLayout->setSpacing(5);
	filterLayout->setContentsMargins(15, 11, 11, 11);

	// The valve control.
	valvesButton_ = new QPushButton("Open Valves");
	connect(valvesButton_, SIGNAL(clicked()), this, SLOT(onValvesButtonPushed()));

	valvesStatus_ = new QLabel;
	valvesStatus_->setPixmap(QIcon(":/RED.png").pixmap(25));
	connect(VESPERSBeamline::vespers()->valveSet(), SIGNAL(controlSetValuesChanged()), this, SLOT(onValvesStateChanged()));

	QLabel *valveIcon = new QLabel;
	valveIcon->setPixmap(QIcon(":/valveIcon.png").pixmap(25));
	valveIcon->setToolTip("Valve Indicator");

	// Temp, water, and pressure labels.
	tempLabel_ = new QLabel;
	tempLabel_->setPixmap(QIcon(":/RED.png").pixmap(25));
	QLabel *temperatureIcon = new QLabel;
	temperatureIcon->setPixmap(QIcon(":/ThermometerIcon.png").pixmap(25));
	temperatureIcon->setToolTip("Temperature Indicator");

	pressureLabel_ = new QLabel;
	pressureLabel_->setPixmap(QIcon(":/RED.png").pixmap(25));
	QLabel *pressureIcon = new QLabel;
	pressureIcon->setPixmap(QIcon(":/PressureIcon.png").pixmap(25));
	pressureIcon->setToolTip("Pressure Indicator");

	waterLabel_ = new QLabel;
	waterLabel_->setPixmap(QIcon(":/RED.png").pixmap(25));
	QLabel *waterIcon = new QLabel;
	waterIcon->setPixmap(QIcon(":/FaucetIcon.png").pixmap(25));
	waterIcon->setToolTip("Water Indicator");

	// Ion chambers.
	QVBoxLayout *ionChamberLayout = new QVBoxLayout;
	ionChamberLayout->addWidget(new CLSSplitIonChamberView(VESPERSBeamline::vespers()->iSplit()));
	ionChamberLayout->addWidget(new CLSIonChamberView(VESPERSBeamline::vespers()->iPreKB()));
	ionChamberLayout->addWidget(new CLSIonChamberView(VESPERSBeamline::vespers()->iMini()));
	ionChamberLayout->addWidget(new CLSIonChamberView(VESPERSBeamline::vespers()->iPost()));

	// Layout.
	QGridLayout *statusLayout = new QGridLayout;
	statusLayout->addWidget(temperatureIcon, 0, 0);
	statusLayout->addWidget(pressureIcon, 0, 1);
	statusLayout->addWidget(waterIcon, 0, 2);
	statusLayout->addWidget(valveIcon, 0, 3);
	statusLayout->addWidget(tempLabel_, 1, 0);
	statusLayout->addWidget(pressureLabel_, 1, 1);
	statusLayout->addWidget(waterLabel_, 1, 2);
	statusLayout->addWidget(valvesStatus_, 1, 3);
	statusLayout->addWidget(valvesButton_, 1, 4, 1, 2);
	statusLayout->setContentsMargins(15, 7, 11, 7);

	QHBoxLayout *sampleStageLayout = new QHBoxLayout;
	sampleStageLayout->addWidget(pseudoMotors_);
	sampleStageLayout->addWidget(realMotors_);

	QVBoxLayout *persistentLayout = new QVBoxLayout;
	persistentLayout->addLayout(shutterLayout);
	persistentLayout->addLayout(beamSelectionLayout);
	persistentLayout->addWidget(slitsLabel);
	persistentLayout->addLayout(slitsLayout);
	persistentLayout->addLayout(sampleStageLayout);
	persistentLayout->addWidget(pidView);
	persistentLayout->addLayout(experimentReadyLayout);
	persistentLayout->addWidget(endstationShutterLabel);
	persistentLayout->addLayout(filterLayout);
	persistentLayout->addWidget(ionChamberLabel);
	persistentLayout->addLayout(ionChamberLayout);
	persistentLayout->addWidget(statusLabel);
	persistentLayout->addLayout(statusLayout);
	persistentLayout->addStretch();

	QGroupBox *vespersBox = new QGroupBox;
	vespersBox->setLayout(persistentLayout);

	QVBoxLayout *vespersLayout = new QVBoxLayout;
	vespersLayout->addWidget(vespersBox);

	setLayout(vespersLayout);
	//setFixedSize(325, 1000);
	setFixedSize(325, 900);
//    setFixedSize(325, 800);
}