After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 334986 - Make it possible to re-implement interfaces and chain to parent impl.
Make it possible to re-implement interfaces and chain to parent impl.
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: Gustavo Carneiro
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-03-18 13:38 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2006-04-01 18:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pygobject patch (1.95 KB, patch)
2006-03-19 17:29 UTC, Gustavo Carneiro
none Details | Review
pygtk part of the patch (4.07 KB, patch)
2006-03-19 17:29 UTC, Gustavo Carneiro
none Details | Review
small example (764 bytes, text/x-python)
2006-03-19 17:30 UTC, Gustavo Carneiro
  Details

Description Johan (not receiving bugmail) Dahlin 2006-03-18 13:38:01 UTC
It should be possible to implement GInterfaces in python

Simple use case.

class MyEntry(gtk.Widget):
   __gtype_implements__ = (gtk.Editable, )

   def do_do_insert_text(self, ...)
      ...

__gtype_implements__ is just an example, maybe not the best syntax, but at least it is consistent with __gsignals__ and __gproperties__.

Ultimately, it should be possible to override interfaces and chain to parents.
Similar to what GtkFileChooserEntry does. It does not need to be solved in the bug, but the implementation of this bug needs to consider that.

Creating your own interfaces is out of the scope for this bug and will probably never be possible (since a C VTable needs to be created) without runtime code generation.
Comment 1 Gustavo Carneiro 2006-03-19 17:29:22 UTC
Created attachment 61558 [details] [review]
pygobject patch

Currently pygtk already supports implementing interfaces, just not re-implementing them.  The syntax that already exists to indicate we want to implement an interface is to put the interface in the class base types.  The patch adds support for re-implementing interfaces, although it is not much useful without code generator changes that go into pygtk.
Comment 2 Gustavo Carneiro 2006-03-19 17:29:50 UTC
Created attachment 61559 [details] [review]
pygtk part of the patch
Comment 3 Gustavo Carneiro 2006-03-19 17:30:41 UTC
Created attachment 61560 [details]
small example