Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
66b1d7ca
Commit
66b1d7ca
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Sigh. wx.MenuItems really screw things up.
parent
605a9027
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/platform.py
+15
-16
15 additions, 16 deletions
fsl/utils/platform.py
with
15 additions
and
16 deletions
fsl/utils/platform.py
+
15
−
16
View file @
66b1d7ca
...
...
@@ -84,27 +84,26 @@ def isWidgetAlive(widget):
"""
Returns ``True`` if the given ``wx.Window`` object is
"
alive
"
(i.e.
has not been destroyed), ``False`` otherwise. Works in both wxPython
and wxPython/Phoenix.
.. warning:: Don
'
t try to test whether a ``wx.MenuItem`` has been
destroyed, as it will probably result in segmentation
faults. Check the parent ``wx.Menu`` instead.
"""
import
wx
if
platform
.
wxFlavour
==
WX_PHOENIX
:
return
bool
(
widget
)
elif
platform
.
wxFlavour
==
WX_PYTHON
:
try
:
# GetId seems to be available on all wx
# objects, despite not being documented.
#
# I was originally calling IsEnabled,
# but this causes segfaults if called
# on a wx.MenuItem from within an
# event handler on that menu item!
widget
.
GetId
()
return
True
except
wx
.
PyDeadObjectError
:
return
False
if
platform
.
wxFlavour
==
platform
.
WX_PHOENIX
:
excType
=
RuntimeError
elif
platform
.
wxFlavour
==
platform
.
WX_PYTHON
:
excType
=
wx
.
PyDeadObjectError
try
:
widget
.
GetParent
()
return
True
except
excType
:
return
False
class
Platform
(
notifier
.
Notifier
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment