Skip to content

Commit

Permalink
RE 6901 MantidEV usability improvements
Browse files Browse the repository at this point in the history
Added menu option to reset default state of all GUI components.
Removed some debug prints.

refs #6901
  • Loading branch information
DennisMikkelson committed Apr 24, 2013
1 parent 9d6131e commit 4fcf217
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 76 deletions.
1 change: 0 additions & 1 deletion Code/Mantid/Framework/DataObjects/src/PeaksWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ namespace Mantid
{
Peak pk = getPeak(i);
double D = QLabFrame.distance(pk.getQLabFrame() );
std::cout<<"D="<<D<<std::endl;
if( D < minDist)
{
minDist = D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ private slots:
/// Slot for Show Info button on Point Info form
void showInfo_slot();


//
// The following slots take care of the menu items
//
Expand All @@ -232,6 +231,9 @@ private slots:
/// Slot to load a previous MantidEV GUI state
void loadState_slot();

/// Slot to restore default GUI state
void setDefaultState_slot();

/// Slot to save the UB matrix from the current MantidEV peaks workspace
void saveIsawUB_slot();

Expand Down Expand Up @@ -296,7 +298,9 @@ private slots:

/// Methods to handle pointed at message from any source
void handleQpointNotification(const Poco::AutoPtr<Mantid::API::SelectionNotificationServiceImpl::AddNotification> & message );

void handleQpointNotification1(const Poco::AutoPtr<Mantid::API::SelectionNotificationServiceImpl::AfterReplaceNotification> & message );

/// Method to get and display info about the specified Q-vector
void showInfo( Mantid::Kernel::V3D q_point );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
<property name="title">
<string>File</string>
</property>
<addaction name="actionSave_State"/>
<addaction name="actionLoad_State"/>
<addaction name="actionSave_Isaw_UB"/>
<addaction name="actionLoad_Isaw_UB"/>
<addaction name="actionSave_Isaw_Peaks"/>
<addaction name="actionLoad_Isaw_Peaks"/>
<addaction name="actionSave_State"/>
<addaction name="actionLoad_State"/>
<addaction name="actionReset_Default_Settings"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
Expand Down Expand Up @@ -1641,6 +1642,16 @@
<string>Close</string>
</property>
</action>
<action name="actionReset_Defaults_in_GUI">
<property name="text">
<string>Reset Defaults in GUI</string>
</property>
</action>
<action name="actionReset_Default_Settings">
<property name="text">
<string>Reset Default Settings</string>
</property>
</action>
</widget>
<resources/>
<connections/>
Expand Down
173 changes: 101 additions & 72 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MantidEV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ MantidEV::MantidEV(QWidget *parent) : UserSubWindow(parent),observer(*this, &Man
m_thread_pool->setMaxThreadCount(1);

SelectionNotificationService::Instance().notificationCenter.addObserver(observer);


SelectionNotificationService::Instance().notificationCenter.addObserver(observer1);

}


Expand Down Expand Up @@ -233,26 +230,29 @@ void MantidEV::initLayout()
this, SLOT(showInfo_slot()) );

// connect the slots for the menu items
QObject::connect( m_uiForm.actionSave_State, SIGNAL(triggered()),
this, SLOT(saveState_slot()) );
QObject::connect( m_uiForm.actionSave_State, SIGNAL(triggered()),
this, SLOT(saveState_slot()) );

QObject::connect( m_uiForm.actionLoad_State, SIGNAL(triggered()),
this, SLOT(loadState_slot()) );
QObject::connect( m_uiForm.actionLoad_State, SIGNAL(triggered()),
this, SLOT(loadState_slot()) );

QObject::connect( m_uiForm.actionSave_Isaw_UB, SIGNAL(triggered()),
this, SLOT(saveIsawUB_slot()) );
QObject::connect( m_uiForm.actionReset_Default_Settings, SIGNAL(triggered()),
this, SLOT( setDefaultState_slot()) );

QObject::connect( m_uiForm.actionLoad_Isaw_UB, SIGNAL(triggered()),
this, SLOT(loadIsawUB_slot()) );
QObject::connect( m_uiForm.actionSave_Isaw_UB, SIGNAL(triggered()),
this, SLOT(saveIsawUB_slot()) );

QObject::connect( m_uiForm.actionSave_Isaw_Peaks, SIGNAL(triggered()),
this, SLOT(saveIsawPeaks_slot()) );
QObject::connect( m_uiForm.actionLoad_Isaw_UB, SIGNAL(triggered()),
this, SLOT(loadIsawUB_slot()) );

QObject::connect( m_uiForm.actionLoad_Isaw_Peaks, SIGNAL(triggered()),
this, SLOT(loadIsawPeaks_slot()) );
QObject::connect( m_uiForm.actionSave_Isaw_Peaks, SIGNAL(triggered()),
this, SLOT(saveIsawPeaks_slot()) );

QObject::connect( m_uiForm.actionShow_UB, SIGNAL(triggered()),
this, SLOT(showUB_slot()) );
QObject::connect( m_uiForm.actionLoad_Isaw_Peaks, SIGNAL(triggered()),
this, SLOT(loadIsawPeaks_slot()) );

QObject::connect( m_uiForm.actionShow_UB, SIGNAL(triggered()),
this, SLOT(showUB_slot()) );

// connect the slots for enabling and disabling
// various subsets of widgets
Expand Down Expand Up @@ -298,72 +298,121 @@ void MantidEV::initLayout()
QObject::connect( m_uiForm.SpecifySize_ckbx, SIGNAL(clicked(bool)),
this, SLOT( setEnabledEllipseSizeOptions_slot() ) );

// set up defaults for the UI, and set the
// various groups of widgets to be enabled or
// disabled as needed
m_uiForm.MantidEV_tabwidg->setCurrentIndex(0);
// Add validators to all QLineEdit objects that require numeric values
m_uiForm.MaxABC_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxABC_ledt));
m_uiForm.NumToFind_ledt->setValidator( new QDoubleValidator(m_uiForm.NumToFind_ledt));
m_uiForm.MinIntensity_ledt->setValidator( new QDoubleValidator(m_uiForm.MinIntensity_ledt));
m_uiForm.MinIntensity_ledt->setValidator( new QDoubleValidator(m_uiForm.MinIntensity_ledt));
m_uiForm.MinD_ledt->setValidator( new QDoubleValidator(m_uiForm.MinD_ledt));
m_uiForm.MaxD_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxD_ledt));
m_uiForm.FFTTolerance_ledt->setValidator( new QDoubleValidator(m_uiForm.FFTTolerance_ledt));
m_uiForm.MaxGoniometerChange_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxGoniometerChange_ledt));
m_uiForm.IndexingTolerance_ledt->setValidator( new QDoubleValidator(m_uiForm.IndexingTolerance_ledt));
m_uiForm.MaxScalarError_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxScalarError_ledt));
m_uiForm.PeakRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.PeakRadius_ledt));
m_uiForm.BackgroundInnerRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundInnerRadius_ledt));
m_uiForm.BackgroundOuterRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundOuterRadius_ledt));
m_uiForm.NBadEdgePixels_ledt->setValidator( new QDoubleValidator(m_uiForm.NBadEdgePixels_ledt));
m_uiForm.RegionRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.RegionRadius_ledt));
m_uiForm.PeakSize_ledt->setValidator( new QDoubleValidator(m_uiForm.PeakSize_ledt));
m_uiForm.BackgroundInnerSize_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundInnerSize_ledt));
m_uiForm.BackgroundOuterSize_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundOuterSize_ledt));
m_uiForm.Qx_ledt->setValidator( new QDoubleValidator(m_uiForm.Qx_ledt));
m_uiForm.Qy_ledt->setValidator( new QDoubleValidator(m_uiForm.Qy_ledt));
m_uiForm.Qz_ledt->setValidator( new QDoubleValidator(m_uiForm.Qz_ledt));

