Re: [Boa Constr] boa app runtime config problem
Status: Beta
Brought to you by:
riaan
From: Riaan B. <riaan@e.co.za> - 2002-02-25 17:16:00
|
Hi Hans-Peter, (You may ignore this little lecture, as I wrote it before I found the bug in Boa. I'm not going to delete it as someone might still learn something from it. You are using special frame attributes correctly except for the one warning printed along with the error, see below) The important thing to understand with "frame attributes" it that there are two behaviours, design-time and run-time: For design-time, you have to assign a "simple values" like ints or strings. Run-time values can be any Python expression evaluating to a simple type. The first time the attribute is assigned will be used at design-time, the last time it's assigned will be used at run-time. You are getting a printed message > 00:53:13: config.Config() > 00:53:13: name 'config' is not defined because the line: > self.cfg = config.Config() is being read as a design-time special frame attribute. You have 2 choices; either use a local variable between __init__ and self._init_ctrls: e.g. cfg = config.Config() and then after self._init_ctrls self.cfg = cfg or you can define a design-time None value: self.cfg = None self.cfg = config.Config() You are getting the KeyError : MainSplit because of a bug in Boa. Behind the scenes there is a difference between normal property values and properties which link up to other controls by name. Linking properties (like SplitHorizontally) currently do not handle special frame attributes, I'll fix this as soon as possible. Hans-Peter Jansen wrote: > No matter how I instanciate my config class, I get this key error. > Any ideas? Bug in boa as explained above, as a workaround, leave the 3rd argument to SplitHorizontally a simple integer and manually call self.mainSplitter.SetSashPosition(self.MainSplit) after self._init_ctrls() > > Also, I would like to pass my config instance to my subclasses in the > constructor. The docs say, this is a nono, because it's neither a > simple nor a wxPython type. I'm assuming you are talking about the custom classes feature. Correct. You can't, sorry. Not because of what the type the value is, but because then the constructor's signature would be different from the wxPython base class, which is the nono. > > I workaround this with a Config method in the subclass, but again: > Parameter, which modify appearance have to be handled manually and > disturb screen appearance on start up (gets drawn with design time > values, but modified quickly thereafter) Yes that is a drawback. Can't you wait and only show the frame after everything has been initialised properly? > > Any help on this topic is greatly appreciated. > > Cheers, > Hans-Peter > > _______________________________________________ > Boa-constructor-users mailing list > Boa...@li... > https://lists.sourceforge.net/lists/listinfo/boa-constructor-users -- Riaan Booysen ___________________________________________________ Boa Constructor - RAD GUI building IDE for wxPython http://boa-constructor.sourceforge.net |