Re: [Boa Constr] New version in CVS
Status: Beta
Brought to you by:
riaan
From: Riaan B. <riaan@e.co.za> - 2002-08-11 17:12:38
|
Hi Christian, Christian Tismer wrote: > > Riaan Booysen wrote: > > Hello everyone, > > > > I've just finished with the check in. > > As far as I could see, there a lots of improvements! > Many thanks for this new version!!! Sure! > I also saw how newobjects are added to the palette, > although it is hard for me to find out how exactly > the interface works. > > Coupla questions. > Is there some document? For the next release I've started work on some documents, but they are incomplete and currently only give an overview. I think I will add some of this reply to them :) The best document for me in such circumstances has always been examples and of that Boa has plenty. Spesifically see bcrtl/user/*.py and Plug-ins/UserCompanions.plug-in.py. > How is, for instance the property interface working: Any Get/Set > pair defines a property? Basically yes. e.g. wxTextCtrl.GetValue() wxTextCtrl.SetValue(val) So a Property named 'Value' will be picked up automatically. It's getter is called and the type is inspected. Simple types like ints, string, etc are handled automatically. When a property is a reference to an object (for which the getter could possibly return None) or some other type which cannot be determined by introspection alone, you must add property definitions (self.editors) to the associated companion class. Property values can be 'routed' in many ways. CtrlRoute: Get and Set maps directly to component Get and Set. This type is automatically picked up by inspection. CompnRoute: Get and Set maps to Companion Get and Set. Used when you need to fully customise a property. Used when the Get and Set methods of the control do not map to Get*, Set*, e.g. Show() and IsShown(). Used when new (possibly computed) properties are needed for which there are no methods on the component. EventRoute: Used by Event definitions. IndexRoute: Used by collection editor properties. Get and Set maps to Companion Get and Set with index. NameRoute: Used when a property is split up into a set of flags. Get and Set maps to Companion Get and Set with name. For property names which are not picked up by inspection the 'properties' method can be overridden. Here you extend the property dictionary. Format: ProperyName: (RouteType, Getter, Setter) There is also support for enumerated types, dependant properties, linked properties, non persisting, multi parameter and completely custom properties which overrides everything down to code generation (e.g. Anchors/Constraints). The class BaseCompanions.WindowDTC uses many property editors and is a good example to look at. > Where is design-time vs. run-time behavior defined, what do I > need to support to make my own controls behave in the IDE? Such properties would use 'CompnRoute' and would would be completely managed by the companion class. The destinction is usually even clearer than in Delphi, Robin writes the run-time (wxPython classes), I write the design-time (Companion classes). > > Ok, having read some more, I'd like to correct some controls. > One of them is the slider which I use. > It has wrong tick handling, it does *not* respond to > scrollevents, and when labels are selected, it becomes > almost impossible to position the control in the IDE, since > it jumps to the left. :-) I don't understand. The control moving and sizing behaves properly for me. Note the Designer always tries to take over the mouse clicks of a control for consistent selection and movement. So you can't slide the slider in the IDE, set it's Value property. I have found a problem with the 'TickFreq' property. It does not sound like like the problem you are describing. Btw this problem is an instance where the property had the right methods (GetTickFreq and SetTickFreq) and the getter returned a value (integer), but the Setter is non-standard, it takes 2 parameters instead of one. (on inspection only the Getter is tested for obvious reasons) As even the Docs don't know what the second parameter is for and because this property applies only to windows I think I should hide it from the design-time interface. This can be done by overriding the 'hideDesignTime' method. > How would I correct that? Would I change Companions.py accordingly > and supply a patch? Yes, if there is a problem with the component, I would like it fixed. If you want to change some generic component/mouse interaction, it might be more tricky. > Or is there a way to do this in a seperate file and replace > these classes by mine? You can do this too. Boa supports plug-ins. I've attached a plug-in which is a copy paste of the Slider companion class (with different default constructor values and the TickFreq hidden). Put this file in the Plug-ins directory. > Last but related question: Is it planned to stay with huge files > like Companions, or do you intend to break it up into plug-ins? They are not meant to be huge, they just naturally grow over time ;) Eeek, just checked: 2130 lines, that's double my usual 1000 line limit! Please note that there are already almost 10 Companion modules in the Boa source code tree so Companions.py has had many children already. If it needs to be broken up further I think I would like to mirror the wxPython filestructure, but this may be too finely grained. Or maybe it should be split up like the Palette pages are? Say FramesComp.py, ContainersLayoutComp.py, BasicControlsComp.py, ButtonsComp.py and ListControlsComp.py > Sorry about so much questions, No problem, the ExtendingBoa document needed an update anyway ;) > but Boa is so exciting, I want it all :-) Great :) Have it all! > > ciao - chris > Cheers, Riaan. > -- > Christian Tismer :^) <mailto:ti...@ti...> > Mission Impossible 5oftware : Have a break! Take a ride on Python's > Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ > 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ > work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776 > PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 > whom do you want to sponsor today? http://www.stackless.com/ > |