Re: [dabo-users] call dialog from button onHit

Author: Ed Leafe

Posted: 2009-08-08 at 13:20:34

On Aug 8, 2009, at 12:00 PM, jpoorrandp@aol.com wrote:

> In this example, we have "dlg = MyDialog(self)" which instantiates

> your

> MyDialog class as dlg. My question is how do I turn a dialog I've

> designed in

> the class designer into a class that I can refer to in this way?

The class is created dynamically from the cdxml; the way to do this is:

dlg = dabo.ui.createForm("mydialog.cdxml", self)

You call createForm with the path to the dialog file (it will find it

if you have it in the 'ui' folder and use the standard directory

structure), and include any parameters you need to pass after the file

name.

> I can't

> seem to save the dialog form as anything but "cdxml" -- (why not

> as python

> code?)

Because generated code is evil and hackish. It is also not re-

entrant: once you generate the code, you can no longer edit it with

the designer tool.

> -- I'm guessing there's a way to define the class using this cdxml

> file? Is there a tool that will convert cdxml to python?

Not permanently; it is much, much better to do this dynamically using

createForm()

-- Ed Leafe

©2009 Ed Leafe