|
Re: codegen documentation?: msg#00071gnome.gtk+.python
> > > > > > > What would the structures be translated to in python ?? > > > > > > > If it becomes objects, you could made them gobject in C then ;) > > > > > > I think it's easier creating a C python object directly :D (which > > > > > > I've > > > > > > already did) > > > > > > > > > > If you're wrapping GObject's, _please_ use pygtk (PyGObject), > > > > > otherwise you'll get in trouble sooner or later. For instance, it is > > > > > not trivial to implement GObject.connect. > > > > All GObject are going to be wrapped using pygtk, since it's The Right To > > > > Do It (TM). However, since there is no support for structs in codegen > > > > > > Actually, codegen almost supports structs. If these structs are > > > registered with glib as boxed types, they are supported. Registering a > > > structure as boxed type basically means to register a function for > > > copying the structure and another for freeing its memory. Then, codegen > > > can generate code to create a new Python object type with attributes and > > > methods, just like GObject. > > Is that the advised way of doing it? What are the advantages in regards > > with other pygtk based objects? > > Well, you have to think carefully, because copying structures means > different semantics than just keeping references. So it doesn't work > out too well in some cases when, for example, you want to modify a > structure returned by some method. With boxed types, you usually end up > modifying a temporary copy instead. However, I see many times > structures wrapped with copy/free functions that just implement simple > reference counting, i.e. copy=ref and free=unref. Take care adding such new features in h2def because other languages are using the def files. I'll tend to believe they may not be very happy to get such a change without previous notifications. That's probably a thing to ask on the binding mailing list. James, do you remember how that thread on the def file ended up ? Regards, Xavier. -- "Complexity has nothing to do with intelligence. Simplicity does." (Larry Bossidy, CEO, Allied Signal) _______________________________________________ pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | pyGtk on embedded systems: 00071, Bharat Kapoor |
|---|---|
| Next by Date: | Re: pyGtk on embedded systems: 00071, Xavier Ordoquy |
| Previous by Thread: | Re: codegen documentation?i: 00071, Gustavo J. A. M. Carneiro |
| Next by Thread: | stock item: 00071, Marcus Habermehl |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |