On Fri, Mar 25, 2011 at 16:32, ekspiulo <[email protected]> wrote:
> Thank you very much! Wow, I would not have known to do that.  After some
> searching online, it seems that do_* is the PyGObject convention to handle
> vfunc overrides?

Yes, this has been kept as it was before. I'm not sure, but I would
have expected it to be mentioned in a PyGObject tutorial.

> Can you recommend any documentation or resources that I can
> use in order to get a handle on the finer points of GObject introspection in
> Python or find a list of the conventions used?

There's a start in http://live.gnome.org/PyGObject/IntrospectionPorting

> I'm actively working on a game for which I expect to heavily use Clutter
> through Python's gi module, and I'd be happy to contribute Clutter specific
> GI documentation, if its wanted.

There's a big need for that, as you have already noticed :)

I would suggest to coordinate the documentation effort in #python in
GIMPNet or in http://mail.gnome.org/mailman/listinfo/python-hackers-list

Cheers,

Tomeu

>
> Thanks,
>
> Brian
>
> On 03/25/2011 03:44 AM, Tomeu Vizoso wrote:
>>
>> On Fri, Mar 25, 2011 at 05:09, ekspiulo<[email protected]>  wrote:
>>>
>>> I think I'm 80% of the way toward understanding how this should work, but
>>> my
>>> test case never calls apply_transform, so I don't know what exactly it
>>> does.
>>>  When exactly is this function called, and am I handling it right here?
>>>  My
>>> print(...) statement never prints, so I don't think its even being
>>> called.
>>>  What am I doing wrong here?
>>
>> This works here, but you need to prepend do_ to the name of your vfunc
>> override:
>>
>>    def do_apply_transform(self, matrix):
>>        print("applying")
>>        Clutter.Actor.do_apply_transform(self, matrix)
>>        matrix.translate(5.0, 10.0, 0.0)
>>
>>> I'm using Clutter through Python with GObject introspection.
>>
>> Make sure you are using recent versions of those (latest stable
>> releases should be enough).
>>
>> Regards,
>>
>> Tomeu
>>
>>> Thanks,
>>>
>>> Brian
>>>
>>> from gi.repository import Clutter
>>> from gi.repository import Cogl
>>>
>>> class GridView(Clutter.Rectangle):
>>>    """A 2D plane of rectangular items."""
>>>
>>>    def __init__(self, width=100, height=100):
>>>        Clutter.Rectangle.__init__(self)
>>>        self.set_size(width, height)
>>>        self.set_color(Clutter.Color.new(64, 64, 64, 255))
>>>
>>>
>>>    def apply_transform(self):
>>>        print("applying")
>>>        Clutter.Actor.apply_transform(self, matrix)
>>>        matrix.translate(5.0, 10.0, 0.0)
>>>
>>> if __name__ == "__main__":
>>>    Clutter.init([])
>>>    stage = Clutter.Stage()
>>>    stage.set_size(600,600)
>>>    grid = GridView()
>>>    grid.set_position(0,0)
>>>    stage.add_actor(grid)
>>>    stage.connect('destroy', lambda *x: Clutter.main_quit())
>>>    stage.show_all()
>>>    Clutter.main()
>>>
>>> On 03/24/2011 08:19 AM, Emmanuele Bassi wrote:
>>>>
>>>> On 2011-03-23 at 13:47, ekspiulo wrote:
>>>>>
>>>>> Hello all,
>>>>>
>>>>> I'm planning to write a GTK application containing a big google maps
>>>>> style pan&    zoom view of a finite and reasonably sized clutter
>>>>> stage, and all of the tutorials and such seem to recommend using
>>>>> GtkClutterViewport, which makes sense given that a GtkViewport is
>>>>> the standard method of viewing something larger than space in the
>>>>> UI; however, it looks like this was recently removed. . .
>>>>>
>>>>> Is there new pattern for constructing such a veiwport in a gtk&
>>>>> clutter application?
>>>>
>>>> the GtkClutterViewport actor was removed because it was not as useful or
>>>> as flexible as it looked like.
>>>>
>>>> you can easily implement the same functionality in a custom Actor
>>>> sub-class overriding the apply_transform() virtual function, and calling
>>>> cogl_matrix_translate() on the passed transformation matrix; the offsets
>>>> can come from a MxAdjustment, a GtkAdjustment or two properties bound to
>>>> any model.
>>>>
>>>> ciao,
>>>>  Emmanuele.
>>>>
>>> _______________________________________________
>>> clutter-app-devel-list mailing list
>>> [email protected]
>>> http://lists.clutter-project.org/listinfo/clutter-app-devel-list
>>>
>
> _______________________________________________
> clutter-app-devel-list mailing list
> [email protected]
> http://lists.clutter-project.org/listinfo/clutter-app-devel-list
>
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to