Re: [gedit-list] API question: How to get the list of items in a panel?



Thanks for the response Paolo.

Following your pointer I played a little more with the API and found the list of items for the panel buried a little deeper in the containment hierarchy (window.panel.notebook.items).

Actually before posting my question I had run get_children() on the panel object and got 2 children back of types HBox and Notebook.  My lack of familiarity with gEdit's containment object model led me to discard the Notebook as a candidate parent of the items and I stopped digging around too soon.

"""
The api at the moment is not very helpful, maybe we should add a way to
enumerate the panel items by name...
"""
+1

thanks much,
--KM


On Fri, May 29, 2009 at 1:08 PM, Paolo Borelli <pborelli katamail com> wrote:
Il giorno ven, 29/05/2009 alle 10.17 -0400, kaleb moreland ha scritto:
> Hi all,
>
> I am relatively new to gedit and have just subscribed to the list.
> Before anything else, thanks for a terrific piece of software.
>
> I am trying to manipulate programatically the items (bottom tabs) in
> the side panel, for instance, to activate a given item in response to
> a key press.  After some experimentation/introspection with the API in
> the Python console, I believe the call that will do the trick is:
>
> window.get_side_panel().activate_item(<item>)
>
> What I couldn't find, however, is a way to grab the <item> object.  I
> suppose there must be a method that enumerates the items in a panel.
> Can anyone point me in the right direction?
>

Hi Kaleb,

       well since the panel is a GtkCoontainer you can get the list of
children with gtk.Container.get_children(). However at that point you
will probably need a way to check the child you are interested in and
that may a bit painful unless you know that is a particular kind of
widget or something like that.

The api at the moment is not very helpful, maybe we should add a way to
enumerate the panel items by name...

Ciao
       Paolo


> thanks,
> --Kaleb
>
> _______________________________________________
> gedit-list mailing list
> gedit-list gnome org
> http://mail.gnome.org/mailman/listinfo/gedit-list




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