Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
27f24d1a
Commit
27f24d1a
authored
Apr 27, 2014
by
Luke Campagnola
Browse files
Expand ref cycle check to include all child QObjects
parent
0479507d
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyqtgraph/tests/test_ref_cycles.py
View file @
27f24d1a
...
...
@@ -11,8 +11,27 @@ def assert_alldead(refs):
for
ref
in
refs
:
assert
ref
()
is
None
def
qObjectTree
(
root
):
"""Return root and its entire tree of qobject children"""
childs
=
[
root
]
for
ch
in
pg
.
QtCore
.
QObject
.
children
(
root
):
childs
+=
qObjectTree
(
ch
)
return
childs
def
mkrefs
(
*
objs
):
return
map
(
weakref
.
ref
,
objs
)
"""Return a list of weakrefs to each object in *objs.
QObject instances are expanded to include all child objects.
"""
allObjs
=
{}
for
obj
in
objs
:
if
isinstance
(
obj
,
pg
.
QtCore
.
QObject
):
obj
=
qObjectTree
(
obj
)
else
:
obj
=
[
obj
]
for
o
in
obj
:
allObjs
[
id
(
o
)]
=
o
return
map
(
weakref
.
ref
,
allObjs
.
values
())
def
test_PlotWidget
():
def
mkobjs
(
*
args
,
**
kwds
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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