Re: [Boa Constr] boa app runtime config problem
Status: Beta
Brought to you by:
riaan
From: Hans-Peter J. <hp...@ur...> - 2002-02-25 21:39:48
|
On Monday, 25. February 2002 18:29, Riaan Booysen wrote: > 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) Fine with me. One starting with boa cannot read it enough times ;-) > 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. Cool. I'm eagerly awaiting cvs updated:) Please give us a note... > 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() Yup. That's what I'm doing now and it's working well. In fact, I've delayed screen layouting into OnIdle for some unknown reason. This caused the screen funnies... > > 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 Well, yes. You're right. I begin to understand, what constraints boa have to handle behind the scenes. One of the most annoying habbits of boa (under wxGTK) are focus related (I believe). After working on some menu/toolbar attributs, I have to close it, and select some other widget before posting, otherwise boa crashes (the patch for the menu bug is applied). If you need a more detailed investigation, I can make a gdb bt for you, but I tend to believe, it wont help much, does it? Cheers, Hans-Peter |