Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run unit tests of Qt GUI and have CI gate on them #2252

Merged
merged 187 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
cf4c1a3
Ignore spurious out-of-range signals for main progress bar
llimeht Sep 21, 2022
0e3c708
Only use integer pixel values for layout
llimeht Sep 21, 2022
974fd4c
Only use integer progress bar values
llimeht Sep 21, 2022
198123b
Add some missing deps to CI
llimeht Sep 25, 2022
05febd5
Enable pytest to run GUI tests
llimeht Sep 25, 2022
66fda52
Drop old GUITests.py in favour of pytest
llimeht Sep 25, 2022
a939c16
Change tests to asserts in AboutBoxTest.py
llimeht Sep 30, 2022
16210b2
Change to pytest fixtures AboutBoxTest.py
llimeht Sep 30, 2022
958b82e
xfail tests in DataExplorerTest.py
llimeht Sep 30, 2022
282aa0b
Change tests to asserts in DataExplorerTest.py
llimeht Sep 30, 2022
0c1fd78
Change to pytest fixtures DataExplorerTest.py
llimeht Sep 30, 2022
d9d8798
xfail tests in GenericScatteringCalculatorTest
llimeht Sep 28, 2022
8ca24f4
Change tests to asserts in GenericScatteringCalculatorTest.py
llimeht Sep 28, 2022
70cf2df
xfail tests in SLDCalculatorTest.py
llimeht Sep 28, 2022
c5e9693
Change tests to asserts in SLDCalculatorTest.py
llimeht Sep 28, 2022
cac13ed
xfail tests in SlitSizeCalculatorTest.py
llimeht Sep 28, 2022
55cafe3
Change tests to asserts in SlitSizeCalculatorTest.py
llimeht Sep 28, 2022
894759a
xfail tests in DataOperationUtilityTest.py
llimeht Sep 28, 2022
9bd981f
Change tests to asserts in DataOperationUtilityTest.py
llimeht Sep 28, 2022
d88159c
Change tests to asserts in DensityCalculatorTest.py
llimeht Sep 28, 2022
95a901a
Change tests to asserts in KiessigCalculatorTest.py
llimeht Sep 28, 2022
42460e8
Force mpl backend to qtagg so tests can pass
llimeht Sep 28, 2022
2e3a118
Change tests to asserts in ResolutionCalculatorPanelTest.py
llimeht Sep 28, 2022
db5fcef
Change tests to asserts in ComplexConstraintTest.py
llimeht Sep 29, 2022
6a6df16
Change to pytest fixtures ComplexConstraintTest.py
llimeht Sep 29, 2022
8666199
xfail tests in ConstraintWidgetTest.py
llimeht Sep 29, 2022
f800097
Change tests to asserts in ConstraintWidgetTest.py
llimeht Sep 29, 2022
683529a
Change to pytest fixtures ConstraintWidgetTest.py
llimeht Sep 29, 2022
ba1406e
xfail tests in FittingWidgetTest.py
llimeht Sep 29, 2022
73053b8
Change tests to asserts in FittingWidgetTest.py
llimeht Sep 29, 2022
0ef9d7c
Change to pytest fixtures FittingWidgetTest.py
llimeht Sep 29, 2022
3144f71
Change tests to asserts in FitPageTest.py
llimeht Sep 29, 2022
7133c64
Change to pytest fixtures FitPageTest.py
llimeht Sep 29, 2022
f003e09
Change tests to asserts in FittingLogicTest.py
llimeht Sep 29, 2022
ec097db
Change to pytest fixtures FittingLogicTest.py
llimeht Sep 29, 2022
ba47782
skip/fix tests in FittingOptionsTest.py
llimeht Sep 29, 2022
eacbb3a
Change tests to asserts in FittingOptionsTest.py
llimeht Sep 29, 2022
ee64174
Change to pytest fixtures FittingOptionsTest.py
llimeht Sep 29, 2022
0793577
Change tests to asserts in FittingUtilitiesTest.py
llimeht Sep 29, 2022
51a0077
Change to pytest fixtures FittingUtilitiesTest.py
llimeht Sep 29, 2022
6584e0f
Change tests to asserts in MultiConstraintTest.py
llimeht Sep 29, 2022
82b7d27
Change to pytest fixtures MultiConstraintTest.py
llimeht Sep 29, 2022
e81f1eb
Change tests to asserts in FittingPerspectiveTest.py
llimeht Sep 29, 2022
b9acac8
Change to pytest fixtures FittingPerspectiveTest.py
llimeht Sep 29, 2022
87fa210
xfail tests in CorfuncTest.py
llimeht Sep 29, 2022
baadbdb
Change tests to asserts in CorfuncTest.py
llimeht Sep 29, 2022
e55b547
Change to pytest fixtures CorfuncTest.py
llimeht Sep 29, 2022
6edf2bc
Change tests to asserts in InvariantDetailsTest.py
llimeht Sep 29, 2022
7839da2
Change to pytest fixtures InvariantDetailsTest.py
llimeht Sep 29, 2022
f960cb0
Fix unittest in InvariantPerspectiveTest.py
llimeht Sep 29, 2022
89ab872
Change tests to asserts in InvariantPerspectiveTest.py
llimeht Sep 29, 2022
2e9b9f0
Change to pytest fixtures InvariantPerspectiveTest.py
llimeht Sep 29, 2022
1e4ab1c
xfail/skip tests in InversionPerspectiveTest.py
llimeht Sep 29, 2022
4b39a83
Change tests to asserts in InversionPerspectiveTest.py
llimeht Sep 29, 2022
3fb49d4
Change to pytest fixtures InversionPerspectiveTest.py
llimeht Sep 29, 2022
7ec9107
Change tests to asserts in TestUtilsTest.py
llimeht Sep 29, 2022
23a4347
Change to pytest fixtures TestUtilsTest.py
llimeht Sep 29, 2022
c15c3e5
Change tests to asserts in DroppableDataLoadWidgetTest.py
llimeht Sep 29, 2022
1bbb5a9
Change to pytest fixtures DroppableDataLoadWidgetTest.py
llimeht Sep 29, 2022
b08a02e
xfail tests in GuiManagerTest.py
llimeht Sep 29, 2022
6a72d6a
Change tests to asserts in GuiManagerTest.py
llimeht Sep 29, 2022
d48ac29
Change to pytest fixtures GuiManagerTest.py
llimeht Sep 29, 2022
c56a5e5
xfail tests in MainWindowTest.py
llimeht Sep 29, 2022
7ee93b3
Change tests to asserts in MainWindowTest.py
llimeht Sep 29, 2022
d191f48
Change to pytest fixtures MainWindowTest.py
llimeht Sep 29, 2022
f08c778
Fix tests in WelcomePanelTest.py
llimeht Sep 29, 2022
0833669
Change tests to asserts in WelcomePanelTest.py
llimeht Sep 29, 2022
4cf5175
Change to pytest fixtures WelcomePanelTest.py
llimeht Sep 29, 2022
37e1883
fix/skip tests in AddMultEditorTest.py
llimeht Sep 29, 2022
a08e440
Change to pytest fixtures AddMultEditorTest.py
llimeht Sep 29, 2022
eaca275
xfail tests in FileConverterTest.py
llimeht Sep 29, 2022
0f3652a
Change tests to asserts in FileConverterTest.py
llimeht Sep 29, 2022
313d48e
Change to pytest fixtures FileConverterTest.py
llimeht Sep 29, 2022
8626c88
xfail tests in GridPanelTest.py
llimeht Sep 29, 2022
fd9ad0f
Change tests to asserts in GridPanelTest.py
llimeht Sep 29, 2022
59e7a04
Change to pytest fixtures GridPanelTest.py
llimeht Sep 29, 2022
711962f
xfail tests in GuiUtilsTest.py
llimeht Sep 29, 2022
03bd240
Change tests to asserts in GuiUtilsTest.py
llimeht Sep 29, 2022
a483c02
Change to pytest fixtures GuiUtilsTest.py
llimeht Sep 29, 2022
e213d74
Change to pytest fixtures ModelEditorTest.py
llimeht Sep 29, 2022
c3842cd
Change tests to asserts in PluginDefinitionTest.py
llimeht Sep 29, 2022
8bdda4f
Change to pytest fixtures PluginDefinitionTest.py
llimeht Sep 29, 2022
3110240
xfail tests in ReportDialogTest.py
llimeht Sep 29, 2022
a0308dc
Change tests to asserts in ReportDialogTest.py
llimeht Sep 29, 2022
bd499bd
Change to pytest fixtures ReportDialogTest.py
llimeht Sep 29, 2022
4060568
Change tests to asserts in SasviewLoggerTest.py
llimeht Sep 29, 2022
56b0cde
Change to pytest fixtures SasviewLoggerTest.py
llimeht Sep 29, 2022
2047979
xfail tests in TabbedModelEditorTest.py
llimeht Sep 29, 2022
222f3ff
Change tests to asserts in TabbedModelEditorTest.py
llimeht Sep 29, 2022
45702a9
Change to pytest fixtures TabbedModelEditorTest.py
llimeht Sep 29, 2022
c1ec7b3
xfail tests in AddTextTest.py
llimeht Sep 30, 2022
804b09a
Change tests to asserts in AddTextTest.py
llimeht Sep 30, 2022
49604ce
Change to pytest fixtures AddTextTest.py
llimeht Sep 30, 2022
f8c39f9
Change tests to asserts in BoxSumTest.py
llimeht Sep 30, 2022
dc8c7bc
Change to pytest fixtures BoxSumTest.py
llimeht Sep 30, 2022
47de0a6
xfail/skip tests in ColorMapTest.py
llimeht Sep 30, 2022
b627263
Change tests to asserts in ColorMapTest.py
llimeht Sep 30, 2022
f4c348c
Change to pytest fixtures ColorMapTest.py
llimeht Sep 30, 2022
23c3232
xfail/fix tests in LinearFitTest.py
llimeht Sep 30, 2022
f647d03
Change tests to asserts in LinearFitTest.py
llimeht Sep 30, 2022
fbde2f5
Change to pytest fixtures LinearFitTest.py
llimeht Sep 30, 2022
56e20f9
Change tests to asserts in PlotHelperTest.py
llimeht Sep 30, 2022
78a3089
Change to pytest fixtures PlotHelperTest.py
llimeht Sep 30, 2022
a9e0107
Change tests to asserts in PlotPropertiesTest.py
llimeht Sep 30, 2022
14f93f4
Change to pytest fixtures PlotPropertiesTest.py
llimeht Sep 30, 2022
66c8710
Change tests to asserts in PlotUtilitiesTest.py
llimeht Sep 30, 2022
8de725e
Change to pytest fixtures PlotUtilitiesTest.py
llimeht Sep 30, 2022
b841ee6
xfail/skip tests in Plotter2DTest.py
llimeht Sep 30, 2022
f2af141
Change tests to asserts in Plotter2DTest.py
llimeht Sep 30, 2022
72872b9
Change to pytest fixtures Plotter2DTest.py
llimeht Sep 30, 2022
9cd0e11
Change tests to asserts in PlotterBaseTest.py
llimeht Sep 30, 2022
6aed413
Change to pytest fixtures PlotterBaseTest.py
llimeht Sep 30, 2022
d740a48
Change tests to asserts in PlotterTest.py
llimeht Sep 30, 2022
c86fd90
Change to pytest fixtures PlotterTest.py
llimeht Sep 30, 2022
c2d3dbc
Change tests to asserts in QRangeSliderTests.py
llimeht Sep 30, 2022
dc8b6d6
Change to pytest fixtures QRangeSliderTests.py
llimeht Sep 30, 2022
71dd068
Change tests to asserts in ScalePropertiesTest.py
llimeht Sep 30, 2022
8ce62b9
Change to pytest fixtures ScalePropertiesTest.py
llimeht Sep 30, 2022
cbaf94a
Change tests to asserts in SetGraphRangeTest.py
llimeht Sep 30, 2022
c9f4d63
Change to pytest fixtures SetGraphRangeTest.py
llimeht Sep 30, 2022
00b6289
Change tests to asserts in SlicerModelTest.py
llimeht Sep 30, 2022
d20a036
Change to pytest fixtures SlicerModelTest.py
llimeht Sep 30, 2022
61f0dda
Change tests to asserts in SlicerParametersTest.py
llimeht Sep 30, 2022
dec1fb8
Change to pytest fixtures SlicerParametersTest.py
llimeht Sep 30, 2022
2c4c24c
Change tests to asserts in WindowTitleTest.py
llimeht Sep 30, 2022
d75bda5
Change to pytest fixtures WindowTitleTest.py
llimeht Sep 30, 2022
dd83b8d
Fix tests for DensityCalculatorTest.py
llimeht Sep 28, 2022
1a2bdba
Test model and view are synced in DensityPanel
llimeht Sep 28, 2022
a7d3afb
Fix tests for ComplexConstraintTest, ConstraintWidgetTest
llimeht Sep 29, 2022
a9f9bde
Fix tests for DataOperationUtilityPanel.py
llimeht Sep 29, 2022
f5d0ba1
Fix test for ReportDialog.py
llimeht Sep 29, 2022
4da761d
Fix tests in GenericScatteringCalculatorTest.py vs DataExplorerTest.py
llimeht Sep 30, 2022
35d995e
Fix tests in FittingOptionsTest.py FittingPerspectiveTest.py
llimeht Sep 30, 2022
88b350c
Fixup FittingOptionsTest.py FittingPerspectiveTest.py
llimeht Oct 15, 2022
2f9aeba
Ensure categories.json exists before tests
llimeht Oct 15, 2022
5d163c9
Silence warning about non-int progress bar signals
llimeht Sep 29, 2022
066ebe7
Add pytest_qt to CI
llimeht Sep 25, 2022
76f7e69
Enable testing of GUI on CI
llimeht Sep 25, 2022
ce6b74a
Fix invalid escape sequences
llimeht Oct 12, 2022
0e7b58c
mpl Axes3D updates for figures
llimeht Oct 13, 2022
f511287
Make mocking temporary in tests
llimeht Oct 13, 2022
82a473b
Allow plots to be disposed of sooner
llimeht Oct 13, 2022
0fc6e94
Fix crashes from InversionPerspectiveTest
llimeht Oct 14, 2022
b285ded
Skip additional failing test in GuiManagerTest.py
llimeht Oct 14, 2022
e26bcbf
Fix re warnings
llimeht Oct 14, 2022
af62bfd
Fix numpy comparison warning
llimeht Oct 14, 2022
ace821c
Fix logger.warn warnings
llimeht Oct 14, 2022
f878971
Fix GUITest mocking to be reversible
llimeht Oct 14, 2022
75fa656
Drop unneeded imports
llimeht Oct 14, 2022
6cfb4ad
Skip failing tests in LinearFitTest.py
llimeht Oct 14, 2022
8352437
Drop unneeded imports from ScalePropertiesTest.py
llimeht Oct 14, 2022
1f8a60d
Fix AboutBoxTest.py for new config/web objects
llimeht Oct 15, 2022
dd5c712
Revert incorrect 'urls' to 'web' changes in DroppableDataLoadWidget.py
llimeht Oct 15, 2022
b463140
Fix failing test in GuiManagerTest.py
llimeht Oct 15, 2022
3c1b0a3
Fixes for config refactoring
llimeht Oct 15, 2022
a69bffe
Xfail test for toolbars
llimeht Oct 15, 2022
f80cbe4
Fix test for change in panel text
llimeht Oct 15, 2022
2c9978f
Suppress SIGSEGV errors from pytest
llimeht Oct 15, 2022
58fcdd6
Remove uneeded path_prepare.py
llimeht Oct 24, 2022
56265c8
Add pytest-mock to requirements
llimeht Oct 24, 2022
b64b194
Update commented tests in AboutBoxTest.py
llimeht Oct 25, 2022
78f9099
Update commented tests in DataExplorerTest.py
llimeht Oct 25, 2022
173c68b
Update commented tests in DroppableDataLoadWidgetTest.py
llimeht Oct 25, 2022
3e27a48
Update commented tests in GuiManagerTest.py
llimeht Oct 25, 2022
9cfb96e
Update commented tests in CorfuncTest.py
llimeht Oct 25, 2022
c77220f
Update commented tests in FittingOptionsTest.py
llimeht Oct 25, 2022
c902db9
Update commented tests in FittingWidgetTest.py
llimeht Oct 25, 2022
1e020c9
Update commented tests in LinearFitTest.py
llimeht Oct 25, 2022
bf3b0a4
Update commented tests in PlotHelperTest.py
llimeht Oct 25, 2022
e1df061
Update commented tests in PlotterBaseTest.py
llimeht Oct 25, 2022
228deda
Update commented tests in PlotterTest.py
llimeht Oct 25, 2022
bdaf0d2
Update commented tests in AddMultEditorTest.py
llimeht Oct 25, 2022
69a0172
Update commented tests in GuiUtilsTest.py
llimeht Oct 25, 2022
f689a06
Update commented tests in ReportDialogTest.py
llimeht Oct 25, 2022
5513a26
Update commented tests in TabbedModelEditorTest.py
llimeht Oct 25, 2022
27ae756
Switch numerical comparisons to pytest.approx in GenericScatteringCal…
llimeht Oct 25, 2022
7a1f307
Switch numerical comparisons to pytest.approx in SLDCalculatorTest.py
llimeht Oct 25, 2022
37f8059
Switch numerical comparisons to pytest.approx in SlitSizeCalculatorTe…
llimeht Oct 25, 2022
929a027
Switch numerical comparisons to pytest.approx in FittingLogicTest.py
llimeht Oct 25, 2022
e0a8acb
Switch numerical comparisons to pytest.approx in FittingUtilitiesTest.py
llimeht Oct 25, 2022
0b2ff51
Switch numerical comparisons to pytest.approx in FittingWidgetTest.py
llimeht Oct 25, 2022
ce019d5
Switch numerical comparisons to pytest.approx in InvariantPerspective…
llimeht Oct 25, 2022
867db63
Switch numerical comparisons to pytest.approx in LinearFitTest.py
llimeht Oct 25, 2022
953620a
Switch numerical comparisons to pytest.approx in Plotter2DTest.py
llimeht Oct 25, 2022
5b540aa
Switch numerical comparisons to pytest.approx in QRangeSliderTests.py
llimeht Oct 25, 2022
b469de0
Switch numerical comparisons to pytest.approx in FileConverterTest.py
llimeht Oct 25, 2022
1dcd599
Switch numerical comparisons to pytest.approx in GuiUtilsTest.py
llimeht Oct 25, 2022
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
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools
python -m pip install numpy scipy matplotlib docutils "pytest<6" sphinx unittest-xml-reporting tinycc lxml h5py sphinx pyparsing html5lib reportlab pybind11 appdirs six numba mako ipython qtconsole xhtml2pdf unittest-xml-reporting pylint qt5reactor periodictable PyQt5 html2text importlib_resources
python -m pip install numpy scipy matplotlib docutils pytest pytest_qt pytest-mock sphinx unittest-xml-reporting tinycc lxml h5py sphinx pyparsing html5lib reportlab pybind11 appdirs six numba mako ipython qtconsole xhtml2pdf unittest-xml-reporting pylint qt5reactor periodictable PyQt5 html2text importlib_resources uncertainties dominate html2text

- name: Install pyopencl (Linux + macOS)
if: ${{ matrix.os != 'windows-latest' }}
Expand Down Expand Up @@ -124,5 +124,8 @@ jobs:
env:
PYOPENCL_COMPILER_OUTPUT: 1
run: |
cd src/sas/qtgui
xvfb-run -a --server-args="-screen 0 1024x768x24" python GUITests.py || true
# Suppress SIGSEGV from the tests until they can be fixed
retval=0
xvfb-run -a --server-args="-screen 0 1024x768x24" python -m pytest -rsx -v src/sas/qtgui/ || retval=$?
if [ $retval -eq 139 ]; then echo "WARNING: Python interpreter exited with Segmentation Fault. This normally indicates that Qt objects were not correctly deleted. This error is currently suppressed in SasView's test suite."; retval=0; fi
exit $retval
4 changes: 3 additions & 1 deletion build_tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
numpy
scipy==1.7.3
docutils
pytest<6
pytest
pytest_qt
pyteset-mock
unittest-xml-reporting
tinycc
h5py
Expand Down
10 changes: 6 additions & 4 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
norecursedirs=test/sasrealspace test/calculatorview
addopts=--ignore test/utest_sasview.py
python_files='u*py'
[pytest]
norecursedirs=test/sasrealspace test/calculatorview UnitTesting/SquishTestSuites
addopts=--ignore test/utest_sasview.py
python_files='u*py' '*Test*py'
python_classes = *Test Test*
qt_api=pyqt5
8 changes: 5 additions & 3 deletions src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def updateCombobox(self, filenames):

