File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,9 @@ def forget_ptr(ptr):
340
340
_detach_children (obj )
341
341
# TODO: does obj need to detach from its parent too?
342
342
343
+ def is_alive (obj ):
344
+ return bool (obj ._cpp_obj )
345
+
343
346
def take_ownership (obj ):
344
347
if obj is None :
345
348
return
Original file line number Diff line number Diff line change @@ -158,14 +158,14 @@ def run():
158
158
#endif
159
159
""" )
160
160
161
+ # TODO(amauryfa): platform-independent version?
161
162
c .addPyMethod ('__nonzero__' , '(self)' ,
162
163
doc = "Can be used to test if the C++ part of the window still exists, with \n "
163
164
"code like this::\n \n "
164
165
" if theWindow:\n "
165
166
" doSomething()" ,
166
167
body = """\
167
- import wx.siplib
168
- return not wx.siplib.isdeleted(self)
168
+ return wrapper_lib.is_alive(self)
169
169
""" )
170
170
c .addPyCode ('Window.__bool__ = Window.__nonzero__' ) # For Python 3
171
171
You can’t perform that action at this time.
0 commit comments