setDefaultState_slot(); // call method to set all controls to default state

loadSettings(""); // reload any previously saved user settings
}

/**
* Set up default values for the input controls, and set groups of
* widgets to be enabled or disabled as needed.
*/
void MantidEV::setDefaultState_slot()
{
m_uiForm.MantidEV_tabwidg->setCurrentIndex(0);
// Select Data tab
m_uiForm.SelectEventWorkspace_ledt->setText("");
m_uiForm.MDworkspace_ledt->setText("");
m_uiForm.LoadEventFile_rbtn->setChecked(true);
m_uiForm.EventFileName_ledt->setText("");
m_uiForm.UseExistingWorkspaces_rbtn->setChecked(false);
setEnabledLoadEventFileParams_slot(true);

last_event_file.clear();
// Find Peaks tab
m_uiForm.PeaksWorkspace_ledt->setText("");
m_uiForm.FindPeaks_rbtn->setChecked(true);
m_uiForm.MaxABC_ledt->setText("15");
m_uiForm.NumToFind_ledt->setText("50");
m_uiForm.MinIntensity_ledt->setText("100");
m_uiForm.UseExistingPeaksWorkspace_rbtn->setChecked(false);
m_uiForm.LoadIsawPeaks_rbtn->setChecked(false);
m_uiForm.SelectPeaksFile_ledt->setText("");
setEnabledFindPeaksParams_slot(true);
setEnabledLoadPeaksParams_slot(false);

last_peaks_file.clear();
// Find UB tab
m_uiForm.FindUBUsingFFT_rbtn->setChecked(true);
m_uiForm.MinD_ledt->setText("3");
m_uiForm.MaxD_ledt->setText("15");
m_uiForm.FFTTolerance_ledt->setText("0.12");
m_uiForm.FindUBUsingIndexedPeaks_rbtn->setChecked(false);
m_uiForm.LoadISAWUB_rbtn->setChecked(false);
m_uiForm.SelectUBFile_ledt->setText("");
m_uiForm.OptimizeGoniometerAngles_ckbx->setChecked(false);
m_uiForm.MaxGoniometerChange_ledt->setText("5");
m_uiForm.UseCurrentUB_rbtn->setChecked(false);
m_uiForm.IndexPeaks_ckbx->setChecked(true);
m_uiForm.IndexingTolerance_ledt->setText("0.12");
m_uiForm.RoundHKLs_ckbx->setChecked( true );
setEnabledFindUBFFTParams_slot(true);
setEnabledLoadUBParams_slot(false);
setEnabledMaxOptimizeDegrees_slot();
m_uiForm.IndexPeaks_ckbx->setChecked(true);
m_uiForm.RoundHKLs_ckbx->setChecked( true );
setEnabledIndexParams_slot(true);

last_UB_file.clear();
// Choose Cell tab
m_uiForm.ShowPossibleCells_rbtn->setChecked(true);
m_uiForm.MaxScalarError_ledt->setText("0.2");
m_uiForm.BestCellOnly_ckbx->setChecked(true);
m_uiForm.SelectCellOfType_rbtn->setChecked(false);
m_uiForm.CellType_cmbx->setCurrentIndex(0);
m_uiForm.CellCentering_cmbx->setCurrentIndex(0);
m_uiForm.SelectCellWithForm_rbtn->setChecked(false);
m_uiForm.CellFormNumber_cmbx->setCurrentIndex(0);
setEnabledShowCellsParams_slot(true);
setEnabledSetCellTypeParams_slot(false);
setEnabledSetCellFormParams_slot(false);

// Change HKL tab
m_uiForm.HKL_tran_row_1_ledt->setText("1, 0, 0");
m_uiForm.HKL_tran_row_2_ledt->setText("0, 1, 0");
m_uiForm.HKL_tran_row_3_ledt->setText("0, 0, 1");
// Integrate tab
m_uiForm.SphereIntegration_rbtn->setChecked(true);
m_uiForm.PeakRadius_ledt->setText("0.18");
m_uiForm.BackgroundInnerRadius_ledt->setText("0.18");
m_uiForm.BackgroundOuterRadius_ledt->setText("0.23");
m_uiForm.IntegrateEdge_ckbx->setChecked(true);
m_uiForm.TwoDFitIntegration_rbtn->setChecked(false);
m_uiForm.FitRebinParams_ledt->setText("1000,-0.004,16000");
m_uiForm.NBadEdgePixels_ledt->setText("5");
m_uiForm.IkedaCarpenter_ckbx->setChecked(false);
m_uiForm.EllipsoidIntegration_rbtn->setChecked(false);
m_uiForm.RegionRadius_ledt->setText("0.25");
m_uiForm.SpecifySize_ckbx->setChecked(false);
m_uiForm.PeakSize_ledt->setText("0.18");
m_uiForm.BackgroundInnerSize_ledt->setText("0.18");
m_uiForm.BackgroundOuterSize_ledt->setText("0.23");
setEnabledSphereIntParams_slot(true);
setEnabledFitIntParams_slot(false);
setEnabledEllipseIntParams_slot(false);
m_uiForm.SpecifySize_ckbx->setChecked(false);
setEnabledEllipseSizeOptions_slot();

// Add validators to all QLineEdit objects that require numeric values
m_uiForm.MaxABC_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxABC_ledt));
m_uiForm.NumToFind_ledt->setValidator( new QDoubleValidator(m_uiForm.NumToFind_ledt));
m_uiForm.MinIntensity_ledt->setValidator( new QDoubleValidator(m_uiForm.MinIntensity_ledt));
m_uiForm.MinIntensity_ledt->setValidator( new QDoubleValidator(m_uiForm.MinIntensity_ledt));
m_uiForm.MinD_ledt->setValidator( new QDoubleValidator(m_uiForm.MinD_ledt));
m_uiForm.MaxD_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxD_ledt));
m_uiForm.FFTTolerance_ledt->setValidator( new QDoubleValidator(m_uiForm.FFTTolerance_ledt));
m_uiForm.MaxGoniometerChange_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxGoniometerChange_ledt));
m_uiForm.IndexingTolerance_ledt->setValidator( new QDoubleValidator(m_uiForm.IndexingTolerance_ledt));
m_uiForm.MaxScalarError_ledt->setValidator( new QDoubleValidator(m_uiForm.MaxScalarError_ledt));
m_uiForm.PeakRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.PeakRadius_ledt));
m_uiForm.BackgroundInnerRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundInnerRadius_ledt));
m_uiForm.BackgroundOuterRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundOuterRadius_ledt));
m_uiForm.NBadEdgePixels_ledt->setValidator( new QDoubleValidator(m_uiForm.NBadEdgePixels_ledt));
m_uiForm.RegionRadius_ledt->setValidator( new QDoubleValidator(m_uiForm.RegionRadius_ledt));
m_uiForm.PeakSize_ledt->setValidator( new QDoubleValidator(m_uiForm.PeakSize_ledt));
m_uiForm.BackgroundInnerSize_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundInnerSize_ledt));
m_uiForm.BackgroundOuterSize_ledt->setValidator( new QDoubleValidator(m_uiForm.BackgroundOuterSize_ledt));
m_uiForm.Qx_ledt->setValidator( new QDoubleValidator(m_uiForm.Qx_ledt));
m_uiForm.Qy_ledt->setValidator( new QDoubleValidator(m_uiForm.Qy_ledt));
m_uiForm.Qz_ledt->setValidator( new QDoubleValidator(m_uiForm.Qz_ledt));
loadSettings("");
// Point Info tab
m_uiForm.Qx_ledt->setText("");
m_uiForm.Qy_ledt->setText("");
m_uiForm.Qz_ledt->setText("");
m_uiForm.SelectedPoint_tbl->clear();
}


