Verified Commit d5383c5a authored by Tobias WEBER's avatar Tobias WEBER
Browse files

made gui more compact

parent 9a185997
......@@ -297,7 +297,7 @@ bool PathsTool::ExportPath(PathsExporterFormat fmt)
if(!m_pathsbuilder.AcceptExporter(exporter.get(), m_pathvertices, true))
{
QMessageBox::critical(this, "Error", "path could not be exported.");
QMessageBox::critical(this, "Error", "Path could not be exported.");
return false;
}
......@@ -514,7 +514,7 @@ bool PathsTool::SaveFile(const QString &file)
return false;
}
pt::write_xml(ofstr, prop,
pt::write_xml(ofstr, prop,
pt::xml_writer_make_settings('\t', 1, std::string{"utf-8"}));
SetCurrentFile(file);
......@@ -1049,10 +1049,10 @@ PathsTool::PathsTool(QWidget* pParent) : QMainWindow{pParent}
addDockWidget(Qt::LeftDockWidgetArea, m_tasProperties.get());
addDockWidget(Qt::LeftDockWidgetArea, m_xtalProperties.get());
addDockWidget(Qt::LeftDockWidgetArea, m_xtalInfos.get());
addDockWidget(Qt::RightDockWidgetArea, m_coordProperties.get());
addDockWidget(Qt::RightDockWidgetArea, m_pathProperties.get());
addDockWidget(Qt::RightDockWidgetArea, m_camProperties.get());
addDockWidget(Qt::RightDockWidgetArea, m_xtalInfos.get());
m_xtalInfos->hide();
auto* taswidget = m_tasProperties->GetWidget().get();
......
......@@ -45,34 +45,39 @@ CamPropertiesWidget::CamPropertiesWidget(QWidget *parent)
m_spinViewingAngle->setMaximum(179);
m_spinViewingAngle->setSingleStep(1);
m_spinViewingAngle->setSuffix("°");
m_spinViewingAngle->setToolTip("Camera field of view in units of [deg].");
m_checkPerspectiveProj = new QCheckBox(this);
m_checkPerspectiveProj->setText("Perspective Projection");
m_checkPerspectiveProj->setToolTip("Choose perspective or parallel projection.");
m_checkPerspectiveProj->setChecked(true);
const char* pos_comp[] = {"x", "y", "z"};
for(int pos=0; pos<3; ++pos)
{
m_spinPos[pos] = new QDoubleSpinBox(this);
m_spinPos[pos]->setMinimum(-100);
m_spinPos[pos]->setMaximum(+100);
m_spinPos[pos]->setDecimals(g_prec_gui/2);
m_spinPos[pos]->setDecimals(g_prec_gui);
m_spinPos[pos]->setSingleStep(1);
m_spinPos[pos]->setToolTip(QString("Camera %1 position in units of [m].").arg(pos_comp[pos]));
}
m_spinRot[0] = new QDoubleSpinBox(this);
m_spinRot[0]->setMinimum(0);
m_spinRot[0]->setMaximum(360);
m_spinRot[0]->setDecimals(g_prec_gui/2);
m_spinRot[0]->setDecimals(g_prec_gui);
m_spinRot[0]->setSingleStep(1);
m_spinRot[0]->setSuffix("°");
m_spinRot[0]->setToolTip("Camera φ rotation in units of [deg].");
m_spinRot[1] = new QDoubleSpinBox(this);
m_spinRot[1]->setMinimum(-90);
m_spinRot[1]->setMaximum(0);
m_spinRot[1]->setDecimals(g_prec_gui/2);
m_spinRot[1]->setDecimals(g_prec_gui);
m_spinRot[1]->setSingleStep(1);
m_spinRot[1]->setSuffix("°");
m_spinRot[1]->setToolTip("Camera θ rotation in units of [deg].");
auto *groupProj = new QGroupBox("Projection", this);
{
......@@ -122,7 +127,7 @@ CamPropertiesWidget::CamPropertiesWidget(QWidget *parent)
grid->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding), y++, 0, 1, 1);
// viewing angle
connect(m_spinViewingAngle,
connect(m_spinViewingAngle,
static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &CamPropertiesWidget::ViewingAngleChanged);
......
......@@ -44,6 +44,16 @@
CoordPropertiesWidget::CoordPropertiesWidget(QWidget *parent)
: QWidget{parent}
{
const QString tooltips[] =
{
"Reduced momentum transfer h in relative lattice units [rlu].",
"Reduced momentum transfer k in relative lattice units [rlu].",
"Reduced momentum transfer l in relative lattice units [rlu].",
"Incoming wavenumber ki in units of [Å⁻¹].",
"Outgoing wavenumber kf in units of [Å⁻¹].",
"Energy transfer E in units of [meV].",
};
for(std::size_t i=0; i<m_num_coord_elems; ++i)
{
m_spinCoords[i] = new QDoubleSpinBox(this);
......@@ -53,13 +63,14 @@ CoordPropertiesWidget::CoordPropertiesWidget(QWidget *parent)
m_spinCoords[i]->setSingleStep(0.1);
m_spinCoords[i]->setDecimals(g_prec_gui);
m_spinCoords[i]->setValue(0);
m_spinCoords[i]->setToolTip(tooltips[i]);
if(i==3 || i==4)
m_spinCoords[i]->setSuffix(" Å⁻¹");
else if(i==5)
m_spinCoords[i]->setSuffix(" meV");
else
m_spinCoords[i]->setSuffix(" rlu");
//else
// m_spinCoords[i]->setSuffix(" rlu");
}
for(std::size_t i=1; i<m_num_coord_elems; ++i)
......@@ -67,7 +78,7 @@ CoordPropertiesWidget::CoordPropertiesWidget(QWidget *parent)
m_checkKfFixed = new QCheckBox(this);
m_checkKfFixed->setText("Keep kf = const.");
m_checkKfFixed->setText("kf = const.");
m_checkKfFixed->setToolTip("Select the energy transfer by keeping either ki or kf fixed.");
// default values
......@@ -82,15 +93,6 @@ CoordPropertiesWidget::CoordPropertiesWidget(QWidget *parent)
btnGoto->setToolTip("Set the current instrument position to the given crystal coordinates.");
btnTarget->setToolTip("Set the given crystal coordinates as the target position for pathfinding.");
const char* labels[] = {
"Momentum (h):",
"Momentum (k):",
"Momentum (l):",
"Initial k (ki):",
"Final k (kf):",
"Energy (E):"
};
auto *groupCoords = new QGroupBox(/*"Crystal Coordinates",*/ this);
{
auto *layoutStart = new QGridLayout(groupCoords);
......@@ -99,22 +101,23 @@ CoordPropertiesWidget::CoordPropertiesWidget(QWidget *parent)
layoutStart->setContentsMargins(4,4,4,4);
int y = 0;
for(std::size_t i=0; i<m_num_coord_elems; ++i)
{
layoutStart->addWidget(new QLabel(labels[i], this), y, 0, 1, 1);
layoutStart->addWidget(m_spinCoords[i], y++, 1, 1, 1);
if(i==2)
{
QFrame *separator = new QFrame(this);
separator->setFrameStyle(QFrame::HLine);
layoutStart->addWidget(separator, y++, 0, 1, 2);
}
}
layoutStart->addWidget(m_checkKfFixed, y++, 0, 1, 2);
layoutStart->addWidget(btnGoto, y++, 0, 1, 2);
layoutStart->addWidget(btnTarget, y++, 0, 1, 2);
layoutStart->addWidget(new QLabel("Momentum Transfer (h, k, l) [rlu]:", this), y++, 0, 1, 6);
for(std::size_t i=0; i<3; ++i)
layoutStart->addWidget(m_spinCoords[i], y, i*2, 1, 2);
++y;
layoutStart->addWidget(new QLabel("Wavenumbers (ki, kf) [Å⁻¹]:", this), y++, 0, 1, 6);
for(std::size_t i=3; i<5; ++i)
layoutStart->addWidget(m_spinCoords[i], y, (i-3)*3, 1, 3);
++y;
layoutStart->addWidget(new QLabel("Energy Transfer [meV]:", this), y++, 0, 1, 6);
layoutStart->addWidget(new QLabel("E [meV]:", this), y, 0, 1, 3);
layoutStart->addWidget(m_spinCoords[5], y, 0, 1, 3);
layoutStart->addWidget(m_checkKfFixed, y++, 3, 1, 3);
layoutStart->addWidget(btnGoto, y++, 0, 1, 6);
layoutStart->addWidget(btnTarget, y++, 0, 1, 6);
}
auto *grid = new QGridLayout(this);
......
......@@ -45,6 +45,9 @@
PathPropertiesWidget::PathPropertiesWidget(QWidget *parent)
: QWidget{parent}
{
const QString target_comp[] = { "monochromator/analyser", "sample" };
const QString target_angle[] = { "Θm/a", "Θs" };
for(std::size_t i=0; i<m_num_coord_elems; ++i)
{
m_spinFinish[i] = new QDoubleSpinBox(this);
......@@ -55,6 +58,9 @@ PathPropertiesWidget::PathPropertiesWidget(QWidget *parent)
m_spinFinish[i]->setDecimals(g_prec_gui);
m_spinFinish[i]->setValue(0);
m_spinFinish[i]->setSuffix("°");
m_spinFinish[i]->setToolTip(
QString("Target %1 scattering angle %2 in units of [deg].").
arg(target_comp[i]).arg(target_angle[i]));
}
for(std::size_t i=1; i<m_num_coord_elems; ++i)
......@@ -80,7 +86,7 @@ PathPropertiesWidget::PathPropertiesWidget(QWidget *parent)
m_btnGo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
// TODO: change the label "monochromator" to "analyser" for ki=const mode
const char* labels[] = {"Monochromator:", "Sample:"};
const char* labels[] = {"Mono./Ana.:", "Sample:"};
auto *groupFinish = new QGroupBox("Target Scattering Angles", this);
{
......@@ -136,7 +142,6 @@ PathPropertiesWidget::PathPropertiesWidget(QWidget *parent)
coords[i] = val;
coords[j] = m_spinFinish[j]->value();
//std::cout << coords[0] << ", " << coords[1] << std::endl;
emit TargetChanged(coords[0], coords[1]);
});
}
......
......@@ -42,13 +42,23 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
m_spinMonoScAngle = new QDoubleSpinBox(this);
m_spinSampleScAngle = new QDoubleSpinBox(this);
m_spinAnaScAngle = new QDoubleSpinBox(this);
m_spinMonoScAngle->setToolTip("Monochromator scattering angle Θm in units of [deg].");
m_spinSampleScAngle->setToolTip("Sample scattering angle Θs in units of [deg].");
m_spinAnaScAngle->setToolTip("Analyser scattering angle Θa in units of [deg].");
m_spinMonoXtalAngle = new QDoubleSpinBox(this);
m_spinSampleXtalAngle = new QDoubleSpinBox(this);
m_spinAnaXtalAngle = new QDoubleSpinBox(this);
m_spinMonoXtalAngle->setToolTip("Monochromator crystal rocking angle θm in units of [deg].");
m_spinSampleXtalAngle->setToolTip("Sample crystal rocking angle θm in units of [deg].");
m_spinAnaXtalAngle->setToolTip("Analyser crystal rocking angle θm in units of [deg].");
m_spinMonoD = new QDoubleSpinBox(this);
m_spinAnaD = new QDoubleSpinBox(this);
m_spinMonoD->setToolTip("Monochromator crystal d spacing da in units of [Å].");
m_spinAnaD->setToolTip("Analyser crystal d spacing dm in units of [Å].");
//m_spinMonoD->setPrefix("dm=");
//m_spinAnaD->setPrefix("da=");
QPushButton *btnTarget = new QPushButton("Set Current Angles as Target", this);
btnTarget->setToolTip("Set the current instrument position as the target position for pathfinding.");
......@@ -98,7 +108,7 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
spin->setSuffix(" Å");
}
auto *groupScatterAngles = new QGroupBox("Scattering Angles", this);
auto *groupScatterAngles = new QGroupBox("Scattering Angles [deg]", this);
{
auto *layoutScatterAngles = new QGridLayout(groupScatterAngles);
layoutScatterAngles->setHorizontalSpacing(2);
......@@ -114,7 +124,7 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
layoutScatterAngles->addWidget(m_spinAnaScAngle, y++, 1, 1, 1);
}
auto *groupXtalAngles = new QGroupBox("Crystal Angles", this);
auto *groupXtalAngles = new QGroupBox("Crystal Angles [deg]", this);
{
auto *layoutXtalAngles = new QGridLayout(groupXtalAngles);
layoutXtalAngles->setHorizontalSpacing(2);
......@@ -130,7 +140,7 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
layoutXtalAngles->addWidget(m_spinAnaXtalAngle, y++, 1, 1, 1);
}
auto *groupD = new QGroupBox("d Spacings", this);
auto *groupD = new QGroupBox("d Spacings (Mono/Ana.) [Å]", this);
{
auto *layoutScatter = new QGridLayout(groupD);
layoutScatter->setHorizontalSpacing(2);
......@@ -138,13 +148,12 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
layoutScatter->setContentsMargins(4,4,4,4);
int y = 0;
layoutScatter->addWidget(new QLabel("Monochromator:", this), y, 0, 1, 1);
layoutScatter->addWidget(m_spinMonoD, y++, 1, 1, 1);
layoutScatter->addWidget(new QLabel("Analyser:", this), y, 0, 1, 1);
layoutScatter->addWidget(m_spinAnaD, y++, 1, 1, 1);
int x = 0;
layoutScatter->addWidget(m_spinMonoD, y, x++, 1, 1);
layoutScatter->addWidget(m_spinAnaD, y++, x++, 1, 1);
}
auto *groupSenses = new QGroupBox("Scattering Senses", this);
auto *groupSenses = new QGroupBox("Scattering Senses [ccw]", this);
{
auto *layoutScatter = new QGridLayout(groupSenses);
layoutScatter->setHorizontalSpacing(2);
......@@ -158,17 +167,6 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
m_checkScatteringSense[comp], y, x++, 1, 1);
}
/*auto *groupOptions = new QGroupBox("Options", this);
{
auto *layoutScatter = new QGridLayout(groupOptions);
layoutScatter->setHorizontalSpacing(2);
layoutScatter->setVerticalSpacing(2);
layoutScatter->setContentsMargins(4,4,4,4);
int y = 0;
layoutScatter->addWidget(btnTarget, y++, 0, 1, 1);
}*/
auto *grid = new QGridLayout(this);
grid->setHorizontalSpacing(2);
grid->setVerticalSpacing(2);
......@@ -179,7 +177,6 @@ TASPropertiesWidget::TASPropertiesWidget(QWidget *parent)
grid->addWidget(groupXtalAngles, y++, 0, 1, 1);
grid->addWidget(groupD, y++, 0, 1, 1);
grid->addWidget(groupSenses, y++, 0, 1, 1);
//grid->addWidget(groupOptions, y++, 0, 1, 1);
grid->addWidget(btnTarget, y++, 0, 1, 1);
grid->addItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding), y++, 0, 1, 1);
......
......@@ -43,6 +43,10 @@
XtalPropertiesWidget::XtalPropertiesWidget(QWidget *parent)
: QWidget{parent}
{
const QString consts[] = { "a", "b", "c" };
const QString angles[] = { "α", "β", "γ" };
const QString vec_comp[] = { "ax", "ay", "az", "bx", "by", "bz" };
for(std::size_t i=0; i<m_num_lattice_elems; ++i)
{
m_spinLatticeConsts[i] = new QDoubleSpinBox(this);
......@@ -53,13 +57,17 @@ XtalPropertiesWidget::XtalPropertiesWidget(QWidget *parent)
m_spinLatticeConsts[i]->setSingleStep(0.1);
m_spinLatticeConsts[i]->setDecimals(g_prec_gui);
m_spinLatticeConsts[i]->setValue(5);
m_spinLatticeConsts[i]->setSuffix(" Å");
//m_spinLatticeConsts[i]->setPrefix(QString("%1=").arg(consts[i]));
//m_spinLatticeConsts[i]->setSuffix(" Å");
m_spinLatticeConsts[i]->setToolTip(QString("Crystal lattice constant %1 in units of [Å].").arg(consts[i]));
m_spinLatticeAngles[i]->setMinimum(0);
m_spinLatticeAngles[i]->setMaximum(180);
m_spinLatticeAngles[i]->setDecimals(g_prec_gui/2);
m_spinLatticeAngles[i]->setDecimals(g_prec_gui);
m_spinLatticeAngles[i]->setValue(90);
m_spinLatticeAngles[i]->setSuffix("°");
//m_spinLatticeAngles[i]->setPrefix(QString("%1=").arg(angles[i]));
//m_spinLatticeAngles[i]->setSuffix("°");
m_spinLatticeAngles[i]->setToolTip(QString("Crystal lattice angle %1 in units of [deg].").arg(angles[i]));
}
for(std::size_t i=0; i<m_num_plane_elems; ++i)
......@@ -68,9 +76,12 @@ XtalPropertiesWidget::XtalPropertiesWidget(QWidget *parent)
m_spinPlane[i]->setMinimum(-999);
m_spinPlane[i]->setMaximum(999);
m_spinPlane[i]->setDecimals(g_prec_gui/2);
m_spinPlane[i]->setDecimals(g_prec_gui);
m_spinPlane[i]->setValue((i==0 || i==4) ? 1 : 0);
//m_spinPlane[i]->setSuffix(" rlu");
m_spinPlane[i]->setToolTip(QString(
"%1 component of scattering plane vector %2 in relative lattice units [rlu].")
.arg(vec_comp[i]).arg(i/3 + 1));
}
for(std::size_t i=1; i<m_num_lattice_elems; ++i)
......@@ -88,23 +99,18 @@ XtalPropertiesWidget::XtalPropertiesWidget(QWidget *parent)
layoutLattice->setContentsMargins(4,4,4,4);
int y = 0;
layoutLattice->addWidget(new QLabel("Constant a:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeConsts[0], y++, 1, 1, 1);
layoutLattice->addWidget(new QLabel("Constant b:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeConsts[1], y++, 1, 1, 1);
layoutLattice->addWidget(new QLabel("Constant c:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeConsts[2], y++, 1, 1, 1);
QFrame *separator = new QFrame(this);
separator->setFrameStyle(QFrame::HLine);
layoutLattice->addWidget(separator, y++, 0, 1, 2);
layoutLattice->addWidget(new QLabel("Angle α:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeAngles[0], y++, 1, 1, 1);
layoutLattice->addWidget(new QLabel("Angle β:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeAngles[1], y++, 1, 1, 1);
layoutLattice->addWidget(new QLabel("Angle γ:", this), y, 0, 1, 1);
layoutLattice->addWidget(m_spinLatticeAngles[2], y++, 1, 1, 1);
layoutLattice->addWidget(new QLabel("Constants (a, b, c) [Å]:", this), y++, 0, 1, 3);
int x = 0;
for(std::size_t i=0; i<m_num_lattice_elems; ++i)
layoutLattice->addWidget(m_spinLatticeConsts[i], y, x++, 1, 1);
y++;
layoutLattice->addWidget(new QLabel("Angles (α, β, γ) [deg]:", this), y++, 0, 1, 3);
x = 0;
for(std::size_t i=0; i<m_num_lattice_elems; ++i)
layoutLattice->addWidget(m_spinLatticeAngles[i], y, x++, 1, 1);
}
auto *groupPlane = new QGroupBox("Scattering Plane", this);
......@@ -114,7 +120,7 @@ XtalPropertiesWidget::XtalPropertiesWidget(QWidget *parent)
layoutPlane->setVerticalSpacing(2);
layoutPlane->setContentsMargins(4,4,4,4);
const char* labels[] = { "Vector 1 (rlu):", "Vector 2 (rlu):" };
const char* labels[] = { "Vector 1 [rlu]:", "Vector 2 [rlu]:" };
int y = 0;
for(std::size_t i=0; i<m_num_plane_elems; ++i)
......@@ -364,7 +370,7 @@ XtalPropertiesDockWidget::XtalPropertiesDockWidget(QWidget *parent)
m_widget{std::make_shared<XtalPropertiesWidget>(this)}
{
setObjectName("XtalPropertiesDockWidget");
setWindowTitle("Crystal Definition");
setWindowTitle("Sample Crystal");
setWidget(m_widget.get());
}
......@@ -430,7 +436,6 @@ void XtalInfoWidget::SetUB(const t_mat& matB, const t_mat& matUB)
ostr << "\nUB matrix:\n";
print_mat(matUB);
//std::cout << ostr.str() << std::endl;
m_txt->setPlainText(ostr.str().c_str());
}
......
......@@ -49,7 +49,7 @@ unsigned int g_maxnum_recents = 16;
// epsilons and precisions
int g_prec = 6;
int g_prec_gui = 4;
int g_prec_gui = 3;
t_real g_eps = 1e-6;
t_real g_eps_angular = 0.01 / 180. * tl2::pi<t_real>;
t_real g_eps_gui = 1e-4;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment