Skip to content

Commit

Permalink
Connected light to microprobe coords
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Glowacki committed Dec 2, 2024
1 parent 620f576 commit 0736ce9
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 319 deletions.
11 changes: 1 addition & 10 deletions src/core/uProbeX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,7 @@ void uProbeX::make_VLM_Window(VLM_Model* model)
VLM_Widget* widget = new VLM_Widget();
widget->resize(1027, 768);
widget->setModel(model);
/* TODO: connect properly
connect(widget, &VLM_Widget::solverStart, this, &uProbeX::solverStart);
connect(widget, &VLM_Widget::solverVariableUpdate, this, &uProbeX::solverVariableUpdate);
connect(widget, &VLM_Widget::cancelSolverVariableUpdate, this, &uProbeX::cancelSolverVariableUpdate);
*/

SubWindow* w = new SubWindow(m_mdiArea);
connect(w, &SubWindow::windowClosing, this, &uProbeX::subWindowClosed);

Expand Down Expand Up @@ -520,11 +516,6 @@ void uProbeX::make_VLM_Window(QString path, bool newWindow)
return;
}

/*TODO: connect properly
connect(widget, &VLM_Widget::solverStart, this, &uProbeX::solverStart);
connect(widget, &VLM_Widget::solverVariableUpdate, this, &uProbeX::solverVariableUpdate);
connect(widget, &VLM_Widget::cancelSolverVariableUpdate, this, &uProbeX::cancelSolverVariableUpdate);
*/
SubWindow* w = nullptr;
if (newWindow == true)
{
Expand Down
2 changes: 2 additions & 0 deletions src/gstar/CoordinateWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ namespace gstar
*/
void setnullptr();

CoordinateModel* model() { return m_model; }

private:

/**
Expand Down
2 changes: 2 additions & 0 deletions src/mvc/LiveMapsElementsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ void LiveMapsElementsWidget::createLayout()

_vlm_widget = new VLM_Widget();
_vlm_widget->setAvailScans(&_avail_scans);
gstar::CoordinateModel *coord_model = new gstar::CoordinateModel(&_linear_trans);
_vlm_widget->setCoordinateModel(coord_model);
connect(_vlm_widget, &VLM_Widget::onScanUpdated, this, &LiveMapsElementsWidget::callQueueScan);

_scan_queue_widget = new ScanQueueWidget();
Expand Down
2 changes: 2 additions & 0 deletions src/mvc/LiveMapsElementsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public slots:

zmq::context_t *_context;

LinearCoordTransformer _linear_trans;

int _num_images;
};

Expand Down
7 changes: 0 additions & 7 deletions src/mvc/ScanQueueWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ void ScanQueueWidget::on_remove_scan()

//---------------------------------------------------------------------------

void ScanQueueWidget::onQueueKeyPress(QKeyEvent* event)
{

}

//---------------------------------------------------------------------------

void ScanQueueWidget::updateQueuedItems(std::vector<BlueskyPlan> &finished_plans, std::vector<BlueskyPlan> &queued_plans, BlueskyPlan &running_plan)
{
_scan_queue_table_model->setAllData(finished_plans, queued_plans, running_plan);
Expand Down
2 changes: 0 additions & 2 deletions src/mvc/ScanQueueWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public slots:

void on_remove_scan();

void onQueueKeyPress(QKeyEvent*);

protected:

/**
Expand Down
65 changes: 15 additions & 50 deletions src/mvc/SolverProfileWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ void SolverProfileWidget::addProfile(QString name, QString desc, QMap<QString, d
QList<Attribute> attr;

QMapIterator<QString, double> i(coef);
while (i.hasNext()) {
while (i.hasNext())
{
i.next();
attr.push_back(Attribute(i.key(),
QString::number(i.value()),
"",
true));
attr.push_back(Attribute(i.key(), QString::number(i.value()), "", true));
}

Profile profile;
Expand All @@ -82,17 +80,11 @@ void SolverProfileWidget::addProfile(QString name, QString desc, QMap<QString, d

if (m_profileTable != nullptr)
{
disconnect(m_profileTable,
SIGNAL(addItem(QString, QString)),
this,
SLOT(addProfileItem(QString, QString)));
disconnect(m_profileTable, &ProfileTable::addItem2, this, &SolverProfileWidget::addProfileItem);

m_profileTable->addNewItem(name, desc);

connect(m_profileTable,
SIGNAL(addItem(QString, QString)),
this,
SLOT(addProfileItem(QString, QString)));
connect(m_profileTable, &ProfileTable::addItem2, this, &SolverProfileWidget::addProfileItem);
}

_solverParamWidget->removeCoefficientItems();
Expand All @@ -118,22 +110,10 @@ void SolverProfileWidget::createCompontent()

m_profileTable = new ProfileTable();

connect(m_profileTable,
SIGNAL(addItem(QString, QString)),
this,
SLOT(addProfileItem(QString, QString)));
connect(m_profileTable,
SIGNAL(removeItem(int)),
this,
SLOT(removeProfileItem(int)));
connect(m_profileTable,
SIGNAL(editItem(int, QString)),
this,
SLOT(editProfileItem(int, QString)));
connect(m_profileTable,
SIGNAL(switchItem(const QItemSelection&, const QItemSelection&)),
this,
SLOT(switchProfileItem(const QItemSelection&, const QItemSelection&)));
connect(m_profileTable, &ProfileTable::addItem2, this, &SolverProfileWidget::addProfileItem);
connect(m_profileTable, &ProfileTable::removeItem, this, &SolverProfileWidget::removeProfileItem);
connect(m_profileTable, &ProfileTable::editItem, this, &SolverProfileWidget::editProfileItem);
connect(m_profileTable, &ProfileTable::switchItem, this, &SolverProfileWidget::switchProfileItem);

_solverParamWidget = new SolverParameterWidget();
connect(_solverParamWidget,
Expand Down Expand Up @@ -203,23 +183,15 @@ void SolverProfileWidget::createLayOut()
*/
mainLayout->addRow(_solverParamWidget);
m_btnRunSolver = new QPushButton("Run Solver");
connect(m_btnRunSolver,
SIGNAL(pressed()),
this,
SLOT(runSolver()));
connect(m_btnRunSolver, &QPushButton::pressed, this, &SolverProfileWidget::runSolver);
mainLayout->addRow(m_btnRunSolver);

QHBoxLayout* hLayout2 = new QHBoxLayout();
m_btnSave = new QPushButton("Save");
connect(m_btnSave,
SIGNAL(pressed()),
this,
SLOT(accept()));
/// connect(m_btnSave, &QPushButton::pressed, this, &SolverProfileWidget::saveSolverVariableUpdate);

m_btnCancel = new QPushButton("Cancel");
connect(m_btnCancel,
SIGNAL(pressed()),
this,
SLOT(reject()));
/// connect(m_btnCancel, &QPushButton::pressed, this, &SolverProfileWidget::cancelSolverVariableUpdate);
hLayout2->addWidget(m_btnSave);
hLayout2->addWidget(m_btnCancel);

Expand Down Expand Up @@ -653,15 +625,8 @@ void SolverProfileWidget::runSolver()
m_solverWidget = nullptr;

m_solverWidget = new SolverWidget(this);
connect(m_solverWidget,
SIGNAL(useUpdatedVariables(const QMap<QString, double>)),
this,
SLOT(useUpdatedSolverVariables(const QMap<QString, double> )));

connect(m_solverWidget,
SIGNAL(cancelUpdatedVariables()),
this,
SLOT(cancelUpdatedSolverVariables()));
connect(m_solverWidget, &SolverWidget::useUpdatedVariables, this, &SolverProfileWidget::useUpdatedSolverVariables);
connect(m_solverWidget, &SolverWidget::cancelUpdatedVariables, this, &SolverProfileWidget::cancelUpdatedSolverVariables);

newMinCoefs = _solver->getMinCoef();
m_solverWidget->setCoefs(minCoefs, newMinCoefs);
Expand Down
14 changes: 3 additions & 11 deletions src/mvc/SolverProfileWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,9 @@ class SolverProfileWidget
*/
void solverStart();

/**
* @brief SolverVariableUpdate
* @param valX
* @param valY
*/
void solverVariableUpdate(double valX, double valY);

/**
* @brief CancelSolverVariableUpdate
*/
void cancelSolverVariableUpdate();
void useUpdatedSolverVariables(const QMap<QString,double>);

void cancelUpdatedSolverVariables();

private:

Expand Down
14 changes: 2 additions & 12 deletions src/mvc/SolverWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,12 @@ SolverWidget::SolverWidget(QWidget *parent) : QDialog(parent)
QLabel* lblStatus = new QLabel("Status: ");
m_lblStatus = new QLabel("");


//Create Prepend plus minus buttons
m_btnCancel = new QPushButton("Cancel");
m_btnUse = new QPushButton("Use New Values");

connect(m_btnCancel,
SIGNAL(clicked()),
this,
SLOT(cancel()));


connect(m_btnUse,
SIGNAL(clicked()),
this,
SLOT(useNewValues()));

connect(m_btnCancel, &QPushButton::clicked, this, &SolverWidget::cancel);
connect(m_btnUse, &QPushButton::clicked, this, &SolverWidget::useNewValues);

QHBoxLayout* buttonLayout = new QHBoxLayout();
buttonLayout->setSpacing(5);
Expand Down
Loading

0 comments on commit 0736ce9

Please sign in to comment.