Re: [Boa Constr] Interface comments
Status: Beta
Brought to you by:
riaan
From: Bernhard R. <ber...@in...> - 2001-01-19 15:10:19
|
On Thu, Jan 18, 2001 at 04:57:28PM +0200, Riaan Booysen wrote: > Hi Bernard, you keep on asking the tricky question don't you ;) Well .. not on purpose. I just tried to work with Boa and get a project done. :) And while being in the position of a newcomer to boa I try to get my feedback out so you have the opinion of someone who has a fresh new angle on things. > Bernhard Reiter wrote: > > - How can I replace the main frame of an application and switch on > > autocreate for other frames? (This is probably something I just > > missed in the docs..) >=20 > In short, you must currently change the main frame by hand. Okay. > Autocreation has not been completely implemented. I've not yet decided > on the best strategy to implement it. >=20 > One way would be to create the frame in it's module scope.=20 > The singleton pattern.=20 =46rom your description I do not think this is a good idea. (BTW: I never really understood the singleton pattern, I still believe some C++ person invented it for shortcomings in the language and other though it was cool...) > It would be nice if all autocreated frames could be children of the > main frame (who would then destroy them when it closes) but alas, > because these objects are created at compile time (module scope) Hmmm. > Another way would have been to keep a global dict in the wxApp's=20 > module which keeps track of the autocreated frames.=20 > I do not want to use this pervertiom (perverted idiom) in EVERY app=20 > that Boa creates. > What would you think if you read the above mentioned code? >=20 > Any better ideas? My local python expert (Bernhard Herzog) tells me that you might be able to put in your own import hook with overwriting a function sys.__import__ or something. Then you could make sure that you=20 have code always done when a module is imported.=20 Just thinking about it for a couple of minutes, I fail to see why you are not creating the Frames in a function in the application module.=20 You of course need to have a list of modules you import. Then you can ask them via methods, if the application shall create a frame instance. import frame try: if frame.autocreate(): frameobj=3Dframe.new() expect x: pass > > - I have been adding my own control and somehow Boa did not > > recognize what I have been done and editing this frame in the > > designer lead to code being deleted by Boa. There should be guidline > > on how to add own elements to boa so that the frame designer can > > handle it. >=20 > Was it a control not supported by Boa? Yes. Filebrowsebutton, Dirbrowsebutton and such. > Someone else also recently ran into this, the guideline is: > Do not modify _init_* methods, Boa parses and regenerates these > methods. Any code in these methods that do not comply exactly with > the format that Boa expects will be lost. Boa should put out a warning if I am motifying this code, it does not understand or prohibit me to actually change it there. > What you should have done was to create your control in the __init__ > method underneath _init_ctrls(). >=20 > As promised before, this will be added to the documentation. Bernhard --=20 Professional Service around Free Software (intevation.net) = =20 The FreeGIS Project (freegis.org) Association for a Free Informational Infrastructure (ffii.org) FSF Europe (www.fsfeurope.org) |