469,602 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

GladeGen and initializing widgets at startup

Hi all,

Being struck by article 7421 of the linux journal
(http://www.linuxjournal.com/article/7421), I'll tried to give it a go.
Mainly because I have done some experiments with Glade and found that
it is really easy to create good looking GUIs. On the other end, there
is the GladeGen tool which helps you in building a skeleton in Python
such that you only have to code the events. But being a newbie with
Python as well as Glade I'm heavily dependent on documentation (mainly
online a big part being usenet). There I found that almost nobody
seems to use it, or they don't have any problems with it. In this group
there is only thread that has a reference to it!

So my questions:

Does anybody use GladeGen? If not, why?

For those that do use it, where do I write the code which has to be
executed when a window loads? The thing is pretty basic here. I have a
window with a treeview, and I simply want that treeview filled up when
opening the window.

Hoping for some echos...

Aengys

May 6 '06 #1
3 1786

On May 6, 2006, at 4:39 PM, Aengys wrote:
Hi all,

Being struck by article 7421 of the linux journal
(http://www.linuxjournal.com/article/7421), I'll tried to give it a
go.
Mainly because I have done some experiments with Glade and found that
it is really easy to create good looking GUIs. On the other end, there
is the GladeGen tool which helps you in building a skeleton in Python
such that you only have to code the events. But being a newbie with
Python as well as Glade I'm heavily dependent on documentation (mainly
online a big part being usenet). There I found that almost nobody
seems to use it, or they don't have any problems with it. In this
group
there is only thread that has a reference to it!

So my questions:

Does anybody use GladeGen? If not, why?

For those that do use it, where do I write the code which has to be
executed when a window loads? The thing is pretty basic here. I
have a
window with a treeview, and I simply want that treeview filled up when
opening the window.

Hoping for some echos...

Aengys

I'm the author of it - I got a number (20-30 I think) of responses
from people using it and a few quick questions. I emailed the gnome-
python maintainer to see if they were interested in including it or
taking it over, but never heard back. If anyone wants to take it over
and extend it, you're welcome to. I believe Linux Journal maintained
copyright ownership for a few months after the publication but then
it reverts back to the author so I'll happily release it under the
GPL for anyone to extend. To answer your question, you can put your
code in the init method after the call to: GladeWindow.__init__ or
you can override the GladeWindow's show method in your class if you
want it to be called every time the window is shown. I often wrote a
method named "populate" to file in data in widgets and then called it
from the show method.

Dave

May 6 '06 #2
Thank you for your reply!

I finally managed to do what I wanted. Maybe a little side-remark here.
In the article you have said that all changes to the init-method are
lost once you regenerate the file. I have tried it, and indeed all my
changes were lost (which I had backed up before). So I've created a
method which do the initialization and I call this method from the
init-method. Maybe it would be a nice extention to include such a
method by default; a method you can fill with all the code that needs
to be done when initializing the window.... I'm not yet so familiar
with the whole process, but I might have a look at it in the future.
I'll keep you updated on that if it happens.

Regarding the extension of the show method: how do I do that? And what
benefit does it have to the solution mentioned above?

Aengys

May 7 '06 #3

On May 7, 2006, at 4:24 AM, Aengys wrote:
Thank you for your reply!

I finally managed to do what I wanted. Maybe a little side-remark
here.
In the article you have said that all changes to the init-method are
lost once you regenerate the file. I have tried it, and indeed all my
changes were lost (which I had backed up before). So I've created a
method which do the initialization and I call this method from the
init-method. Maybe it would be a nice extention to include such a
method by default; a method you can fill with all the code that needs
to be done when initializing the window.... I'm not yet so familiar
with the whole process, but I might have a look at it in the future.
I'll keep you updated on that if it happens.

It's been a while since I've looked at it or used it (haven't been
doing an GUI programming recently). I should have said to put your
code in the __init__ method after the call to init since the init
method is regenerated each time.

Regarding the extension of the show method: how do I do that? And what
benefit does it have to the solution mentioned above?

You mentioned you were new to Python - you really need to learn more
(specifically about inheritance) before you can fully understand
this. The GladeWindow provides a show method but you can write your
own show method that would get called instead of it. If you want the
code to just be called once, using the __init__ method is appropriate
but if your window is repeatedly shown/hidden and you want the code
executed each time the window is shown.

Dave

May 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dean | last post: by
3 posts views Thread by bromden | last post: by
2 posts views Thread by Adonis | last post: by
reply views Thread by Rafal Janas | last post: by
34 posts views Thread by newsposter0123 | last post: by
1 post views Thread by Vangati | last post: by
13 posts views Thread by WaterWalk | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.