Re: [pygtk] Re: Overriding GObject methods in Python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2006-11-24 at 15:22 +0100, Gustavo J. A. M. Carneiro wrote:
> The GenericGtkFooBar are the old way of doing this and are
> deprecated. 
> Nowadays you can subclass any gtk.XxxCellRenderer and override
> specific 
> vfuncs. 

I understand that, but I'm referring to the way that this is
implemented: PyGTK still has to provide C code for each Gtk* class that
has virtual methods that need to be overridable from Python.

Ideally I'd like to provide a way for Python to override members of
GObject classes I define without writing new C code for each class.  The
C code would definitely have to be written, but it could be written only
once and work for all classes written to conform to that kind of
interface.

>  Take a look at (define-virtual ...) blocks in the .defs.

I assume you're referring to (for example) this:

(define-virtual render
  (of-object "GtkCellRenderer")
  (return-type "none")
  (parameters
    '("GdkDrawable*" "window")
    '("GtkWidget*" "widget")
    '("GdkRectangle*" "background_area")
    '("GdkRectangle*" "cell_area")
    '("GdkRectangle*" "expose_area")
    '("GtkCellRendererState" "flags")
  )
)

How does such a definition enable one to subclass GtkCellRenderer from
Python?  Even with the information above, the "render" function pointer
is still a member of the class struct, and as such inaccessible from
Python.  Python code that knows its GObject class and the name of the
method should be able to influence the ->render field of the subclass it
implements.

Am I missing something that could enable this to work?


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux