Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 159 additions & 67 deletions src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/sas/qtgui/Perspectives/Invariant/InvariantUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
"W_BACKGROUND",
"W_SCALE",
"W_CONTRAST",
"W_CONTRAST_ERR",
"W_POROD_CST",
"W_POROD_CST_ERR",
"W_VOLFRAC1",
"W_VOLFRAC1_ERR",
"W_VOLFRAC2",
"W_ENABLE_CONTRAST",
"W_ENABLE_VOLFRAC",
Expand Down
145 changes: 83 additions & 62 deletions src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>650</width>
<height>580</height>
<height>600</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -19,7 +19,7 @@
<property name="minimumSize">
<size>
<width>650</width>
<height>580</height>
<height>600</height>
</size>
</property>
<property name="windowTitle">
Expand All @@ -31,7 +31,7 @@
<x>10</x>
<y>10</y>
<width>631</width>
<height>521</height>
<height>551</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -47,7 +47,7 @@
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabMain">
<attribute name="title">
Expand Down Expand Up @@ -151,100 +151,103 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblBackground">
<property name="text">
<string>Background:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QLineEdit" name="txtBackgd"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblBackgroundUnits">
<item>
<widget class="QLabel" name="lblScale">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;cm&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Scale:</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLineEdit" name="txtContrast"/>
</item>
<item row="0" column="3">
<widget class="QLabel" name="lblContrast">
<property name="text">
<string>Contrast:</string>
</property>
</widget>
<item>
<widget class="QLineEdit" name="txtScale"/>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="txtVolFrac2"/>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_10">
<item row="2" column="1">
<widget class="QLineEdit" name="txtVolFrac1"/>
</item>
<item row="1" column="3">
<widget class="QLabel" name="lblVF1">
<item row="1" column="2">
<widget class="QLabel" name="lblPM_5">
<property name="text">
<string>Volume Fraction 1:</string>
<string>+/-</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLineEdit" name="txtVolFrac1"/>
<item row="1" column="1">
<widget class="QLineEdit" name="txtContrast"/>
</item>
<item row="0" column="5">
<item row="1" column="4">
<widget class="QLabel" name="lblContrastUnits">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtScale"/>
</item>
<item row="2" column="3">
<widget class="QLabel" name="lblVF2">
<widget class="QLineEdit" name="txtVolFrac1Err"/>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblPM_7">
<property name="text">
<string>Volume Fraction 2:</string>
<string>+/-</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblScale">
<item row="1" column="3">
<widget class="QLineEdit" name="txtContrastErr"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lblPM_6">
<property name="text">
<string>Scale:</string>
<string>+/-</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="0" column="3">
<widget class="QLineEdit" name="txtPorodCstErr"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblPorodCst">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Porod constant:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lblPorodCstUnits">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;(cm Å&lt;span style=&quot; vertical-align:super;&quot;&gt;4&lt;/span&gt;)&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="0" column="1">
<widget class="QLineEdit" name="txtPorodCst">
<property name="toolTip">
<string>Porod constant (optional)</string>
</property>
</widget>
</item>
<item row="0" column="6">
<item row="0" column="4">
<widget class="QLabel" name="lblPorodCstUnits">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;(cm Å&lt;span style=&quot; vertical-align:super;&quot;&gt;4&lt;/span&gt;)&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbContrast">
<property name="text">
<string>Use Contrast</string>
<string>Contrast:</string>
</property>
</widget>
</item>
<item row="1" column="6" rowspan="2">
<item row="2" column="0">
<widget class="QRadioButton" name="rbVolFrac">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
Expand All @@ -253,8 +256,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Use Volume
Fraction</string>
<string>Volume Fraction:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -346,7 +348,7 @@
<item row="3" column="4">
<widget class="QLabel" name="lblSpecificSurfaceUnits">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -513,6 +515,13 @@
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="lblContrastUnits_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -606,7 +615,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="labelUnits_2">
<widget class="QLabel" name="lblGuinierEndUnits">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Å&lt;span style=&quot; vertical-align:super;&quot;&gt;-1&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
Expand Down Expand Up @@ -709,7 +718,7 @@
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="labelUnits">
<widget class="QLabel" name="lblPorodStartUnits">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -771,7 +780,7 @@
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="labelUnits_3">
<widget class="QLabel" name="lblPorodEndUnits">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -863,8 +872,8 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>531</y>
<x>10</x>
<y>560</y>
<width>611</width>
<height>31</height>
</rect>
Expand Down Expand Up @@ -924,12 +933,24 @@
<tabstop>txtName</tabstop>
<tabstop>txtTotalQMin</tabstop>
<tabstop>txtTotalQMax</tabstop>
<tabstop>txtVolFract</tabstop>
<tabstop>txtVolFractErr</tabstop>
<tabstop>txtSpecSurf</tabstop>
<tabstop>txtSpecSurfErr</tabstop>
<tabstop>txtInvariantTot</tabstop>
<tabstop>txtInvariantTotErr</tabstop>
<tabstop>txtBackgd</tabstop>
<tabstop>txtScale</tabstop>
<tabstop>txtPorodCst</tabstop>
<tabstop>txtPorodCstErr</tabstop>
<tabstop>txtContrast</tabstop>
<tabstop>txtContrastErr</tabstop>
<tabstop>txtVolFrac1</tabstop>
<tabstop>txtVolFrac1Err</tabstop>
<tabstop>chkLowQ_ex</tabstop>
<tabstop>rbLowQGuinier_ex</tabstop>
<tabstop>rbLowQPower_ex</tabstop>
<tabstop>rbLowQFit_ex</tabstop>
<tabstop>rbLowQFix_ex</tabstop>
<tabstop>txtLowQPower_ex</tabstop>
<tabstop>chkHighQ_ex</tabstop>
<tabstop>rbHighQFit_ex</tabstop>
<tabstop>rbHighQFix_ex</tabstop>
<tabstop>txtHighQPower_ex</tabstop>
<tabstop>cmdCalculate</tabstop>
<tabstop>cmdStatus</tabstop>
<tabstop>cmdHelp</tabstop>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,34 @@ def checkFakeDataState(self, widget):
# unchecked checkboxes
assert not widget.chkLowQ.isChecked()
assert not widget.chkHighQ.isChecked()

def test_allow_calculation_requires_input(self, widget):
# Start with no data -> button disabled
widget._data = None
widget.allow_calculation()
assert not widget.cmdCalculate.isEnabled()

# Fake that we have data
widget._data = self.data

# Contrast mode: no contrast -> disabled
widget.rbContrast.setChecked(True)
widget.txtContrast.setText('')
widget.allow_calculation()
assert not widget.cmdCalculate.isEnabled()

# Contrast mode: valid contrast -> enabled
widget.txtContrast.setText('2.2e-6')
widget.allow_calculation()
assert widget.cmdCalculate.isEnabled()

# Volume fraction mode: no vol frac -> disabled
widget.rbVolFrac.setChecked(True)
widget.txtVolFrac1.setText('')
widget.allow_calculation()
assert not widget.cmdCalculate.isEnabled()

# Volume fraction mode: valid vol frac -> enabled
widget.txtVolFrac1.setText('0.01')
widget.allow_calculation()
assert widget.cmdCalculate.isEnabled()
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading