Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
8a327189
Commit
8a327189
authored
Jan 22, 2021
by
Samuel Jones
Browse files
Re #30308 Deal with the second memory leak
parent
9ec37bd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
qt/python/mantidqt/widgets/sliceviewer/presenter.py
View file @
8a327189
...
...
@@ -69,6 +69,8 @@ class SliceViewer(ObservingPresenter):
self
.
ads_observer
=
SliceViewerADSObserver
(
self
.
replace_workspace
,
self
.
rename_workspace
,
self
.
ADS_cleared
,
self
.
delete_workspace
)
self
.
view
.
destroyed
.
connect
(
self
.
_on_view_destroyed
)
def
new_plot_MDH
(
self
):
"""
Tell the view to display a new plot of an MDHistoWorkspace
...
...
@@ -449,3 +451,6 @@ class SliceViewer(ObservingPresenter):
def
_close_view_with_message
(
self
,
message
:
str
):
self
.
view
.
emit_close
()
# inherited from ObservingView
self
.
_logger
.
warning
(
message
)
def
_on_view_destroyed
(
self
):
self
.
clear_observer
()
qt/python/mantidqt/widgets/sliceviewer/test/test_sliceviewer_view.py
View file @
8a327189
...
...
@@ -30,26 +30,32 @@ from math import inf # noqa: E402
@
start_qapplication
class
SliceViewerViewTest
(
unittest
.
TestCase
,
QtWidgetFinder
):
@
classmethod
def
setUpClass
(
cls
):
cls
.
histo_ws
=
CreateMDHistoWorkspace
(
Dimensionality
=
3
,
Extents
=
'-3,3,-10,10,-1,1'
,
SignalInput
=
range
(
100
),
ErrorInput
=
range
(
100
),
NumberOfBins
=
'5,5,4'
,
Names
=
'Dim1,Dim2,Dim3'
,
Units
=
'MomentumTransfer,EnergyTransfer,Angstrom'
,
OutputWorkspace
=
'ws_MD_2d'
)
cls
.
hkl_ws
=
CreateMDWorkspace
(
Dimensions
=
3
,
Extents
=
'-10,10,-10,10,-10,10'
,
Names
=
'A,B,C'
,
Units
=
'r.l.u.,r.l.u.,r.l.u.'
,
Frames
=
'HKL,HKL,HKL'
,
OutputWorkspace
=
'hkl_ws'
)
def
setUp
(
self
):
self
.
histo_ws
=
CreateMDHistoWorkspace
(
Dimensionality
=
3
,
Extents
=
'-3,3,-10,10,-1,1'
,
SignalInput
=
range
(
100
),
ErrorInput
=
range
(
100
),
NumberOfBins
=
'5,5,4'
,
Names
=
'Dim1,Dim2,Dim3'
,
Units
=
'MomentumTransfer,EnergyTransfer,Angstrom'
,
OutputWorkspace
=
'ws_MD_2d'
)
self
.
hkl_ws
=
CreateMDWorkspace
(
Dimensions
=
3
,
Extents
=
'-10,10,-10,10,-10,10'
,
Names
=
'A,B,C'
,
Units
=
'r.l.u.,r.l.u.,r.l.u.'
,
Frames
=
'HKL,HKL,HKL'
,
OutputWorkspace
=
'hkl_ws'
)
expt_info
=
CreateSampleWorkspace
()
cls
.
hkl_ws
.
addExperimentInfo
(
expt_info
)
self
.
hkl_ws
.
addExperimentInfo
(
expt_info
)
SetUB
(
'hkl_ws'
,
1
,
1
,
1
,
90
,
90
,
90
)
def
tearDown
(
self
):
for
ii
in
QApplication
.
topLevelWidgets
():
ii
.
close
()
QApplication
.
sendPostedEvents
()
QApplication
.
sendPostedEvents
()
self
.
assert_no_toplevel_widgets
()
def
test_deleted_on_close
(
self
):
pres
=
SliceViewer
(
self
.
histo_ws
)
self
.
assert_widget_created
()
...
...
@@ -244,7 +250,7 @@ class SliceViewerViewTest(unittest.TestCase, QtWidgetFinder):
self
.
assert_widget_created
()
pres
.
clear_observer
=
mock
.
MagicMock
()
pres
.
view
.
close
Event
(
QCloseEvent
()
)
pres
.
view
.
close
(
)
pres
.
clear_observer
.
assert_called_once
()
...
...
qt/python/mantidqt/widgets/sliceviewer/view.py
View file @
8a327189
...
...
@@ -526,7 +526,7 @@ class SliceViewerDataView(QWidget):
self
.
conf
.
set
(
POWERSCALE
,
exponent
)
class
SliceViewerView
(
ObservingView
,
QWidget
):
class
SliceViewerView
(
QWidget
,
ObservingView
):
"""Combines the data view for the slice viewer with the optional peaks viewer."""
close_signal
=
Signal
()
rename_signal
=
Signal
(
str
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment