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
63b11afb
Commit
63b11afb
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Function to check if a widget has been destroyed, works under wxPy and wxPho.
parent
27e1ff81
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
+28
-0
28 additions, 0 deletions
fsl/utils/platform.py
with
28 additions
and
0 deletions
fsl/utils/platform.py
+
28
−
0
View file @
63b11afb
...
...
@@ -8,6 +8,14 @@
of information about the current platform we are running on. A single
``Platform`` instance is created when this module is first imported, and
is available as a module attribute called :attr:`platform`.
This module is also home to the following utility functions which abstract
away various platform differences:
.. autosummary::
:nosignatures:
isWidgetAlive
"""
...
...
@@ -71,6 +79,25 @@ are running the Linux/GTK wx build.
"""
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.
"""
import
wx
if
platform
.
wxFlavour
==
WX_PHOENIX
:
return
bool
(
widget
)
elif
platform
.
wxFlavour
==
WX_PYTHON
:
try
:
widget
.
IsEnabled
()
return
True
except
wx
.
PyDeadObjectError
:
return
False
class
Platform
(
notifier
.
Notifier
):
"""
The ``Platform`` class contains a handful of properties which contain
information about the platform we are running on.
...
...
@@ -107,6 +134,7 @@ class Platform(notifier.Notifier):
self
.
WX_MAC_COCOA
=
WX_MAC_COCOA
self
.
WX_MAC_CARBON
=
WX_MAC_CARBON
self
.
WX_GTK
=
WX_GTK
self
.
isWidgetAlive
=
isWidgetAlive
self
.
__fsldir
=
os
.
environ
.
get
(
'
FSLDIR
'
,
None
)
self
.
__inSSHSession
=
False
...
...
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