else:
# filenames without titles by removing time.time()
new_title = re.sub('\d{10}\.\d{2}', '', str(key_id))
new_title = re.sub(r'\d{10}\.\d{2}', '', str(key_id))
self.list_data_items.append(new_title)
list_datafiles.append(new_title)

Expand Down Expand Up @@ -154,6 +154,8 @@ def onCompute(self):
# Add the new plot to the comboboxes
self.cbData1.addItem(self.output.name)
self.cbData2.addItem(self.output.name)
if self.filenames is None:
self.filenames = {}
self.filenames[self.output.name] = self.output

def onPrepareOutputData(self):
Expand Down Expand Up @@ -367,10 +369,10 @@ def _findId(self, name):
def _extractData(self, key_id):
""" Extract data from file with id contained in list of filenames """
data_complete = self.filenames[key_id]
dimension = data_complete.__class__.__name__
dimension = data_complete.data.__class__.__name__

if dimension in ('Data1D', 'Data2D'):
return copy.deepcopy(data_complete)
return copy.deepcopy(data_complete.data)

else:
logging.error('Error with data format')
Expand Down
4 changes: 4 additions & 0 deletions src/sas/qtgui/Calculators/DensityPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def volumeChanged(self, current_text):
molarDensity = molarMass / molarVolume
molarDensity = formatNumber(molarDensity, high=True)
self.model.item(MODEL.MASS_DENSITY).setText(str(molarDensity))
# be sure to store the new value in the model
self.model.item(MODEL.MOLAR_VOLUME).setText(current_text)

