[dabo-users] PyDeadObject from Modal Form

Author: Miguel Lopes

Posted: 2009-07-07 at 07:22:29

The bulk of my application is hand coded, and I'm planing to use cdxml dForm

(instantiated as Modal) to edit simple records.

I'm experimenting with such a form, but ran into a PyDeadObjectError

exception that I can figure out how to avoid. his exception is significant

since I can no longer reinstantiate the same form!

Here's my traceback:

Traceback (most recent call last):

File

"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/dabo/ui/uiwx/dControlMixin.py",

line 27, in _onWxHit

self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)

File

"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py",

line 949, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,

**kwargs)

File

"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/dabo/lib/eventMixin.py",

line 93, in raiseEvent

bindingFunction(event)

File

"/Users/miguelek/Documents/programming/daboprgs/HandCoding_02/ui/appModules/AccountPages.py",

line 160, in onEdit

frm.showForm(contactsForAccount, 'EditRec') #, parentPK, childPK

File "/var/folders/XN/XNKKbB+9EVeY1y0rXolJBE+++TI/-Tmp-/tmpLfCKRL.py",

line 247, in showForm

self.show()

File

"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py",

line 1282, in show

self.Visible = True

File

"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/dabo/ui/uiwx/dForm.py",

line 964, in _setVisible

self._hackToFrame()

File

"//usr/local/lib/wxPython-unicode-2.8.9.2/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/_core.py",

line 14524, in __getattr__

raise PyDeadObjectError(self.attrStr % self._name)

wx._core.PyDeadObjectError: The C++ part of the dForm_43298 object has been

deleted, attribute access no longer allowed.

The "form" (dialog) class is created from the cdxml file in the normal way.

Since I pass a bizobj to the dialog with the record to edit, I have my own

method to show the form:

# This method lives in the dialog

def showForm(self, contactsBizobj, usage):

# set the forms Bizobj - this makes the form reusable for different

origins

# of contacts (e.g. Children of account, children of opportunity, ...)

self.VCRactive = True

self.addBizobj(contactsBizobj)

self.requery()

if usage == 'NewRec':

self.new()

self.show()

#to close the form I just use close:

## *!* ## Dabo Code ID: dButton-dPanel-956

def onHit(self, evt):

self.Form.close()

I suppose this is either a wxPython or a Dabo bug, since I'm not doing

anything special here.

Platform: Mac

Python Version: 2.5.4 on darwin

Dabo Version: Version 0.9.2; Revision 5254M

UI Version: 2.8.9.2 on wxMac

Best Miguel

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

©2009 Miguel Lopes