Re: [dabo-users] Pass parameters to main form

Author: Paul McNett

Posted: 2012-01-02 at 00:10:16

On 1/1/12 6:00 PM, Ed Leafe wrote:

> It doesn't much matter to me whether I pass my

>> information when I create the app instance, or when I specify the app's

>> main form, or when I do app.start(). But, as far as I can tell, at none

>> of those three places is there a way to pass information in. Is there

>> some other place to do it? What would it mean to pass it in after the

>> instance is created? It seems like that would mean passing it in once

>> the GUI app is already up and running, but that defeats the purpose of

>> passing it in order to influence initialization.

How about:

class MyApp(dabo.dApp):

def _getStartupPanels(self):

return getattr(self, "_startupPanels", [])

def _setStartupPanels(self, val):

self._startupPanels = []

StartupPanels = property(_getStartupPanels, _setStartupPanels)

class MyMainForm(dabo.ui.dFormMain):

def afterInit(self):

for P in self.Application.StartupPanels:

p = P(self)

self.Sizer.append(p)

...and in your startup code:

import dabo

dabo.ui.loadUI("wx")

class Panel1(dabo.ui.dPanel):

...

class Panel2(dabo.ui.dPanel):

...

startupPanels = [Panel1, Panel2]

app = MyApp(MainFormClass=MyMainForm, StartupPanels=startupPanels)

app.start()

I haven't tested this but it should work, theoretically.

Paul

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4F013C38.7090509@ulmcnett.com

©2012 Paul McNett