Expand Down Expand Up @@ -954,19 +1003,14 @@ void MantidEV::integratePeaks_slot()
*/
void MantidEV::showInfo_slot()
{
std::cout << "Show Info button pressed" << std::endl;
double qx = 0.0;
double qy = 0.0;
double qz = 0.0;
getDouble( m_uiForm.Qx_ledt, qx );
getDouble( m_uiForm.Qy_ledt, qy );
getDouble( m_uiForm.Qz_ledt, qz );
// std::cout << "Qx = " << qx << std::endl;
// std::cout << "Qy = " << qy << std::endl;
// std::cout << "Qz = " << qz << std::endl;

Mantid::Kernel::V3D q_point( qx, qy, qz );
// showInfo( q_point );

boost::shared_ptr<std::vector<double>> q_vec(new std::vector<double>());
q_vec->push_back( qx );
Expand All @@ -979,24 +1023,12 @@ void MantidEV::showInfo_slot()

void MantidEV::handleQpointNotification1(const Poco::AutoPtr<SelectionNotificationServiceImpl::AfterReplaceNotification> & message )
{

// std::string name = message->object_name();
// std::cout << "Name is " << name << std::endl;
// std::cout << message->object()->at(0) << std::endl;
// std::cout << message->object()->at(1) << std::endl;
// std::cout << message->object()->at(2) << std::endl;
Mantid::Kernel::V3D q_point( message->object()->at(0), message->object()->at(1), message->object()->at(2) );
showInfo( q_point );
}

void MantidEV::handleQpointNotification(const Poco::AutoPtr<SelectionNotificationServiceImpl::AddNotification> & message )
{

// std::string name = message->object_name();
// std::cout << "Name is " << name << std::endl;
// std::cout << message->object()->at(0) << std::endl;
// std::cout << message->object()->at(1) << std::endl;
// std::cout << message->object()->at(2) << std::endl;
Mantid::Kernel::V3D q_point( message->object()->at(0), message->object()->at(1), message->object()->at(2) );
showInfo( q_point );
}
Expand All @@ -1018,9 +1050,6 @@ void MantidEV::showInfo( Mantid::Kernel::V3D q_point )

std::vector< std::pair< std::string, std::string > > info = worker->PointInfo( peaks_ws_name, q_point );

for ( size_t i = 0; i < info.size(); i++ )
std::cout << info[i].first << " " << info[i].second << std::endl;

m_uiForm.SelectedPoint_tbl->setRowCount((int)info.size());
m_uiForm.SelectedPoint_tbl->setColumnCount(2);
m_uiForm.SelectedPoint_tbl->verticalHeader()->hide();
Expand Down

0 comments on commit 4fcf217

Please sign in to comment.