On Jan 1, 2012, at 6:07 PM, OKB (not okblacke) wrote:

>       How can I add information to tweak this?  I'd like to be able to do 
> something like:
> 
> app = dabo.dApp(MainFormClass=MyForm, projectName="Some project", 
> datafile="some file", etc="and so on")
> 
>       I could of course just add data to MyForm by doing
> 
> MyForm.projectName = "Some project"
> MyForm.datafile = "some file"
> MyForm.etc = "and so on"
> 
>       . . . before starting the app, but that seems rather hackish to me.  
> What is the right way in Dabo to specify "extra" information that is 
> needed when starting an app or instantiating a control?

        The difficulty here is that you want to pass information to the form 
before the form instance is created. Perhaps you could create a classmethod in 
your form class that would accept these additional parameters, and store them 
in class attributes. Then they could be retrieved and acted upon in the 
__init__() of the form. Something like:

(in the form class)

@classmethod
def storeSetupValues(cls, projectName=None, dataFile=None, ...):
        cls.projectName = projectName
        cls.datafile = dataFile
        ...

def __init__(self, ...):
        super(MyFormClass, self).__init__(...)
        self.doExtraSetup()

def doExtraSetup(self):
        self.readDataFile(self.datafile)
        ...


-- Ed Leafe



_______________________________________________
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/48216293-e00e-45f9-9697-8d9baa940...@leafe.com

Reply via email to