Skip to content

Commit

Permalink
Use double spinner for energy crop
Browse files Browse the repository at this point in the history
Refs #10391
  • Loading branch information
DanNixon committed Oct 29, 2014
1 parent 3bb2cce commit 3fdd313
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
Expand Up @@ -75,7 +75,7 @@ def PyInit(self):
doc='Resolution workspace')

self.declareProperty(name='MaxEnergy', defaultValue='',
doc='Crop the result spectra at a given energy')
doc='Crop the result spectra at a given energy (leave blank for no crop)')

self.declareProperty(name='Plot', defaultValue='None',
validator=StringListValidator(['None', 'Spectra', 'Contour', 'Both']),
Expand All @@ -97,7 +97,7 @@ def validateInputs(self):
sample_filename = self.getPropertyValue('Filename')
function_list = self.getProperty('Functions').value
res_ws = self.getPropertyValue('Resolution')
emax = self.getPropertyValue('MaxEnergy')
emax = self.getProperty('MaxEnergy')

if len(function_list) == 0 and os.path.splitext(sample_filename)[1] == 'cdl':
issues['Functions'] = 'Must specify at least one function when loading a CDL file'
Expand Down
Expand Up @@ -104,19 +104,21 @@
</spacer>
</item>
<item>
<widget class="QLineEdit" name="leMaxEnergy">
<widget class="QDoubleSpinBox" name="dspMaxEnergy">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Crop the upper energy range of any workspaces with energy as the X unit (e.g. Sqw).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Crop the upper energy range of any workspaces with energy as the X unit (e.g. S(Q,w)).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>0</string>
<property name="suffix">
<string> meV</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblEnergyCropUnits">
<property name="text">
<string>meV</string>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -308,7 +310,7 @@
<tabstop>mwRun</tabstop>
<tabstop>leFunctionNames</tabstop>
<tabstop>ckCropEnergy</tabstop>
<tabstop>leMaxEnergy</tabstop>
<tabstop>dspMaxEnergy</tabstop>
<tabstop>ckResolution</tabstop>
<tabstop>dsResolution</tabstop>
<tabstop>ckVerbose</tabstop>
Expand Down
12 changes: 2 additions & 10 deletions Code/Mantid/MantidQt/CustomInterfaces/src/IndirectMolDyn.cpp
Expand Up @@ -17,7 +17,7 @@ namespace MantidQt
m_uiForm.setupUi(parent);

connect(m_uiForm.ckResolution, SIGNAL(toggled(bool)), m_uiForm.dsResolution, SLOT(setEnabled(bool)));
connect(m_uiForm.ckCropEnergy, SIGNAL(toggled(bool)), m_uiForm.leMaxEnergy, SLOT(setEnabled(bool)));
connect(m_uiForm.ckCropEnergy, SIGNAL(toggled(bool)), m_uiForm.dspMaxEnergy, SLOT(setEnabled(bool)));
}

/**
Expand Down Expand Up @@ -50,14 +50,6 @@ namespace MantidQt
return false;
}

bool energyIsNumber = false;
m_uiForm.leMaxEnergy->text().toDouble(&energyIsNumber);
if(m_uiForm.ckCropEnergy->isChecked() && !energyIsNumber)
{
emit showMessageBox("Max energy must be a number.");
return false;
}

return true;
}

Expand All @@ -82,7 +74,7 @@ namespace MantidQt

// Set energy crop option
if(m_uiForm.ckCropEnergy->isChecked())
molDynAlg->setProperty("MaxEnergy", m_uiForm.leMaxEnergy->text().toStdString());
molDynAlg->setProperty("MaxEnergy", QString::number(m_uiForm.dspMaxEnergy->value()).toStdString());

// Set instrument resolution option
if(m_uiForm.ckResolution->isChecked())
Expand Down

0 comments on commit 3fdd313

Please sign in to comment.