Using GObject interfaces in Python (Mx.Draggable in this case)



Over the last few months I've been getting my head around GObject using it with GStreamer, GTK and now Clutter/Mx, but one thing I've never gotten is how the interfaces work in Python. I'd thought it was just a simple case of subclassing from the interfaces with an appropriate base class (e.g. atm I'm trying Clutter.Actor with Mx.Draggable), but I think I'm missing something.

If I do something like:

class MyActor(Clutter.Actor, Mx.Draggable)
    def __init__(self):
        super(Clutter.Actor, self).__init__()

...I get errors like this:
Warning: Object class gui+LibraryViewGridItem doesn't implement property 'axis' from interface 'MxDraggable'

If I then add these properties manually to my class, these errors go away, but the draggable interface doesn't seem to work. Nothing happens when I try to drag my actor, and the drag-begin signal never fires (although it gets connected properly as it does seem to exist in the new class). It makes me think I'm missing some sort of initialization code for these interfaces.

I've looked at an example in C (https://github.com/clutter-project/mx/blob/master/tests/test-draggable.c), but it's difficult for me to see what I'd need to do in Python. Thanks in advance for any help.


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