group: incorrect response to a change in a layer's priority
Group's are not properly responing to a change in a layer's priority
>>> timeline = GES.Timeline.new_audio_video()
>>> layer0 = timeline.append_layer()
>>> layer1 = timeline.append_layer()
>>> layer2 = timeline.append_layer()
>>> asset = GES.Asset.request(GES.TestClip,None)
>>> clip0 = layer0.add_asset(asset, 0, 0, 10, GES.TrackType.AUDIO)
>>> clip1 = layer1.add_asset(asset, 0, 0, 10, GES.TrackType.AUDIO)
>>> clip0.get_layer_priority()
0
>>> clip1.get_layer_priority()
1
>>> group = GES.Group.new()
>>> group.add(clip0)
True
>>> group.get_layer_priority() # fine
0
>>> group.height # fine
1
>>> group.add(clip1)
True
>>> group.get_layer_priority() # fine, since lowest layer priority is still 0
0
>>> group.height # fine, since layer priorities span two layers
2
>>> timeline.move_layer(layer0, 2)
True
>>> clip0.get_layer_priority() # correct
2
>>> clip1.get_layer_priority() # wrong, should still be 1! clip1 now overlaps clip0, breaking the timeline rules!
2
>>> clip0.get_layer() is clip1.get_layer()
True
>>> group.get_layer_priority() # should have been 1, for clip1
2
>>> group.height # wrong, should at least be 1 since clip1 and clip0 are in the same layer
2
>>> timeline.move_layer(layer0, 0) # trying to set it back will cause GES to hang!
I think the problem starts with _child_priority_changed_cb
, which is called when a layer's priority
is set. It ends up setting the priority of the group, which will move its children. The priority might need to change, but we shouldn't move any children in such cases.