bool SGMSSAAppController::startup() {

	// Initialize AMBeamline::bl() as an SGMBeamline::sgm() instance. FIRST!
	SGMBeamline::sgm();

	if(AMAppController::startup()) {

		// Testing and making the first run in the database, if there isn't one already.  Make this it's own function if you think startup() is getting too big ; )
		////////////////////////////////////////

		AMRun existingRun;
		if(!existingRun.loadFromDb(AMDatabase::database("user"), 1)) {
			// no run yet... let's create one.
			AMRun firstRun("SGM", 3);	/// \todo For now, we know that 5 is the ID of the REIXS facility, but this is a hardcoded hack.
			firstRun.storeToDb(AMDatabase::database("user"));
		}




		// Create panes in the main window:
		////////////////////////////////////

		mw_->insertHeading("Beamline Control", 0);
		//////////
		/*
		samplePositionView_ = new AMSampleManagementWidget(new SGMSampleManipulatorView(),
									QUrl("http://ccd1611-403/axis-cgi/mjpg/video.cgi?resolution=1280x1024&.mjpg"),
									SGMBeamline::sgm()->currentSamplePlate());
		mw_->addPane(samplePositionView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png");
		connect(samplePositionView_, SIGNAL(newSamplePlateSelected(AMSamplePlate*)), SGMBeamline::sgm(), SLOT(setCurrentSamplePlate(AMSamplePlate*)));

		connect(SGMBeamline::sgm(), SIGNAL(currentSamplePlateChanged(AMSamplePlate*)), workflowManagerView_, SLOT(setCurrentSamplePlate(AMSamplePlate*)));
		*/
		sampleManipulatorView_ = new SGMSampleManipulatorView(true);
		mw_->addPane(sampleManipulatorView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png");


		connect(SGMBeamline::sgm(), SIGNAL(criticalControlsConnectionsChanged()), this, SLOT(onSGMBeamlineConnected()));

		/*! \todo: hook up bottom-bar signals to the active scan controller.
	void MainWindow::onScanControllerReady(AMScanController *scanController){
		connect(bottomBar_, SIGNAL(pauseScanIssued()), scanController, SLOT(pause()));
		connect(bottomBar_, SIGNAL(stopScanIssued()), scanController, SLOT(cancel()));
		connect(scanController, SIGNAL(progress(double,double)), bottomBar_, SLOT(updateScanProgress(double,double)));
	}
	*/
		sgmSidebar_ = new SGMSidebar();
		mw_->addRightWidget(sgmSidebar_);

		mw_->move(0, 0);

		return true;
	}
	else
		return false;
}
bool SGMSSAAppController::startup() {

	if(CLSAppController::startup()) {

		// Create panes in the main window:
		////////////////////////////////////

		mw_->insertHeading("Beamline Control", 0);
		//////////
		/*
		samplePositionView_ = new AMSampleManagementWidget(new SGMSampleManipulatorView(),
									QUrl("http://ccd1611-403/axis-cgi/mjpg/video.cgi?resolution=1280x1024&.mjpg"),
									SGMBeamline::sgm()->currentSamplePlate());
		mw_->addPane(samplePositionView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png");
		connect(samplePositionView_, SIGNAL(newSamplePlateSelected(AMSamplePlate*)), SGMBeamline::sgm(), SLOT(setCurrentSamplePlate(AMSamplePlate*)));

		connect(SGMBeamline::sgm(), SIGNAL(currentSamplePlateChanged(AMSamplePlate*)), workflowManagerView_, SLOT(setCurrentSamplePlate(AMSamplePlate*)));
		*/
		sampleManipulatorView_ = new SGMSampleManipulatorView(true);
		mw_->addPane(sampleManipulatorView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png");


		connect(SGMBeamline::sgm(), SIGNAL(criticalControlsConnectionsChanged()), this, SLOT(onSGMBeamlineConnected()));

		/*! \todo: hook up bottom-bar signals to the active scan controller.
	void MainWindow::onScanControllerReady(AMScanController *scanController){
		connect(bottomBar_, SIGNAL(pauseScanIssued()), scanController, SLOT(pause()));
		connect(bottomBar_, SIGNAL(stopScanIssued()), scanController, SLOT(cancel()));
		connect(scanController, SIGNAL(progress(double,double)), bottomBar_, SLOT(updateScanProgress(double,double)));
	}
	*/
		sgmSidebar_ = new SGMSidebar();
		mw_->addRightWidget(sgmSidebar_);

		mw_->move(0, 0);

		return true;
	}
	else
		return false;
}
Exemple #3
0
SGMFastScanConfigurationView::SGMFastScanConfigurationView(SGMFastScanConfiguration *sfsc, QWidget *parent) :
		AMScanConfigurationView(parent)
{
	cfg_ = NULL;

	if(SGMBeamline::sgm()->isConnected()){
		cfg_ = sfsc;

		topFrame_ = new AMTopFrame("Configure a Fast Scan to Run Later");
		topFrame_->setIcon(QIcon(":/utilities-system-monitor.png"));

		presetsComboBox_ = new QComboBox();
		presetsComboBox_->addItems(sfsc->presets());
		connect(presetsComboBox_, SIGNAL(currentIndexChanged(int)), sfsc, SLOT(setParametersFromPreset(int)));

		connect(sfsc, SIGNAL(startPositionChanged()), this, SLOT(onParametersStartPositionChanged()));
		connect(sfsc, SIGNAL(middlePositionChanged()), this, SLOT(onParametersMiddlePositionChanged()));
		connect(sfsc, SIGNAL(endPositionChanged()), this, SLOT(onParametersEndPositionChanged()));
		connect(sfsc, SIGNAL(fastScanSettingsChanged()), this, SLOT(onFastScanSettingsChanged()));

		warningsLabel_ = new QLabel("");
		QFont warningsFont;
		warningsFont.setPointSize(48);
		warningsLabel_->setFont(warningsFont);
		warningsLabel_->setStyleSheet( "QLabel{ color: red }" );

		scanNameLabel_ = new QLabel("Scan Name");
		scanNameEdit_ = new QLineEdit(this);

		connect(scanNameEdit_, SIGNAL(textEdited(QString)), this, SLOT(onScanNameEditChanged(QString)));

		startPositionView_ = 0;
		middlePositionView_ = 0;
		endPositionView_ = 0;
		fastScanSettingsView_ = 0;

		onParametersStartPositionChanged();
		onParametersMiddlePositionChanged();
		onParametersEndPositionChanged();
		onFastScanSettingsChanged();

		startPositionView_ = new SGMEnergyPositionWBeamlineView(&startPositionCopy_, SGMEnergyPositionView::ViewModeStartOrEnd);
		middlePositionView_ = new SGMEnergyPositionWBeamlineView(&middlePositionCopy_, SGMEnergyPositionView::ViewModeMiddle);
		endPositionView_ = new SGMEnergyPositionWBeamlineView(&endPositionCopy_, SGMEnergyPositionView::ViewModeStartOrEnd);
		fastScanSettingsView_ = new SGMFastScanSettingsView(&fastScanSettingsCopy_);

		QHBoxLayout *presetsLayout = new QHBoxLayout();
		presetsLayout->addWidget(presetsComboBox_);
		presetsLayout->addStretch(10);

		QVBoxLayout *settingsLayout = new QVBoxLayout();
		settingsLayout->addWidget(fastScanSettingsView_);
		settingsLayout->addStretch(8);
		settingsLayout->setContentsMargins(5,0,5,0);

		QVBoxLayout *positionsLayout = new QVBoxLayout();
		positionsLayout->addWidget(startPositionView_);
		positionsLayout->addWidget(middlePositionView_);
		positionsLayout->addWidget(endPositionView_);
		positionsLayout->addStretch(8);
		positionsLayout->setContentsMargins(5,0,5,0);

		QHBoxLayout *hl = new QHBoxLayout();
		hl->addLayout(settingsLayout);
		hl->addLayout(positionsLayout);

		QHBoxLayout *nameHL = new QHBoxLayout();
		nameHL->addWidget(scanNameLabel_);
		nameHL->addWidget(scanNameEdit_);

		QVBoxLayout *mainLayout = new QVBoxLayout();
		mainLayout->addLayout(presetsLayout);
		mainLayout->addLayout(hl);
		mainLayout->addWidget(warningsLabel_);
		mainLayout->addStretch(10);
		mainLayout->addLayout(nameHL);

		QVBoxLayout *vl = new QVBoxLayout();
		vl->addWidget(topFrame_);
		vl->addLayout(mainLayout);
		vl->setContentsMargins(0,0,0,0);
		vl->setSpacing(1);
		mainLayout->setContentsMargins(10, 0, 10, 0);
		this->setLayout(vl);
		this->setMaximumSize(700, 800);

		connect(SGMBeamline::sgm(), SIGNAL(criticalControlsConnectionsChanged()), this, SLOT(onSGMBeamlineCriticalControlsConnectedChanged()));
		onSGMBeamlineCriticalControlsConnectedChanged();
	}
}