Re: Python-fu GIMP Layer "parent" property error

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

 



On 20 June 2014 04:08, Ofnuts <ofnuts@xxxxxxxxxxx> wrote:
> On 20/06/14 03:38, Joao S. O. Bueno wrote:
>>
>> Issue fixed in master and 2.8 branch.  (It will be generally
>> available as of gimp 2.8.12)
>>
>> Thanks for spotting that.
>
>
> While we are at it, it there an explanation why there are both "layers" and
> "children" attributes in a gimp.GroupLayer, that return essentially the same
> thing but with a different class;
>
>>>> image=gimp.image_list()[0]
>>>> g=image.layers[0]
>>>> print g
> <gimp.GroupLayer 'Group3'>
>>>> g.children
> [<gimp.Layer 'Group 3-2'>, <gimp.Layer 'Group 3-1'>]
>>>> g.layers
> [<gimp.GroupLayer 'Group 3-2'>, <gimp.GroupLayer 'Group 3-1'>]
>>>>
>
> In practice, the "children" method is a bit of  a pain when you walk the
> tree, because the image has "layers" but no "children".
>
> But a gimp.Layer has "children" but no "layers"...
>
> All this is highly confusing... with a single "layers" attribute that always
> returns a GroupLayer when possible things would be simpler IMHO.

Hi -
All drawables descend from GIMP Item - which has the "children" property.
The GroupLayer class inheritance order, in pygimp is thus:
GroupLayer<-Layer<-Drawable<-Item

The GroupLayer explicitly implements the "layers" attribute, as in a
GIMP Image -
that is my fault, when I implemented that. I was so used to iterating
over an image
"layers" that not even thought otherwise when implementing GroupLayers
on the Python side.

Anyway, with this specific bug fix, both methods are returning the
same. That is:
"children" and "layers" are aliases on the Python side - the
difference being that plain
"Layer" objects do not have a "layers" property, but all of them have
a "children" property
(which returns an empty list in this case).

  js
 -><-


In gimp 2.8,  Items where refactored to be able to be containers, and do have
the "children" method. Pygimp mimics that, even though no other kind of
item, currently, is a container.

> _______________________________________________
> gimp-developer-list mailing list
> List address:    gimp-developer-list@xxxxxxxxx
> List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
> List archives:   https://mail.gnome.org/archives/gimp-developer-list
_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list
List archives:   https://mail.gnome.org/archives/gimp-developer-list




[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux