Paul McNett wrote:
> 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)
Coming back to this after a few weeks, during which I tried various
solutions. . .
The solution you provide above is fine as far as it goes, but that
seems like an awful lot of boilerplate to me just to pass a parameter
into my app. I would also have to do the same for each individual
parameter I want to pass.
I realized that the info I want to pass in doesn't necessarily have
to be on the form class. In particular, I'm fine with it being handled
by the dApp instance. There doesn't seem to be any way to pass
parameters in at App creation time either, though. So what I did was
subclass dApp and override __init__ so it accepts additional arguments.
I get the sense from postings on this list that overriding __init__ on
Dabo classes is a bit dicey, though (hence the existence of afterInit
and such methods).
This seems to meet my needs for now, although I'd be interested to
hear if this is thought to be the wrong way to do it.
--
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is
no path, and leave a trail."
--author unknown
_______________________________________________
Post Messages to: [email protected]
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/[email protected]