except (ArithmeticError, ValueError):
self.model.item(MODEL.MASS_DENSITY).setText("")
Expand All @@ -139,6 +141,8 @@ def massChanged(self, current_text):
molarVolume = molarMass / molarDensity
molarVolume = formatNumber(molarVolume, high=True)
self.model.item(MODEL.MOLAR_VOLUME).setText(str(molarVolume))
# be sure to store the new value in the model
self.model.item(MODEL.MASS_DENSITY).setText(current_text)

except (ArithmeticError, ValueError):
self.model.item(MODEL.MOLAR_VOLUME).setText("")
Expand Down
32 changes: 18 additions & 14 deletions src/sas/qtgui/Calculators/GenericScatteringCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(self, parent=None):

# validators
# scale, volume and background must be positive
validat_regex_pos = QtCore.QRegExp('^[+]?([.]\d+|\d+([.]\d+)?)$')
validat_regex_pos = QtCore.QRegExp(r'^[+]?([.]\d+|\d+([.]\d+)?)$')
self.txtScale.setValidator(QtGui.QRegExpValidator(validat_regex_pos,
self.txtScale))
self.txtBackground.setValidator(QtGui.QRegExpValidator(
Expand All @@ -166,14 +166,14 @@ def __init__(self, parent=None):
validat_regex_pos, self.txtTotalVolume))

