Re: [dabo-users] PyDeadObject from Modal Form

Author: Miguel Lopes

Posted: 2009-08-21 at 10:33:02

On Mon, Aug 3, 2009 at 6:02 PM, Paul McNett<p@ulmcnett.com> wrote:

>

> Does this patch fix it?

>

> {{{

> Index: dabo/ui/uiwx/dForm.py

> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

> --- dabo/ui/uiwx/dForm.py =A0 =A0 =A0 (revision 5305)

> +++ dabo/ui/uiwx/dForm.py =A0 =A0 =A0 (working copy)

> @@ -924,30 +924,30 @@

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# This is =

a normal SDI form:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0preClass =

=3D wx.PreFrame

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self._mdi =

=3D False

> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hackToFrame()

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dForm._hackToFrame()

>

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0## (Note that it is necessary to run the a=

bove blocks each time, because

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0## =A0we are modifying the dForm class def=

inition globally.)

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0BaseForm.__init__(self, preClass, parent, =

properties, attProperties,

> *args, **kwargs)

> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hackToFrame()

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dForm._hackToFrame()

>

>

> =A0 =A0 =A0 =A0def _hackToDialog(self):

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dForm.__bases__ =3D (BaseForm, wx.Dialog)

>

> - =A0 =A0 =A0 def _hackToFrame(self):

> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if self._mdi:

> + =A0 =A0 =A0 def _hackToFrame(cls):

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if dabo.settings.MDI:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dForm.__bases__ =3D (BaseF=

orm, wx.MDIChildFrame)

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dForm.__bases__ =3D (BaseF=

orm, wx.Frame)

> + =A0 =A0 =A0 _hackToFrame =3D classmethod(_hackToFrame)

>

> -

> =A0 =A0 =A0 =A0def Show(self, show=3DTrue, *args, **kwargs):

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self._gtk_show_fix(show)

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if self.Modal:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self._hackToDialog()

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dForm.__bases__[-1].Show(self, show, *args=

, **kwargs)

> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hackToFrame()

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dForm._hackToFrame()

>

> =A0 =A0 =A0 =A0def _getModal(self):

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return getattr(self, "_modal", False)

> @@ -961,7 +961,7 @@

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if val and self.Modal:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self._hack=

ToDialog()

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self.ShowM=

odal()

> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hackT=

oFrame()

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dForm._hack=

ToFrame()

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else:

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self.Show(=

val)

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else:

>

> }}}

>

>

> Paul

Working greate on both:

Python Version: 2.5.4 on darwin

Dabo Version: Version 0.9.2; Revision 5328M + Your Patch to dForm

UI Version: 2.8.9.2 on wxMac

And:

PythonVersion: 2.6.2 on win32

Dabo Version: Version 0.9.2; Revision ~5308 + Your Patch to dForm

UI Version: 2.8.10.1 on wxMSW

txs,

Miguel

©2009 Miguel Lopes