Hi,
As promised I've published some information about what I am calling
Project Phoenix, also known as the new way to produce the wxPython
wrappers that myself and others have been hinting about for a couple
years now.
About replacing SWIG, do the other wrapping tools support the
features that I like in wxPython:
I'll answer just for SIP since that is the non-SWIG tool that I'm most familiar with at the moment.
1 - cross-language polymorphism:
the ability to inherit from a C++ class in Python, and implement
virtual methods in Python code.
SIP: Yes.
When I first started making it possible to do that with wxPython, SWIG either didn't have the "directors" feature yet, or it was still brand new and had a bad reputation for causing more problems than it solved. So I implemented my own hand-written code to do it, and it grew into an ugly, wart-infested mess that is difficult to use and to maintain. With SIP it looks like it was designed from the start to support reflecting virtual method calls down to the Python class (if it was overridden there) and to be efficient about it. To be fair it looks like the directors feature in the newest SWIG is better than the last time I looked at it and so if I stay with SWIG I will switch to using directors in Phoenix instead of my old kludges.
2 - Original Object Return:
For example, in event callbacks, event.GetWindow() returns the same python
object I created earlier in my code; not a copy, not a structure containing the
same handle. All the custom attributes are still there - very important
in a derived class!
SIP: Yes
I still need to do some verification of this but it looks like it is a built-in feature of SIP's runtime library and won't have to be a hack that I add on myself like I did with SWIG. And since it's built-in we should be able to make it work for every wrapped type and not just windows, sizers and a few others that have a user data pointer that I'm able to hijack.
These two features allow the programmer to use objects, not IDs like with
other toolkits.
3 - separate compilation:
Sometimes it's not possible to use Python code and you need to
customize a wxWidget class in C++: for example some time ago I
subclassed wxComboBox at the time there was no owner-drawn option.
With SWIG it's possible to wrap this customized class, compile a new
extension module and obtain a new (Python) subclass of wx.ComboBox,
that you can use everywhere a combo box is expected to work.
We also implemented a complex wx.Sizer which was initially slow
in Python, and that we rewrote in C++ for performance. Of course from
Python code it was accessible and usable just like a wx.GridSizer.
Yes, this ability is not something that I would be willing to lose, so no matter what is chosen it will still be possible to add other extension modules that are able to fully integrate with the wxPython extension modules. You may have to change how you implement the wrappers for your C++ class, but it will be possible to do.
···
On 10/28/10 1:48 PM, Amaury Forgeot d'Arc wrote:
On 10/26/10 5:37 PM, Robin Dunn wrote:
--
Robin Dunn
Software Craftsman