On Monday, January 02, 2012 07:16:24 AM Nate Lowrie wrote:
> On 1/1/2012 9:00 PM, Ed Leafe wrote:
> > On Jan 1, 2012, at 7:22 PM, OKB (not okblacke) wrote:
> >>            What you mention about passing information before the form
> >>            instance
> >> 
> >> is created, though, makes me wonder a bit about the bigger picture.  I
> >> suppose it's true that I want to pass information before the instance
> >> is
> >> created, but that's only because Dabo hides the instance creation
> >> inside
> >> its own innards.  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.
> >> 
> >     Like I said above, I don't believe that anyone has ever suggested this
> >     approach to customization before. The only thing even close would be
> >     forms that read some sort of .ini file or similar when they are
> >     created, but that doesn't seem to be what you're doing. You want to
> >     be able to create the app with parameters and have the form receive
> >     them. Maybe we could add a MainFormParameters property to dApp that
> >     would take a dict of params, and these would be passed to the
> >     MainFormClass when it is instantiated as its kwargs.
> >     
> >     Paul, I'm hoping that you'll chime in here with any thoughts on this
> >     approach.
> I know I have been doing this on my dialog forms for years to
> automatically pass in the bizobj.  I just override the init method.
> Probably not the best solution, but it works for me.
> 
> There are some other ways to approach this. You could make the panel
> list a property on the form and set it outside of the init method.  This
> would require an extra line but decouples things a bit and is more
> flexible.  If I am not mistaken, you can also not pass it into the
> constructor and the property setting logic will properly pick it up.
> 
> The last way to do this is to use a plugin manager like Yapsy to manage
> the panel set for you.  Your form would look for the plugin manager on
> instantiation and find all of the panels and add them to the form.  I am
> actually moving this way for most all my applications and am almost
> there.  The nice part about this is you can now have a standard
> application template and you just add panel plugins.  Makes everything
> very convenient.  However, fair warning, this will be a good bit more
> work to get up an running than the other methods.
> 
> Regards,
> 
> Nate

I normally just setup some properties for dialogs - In Nate's case Larry and I 
came up with the following to pass the main form:

class NewPayment(dabo.ui.dDialog):
    def _getMainForm(self):
        return getattr(self, "_MainForm", None)
    def _setMainForm(self, val):
        self._MainForm = val
    MainForm = property(_getMainForm, _setMainForm)

The you can all the dialog 
newDialog = NewPayment(MainForm = self)
newDialog.ShowModal()

Johnf



_______________________________________________
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/5100272.0q3Dc8MxBx@linux-12

Reply via email to