Algunes notes sobre el desenvolupament amb Clutter
Una conversa d'IRC sobre com fer que un grup d'actors de Clutter apareguin amb un fade un rere l'altre, i per què sobreescriure show_all no és la manera correcta.
Traducció de l’original en anglès. Llegeix-lo en: CastellanoEnglish
Part 5 de 7Apunts de Clutter
- Conceptes de Clutter
- Apunts sobre Clutter
- Instal·lant el Clutter amb jhbuild
- Snippets de Clutter: D-Bus, GStreamer i ClutterScript
- Algunes notes sobre el desenvolupament amb Clutter
- Player en Clutter i DBUS
- Player en Clutter: integració contínua
Aquesta pàgina era al wiki d'oriolrius.cat (2009–2012). La recupero aquí tal com era.
Com sobreescriure correctament ClutterGroup per gestionar una playlist
[Dissabte 19 Desembre 2009] [16:31:03] <abeaumont> hi, i'm trying to override show_all method of the Group class (with pyclutter), but i'm unable to make it work... my attempt is as described here http://lists.o-hand.com/clutter/0262.html isn't this supported anymore?
[Dissabte 19 Desembre 2009] [16:35:42] <robster> abeaumont: what are you trying to do?
[Dissabte 19 Desembre 2009] [16:38:22] <abeaumont> robster: well, i'd like to have a kind of sequence of actors
[Dissabte 19 Desembre 2009] [16:38:40] <robster> abeaumont: so you want one then the next then the next to fade in?
[Dissabte 19 Desembre 2009] [16:38:51] <abeaumont> robster: yes, kind of
[Dissabte 19 Desembre 2009] [16:39:31] <robster> overwriding show_all is not the way to do it.
[Dissabte 19 Desembre 2009] [16:40:03] <robster> abeaumont: are you populating a container of some kind? a group?
[Dissabte 19 Desembre 2009] [16:40:25] <abeaumont> a group
[Dissabte 19 Desembre 2009] [16:40:35] <robster> and you control it's population?
[Dissabte 19 Desembre 2009] [16:40:49] <abeaumont> no
[Dissabte 19 Desembre 2009] [16:41:31] <robster> abeaumont: okay, well, what you could do is override add_actor
[Dissabte 19 Desembre 2009] [16:41:53] <abeaumont> the sequence is defined through json, so it should be flexible
[Dissabte 19 Desembre 2009] [16:42:20] <abeaumont> robster: i'll take a look to that, thanks for the tip
[Dissabte 19 Desembre 2009] [16:42:24] <robster> set the opacity to zero, do clutter_actor_animate on the opacity, get the timeline for the animation and then set the delay on the timeline to a value based on how many actors you've already added.
[Dissabte 19 Desembre 2009] [16:43:44] <robster> subclassing ClutterGroup will cause a very angry ebassi
[Dissabte 19 Desembre 2009] [16:44:03] <robster> but since you want to use json you'll have to do that
[Dissabte 19 Desembre 2009] [16:44:08] <abeaumont> hmmm, makes sense...
[Dissabte 19 Desembre 2009] [16:45:30] <robster> http://git.moblin.org/cgit.cgi/moblin-panel-myzone/tree/penge/penge-magic-list-view.c
[Dissabte 19 Desembre 2009] [16:45:51] <robster> line 222 to 239 does this
[Dissabte 19 Desembre 2009] [16:46:01] <abeaumont> may i ask what's wrong with the 'override show method' attempt?
[Dissabte 19 Desembre 2009] [16:46:27] <abeaumont> i'm new to gobject/clutter programming
[Dissabte 19 Desembre 2009] [16:46:55] <robster> show_all is pretty legacy, these days actors are visible by default
[Dissabte 19 Desembre 2009] [16:48:23] <robster> uh, that's not true actually
[Dissabte 19 Desembre 2009] [16:49:46] <robster> actually what happens is that an actor is shown when it is parented
[Dissabte 19 Desembre 2009] [16:49:55] <robster> unless "show-on-set-parent" is false
[Dissabte 19 Desembre 2009] [16:50:10] <robster> so you only need to clutter_actor_show on the top level actor, i.e. the stage
[Dissabte 19 Desembre 2009] [16:50:21] <abeaumont> i see
[Dissabte 19 Desembre 2009] [16:50:27] <robster> all of the children will be shown because they have parents
[Dissabte 19 Desembre 2009] [16:50:36] <abeaumont> so show/hide methods are kind of automagical now
[Dissabte 19 Desembre 2009] [16:50:42] <robster> so overriding show all is wrong since the actors are shown
[Dissabte 19 Desembre 2009] [16:50:50] <robster> already
[Dissabte 19 Desembre 2009] [16:52:52] <abeaumont> that explains why my attempts to show only some actors failed miserably
[Dissabte 19 Desembre 2009] [16:53:08] <abeaumont> robster: ok, thanks for the info!
[Dissabte 19 Desembre 2009] [17:38:43] <abeaumont> hmmm, it seems to mostly work... except for https://bugzilla.gnome.org/show_bug.cgi?id=591800
[Dissabte 19 Desembre 2009] [17:39:01] <abeaumont> anyway, i don't need fading effect atm, so never mind :)