# fraction of spin up between 0 and 1
validat_regexbetween0_1 = QtCore.QRegExp('^(0(\.\d*)*|1(\.0+)?)$')
validat_regexbetween0_1 = QtCore.QRegExp(r'^(0(\.\d*)*|1(\.0+)?)$')
self.txtUpFracIn.setValidator(
QtGui.QRegExpValidator(validat_regexbetween0_1, self.txtUpFracIn))
self.txtUpFracOut.setValidator(
QtGui.QRegExpValidator(validat_regexbetween0_1, self.txtUpFracOut))

# angles, SLD must be float values
validat_regex_float = QtCore.QRegExp('^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?$')
validat_regex_float = QtCore.QRegExp(r'^[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?$')
self.txtUpTheta.setValidator(
QtGui.QRegExpValidator(validat_regex_float, self.txtUpTheta))
self.txtUpPhi.setValidator(
Expand Down Expand Up @@ -212,12 +212,12 @@ def __init__(self, parent=None):
QtGui.QRegExpValidator(validat_regex_float, self.txtSampleRoll))

# 0 < Qmax <= 1000
validat_regex_q = QtCore.QRegExp('^1000$|^[+]?(\d{1,3}([.]\d+)?)$')
validat_regex_q = QtCore.QRegExp(r'^1000$|^[+]?(\d{1,3}([.]\d+)?)$')
self.txtQxMax.setValidator(QtGui.QRegExpValidator(validat_regex_q,
self.txtQxMax))

# 2 <= Qbin and nodes integers < 1000
validat_regex_int = QtCore.QRegExp('^[2-9]|[1-9]\d{1,2}$')
validat_regex_int = QtCore.QRegExp(r'^[2-9]|[1-9]\d{1,2}$')
self.txtNoQBins.setValidator(QtGui.QRegExpValidator(validat_regex_int,
self.txtNoQBins))

Expand Down Expand Up @@ -264,11 +264,14 @@ def setup_display(self):
self.view_elev = 45
self.mouse_down = False
sampleWindow = FigureCanvas(Figure())
axes_sample = Axes3D(sampleWindow.figure, azim=self.view_azim, elev=self.view_elev)
axes_sample = Axes3D(sampleWindow.figure, azim=self.view_azim, elev=self.view_elev, auto_add_to_figure=False)
sampleWindow.figure.add_axes(axes_sample)
envWindow = FigureCanvas(Figure())
axes_env = Axes3D(envWindow.figure, azim=self.view_azim, elev=self.view_elev)
axes_env = Axes3D(envWindow.figure, azim=self.view_azim, elev=self.view_elev, auto_add_to_figure=False)
envWindow.figure.add_axes(axes_env)
beamWindow = FigureCanvas(Figure())
axes_beam = Axes3D(beamWindow.figure, azim=self.view_azim, elev=self.view_elev)
axes_beam = Axes3D(beamWindow.figure, azim=self.view_azim, elev=self.view_elev, auto_add_to_figure=False)
beamWindow.figure.add_axes(axes_beam)
self.coord_windows = [sampleWindow, envWindow, beamWindow]
self.coord_axes = [axes_sample, axes_env, axes_beam]
self.coord_arrows = []
Expand Down Expand Up @@ -1428,8 +1431,8 @@ def plot_1_2d(self):
data = Data1D(x=self.data.x, y=self.data_to_plot)
data.title = "GenSAS {} #{} 1D".format(self.file_name(),
int(self.graph_num))
data.xaxis('\\rm{Q_{x}}', '\AA^{-1}')
data.yaxis('\\rm{Intensity}', 'cm^{-1}')
data.xaxis(r'\rm{Q_{x}}', r'\AA^{-1}')
data.yaxis(r'\rm{Intensity}', 'cm^{-1}')

self.graph_num += 1
else:
Expand Down Expand Up @@ -1518,10 +1521,11 @@ def showPlot(self, data, has_arrow=False):

self.figure.clear()
self.figure.subplots_adjust(left=0.1, right=.8, bottom=.1)
ax = Axes3D(self.figure)
ax.set_xlabel('x ($\A{}$)'.format(data.pos_unit))
ax.set_ylabel('z ($\A{}$)'.format(data.pos_unit))
ax.set_zlabel('y ($\A{}$)'.format(data.pos_unit))
ax = Axes3D(self.figure, auto_add_to_figure=False)
self.figure.add_axes(ax)
ax.set_xlabel(r'x ($\A{}$)'.format(data.pos_unit))
ax.set_ylabel(r'z ($\A{}$)'.format(data.pos_unit))
ax.set_zlabel(r'y ($\A{}$)'.format(data.pos_unit))

# I. Plot null points
if is_zero.any():
Expand Down
Loading