Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Johan Dahlin
> > Johan> 2) Call glade.XML again to reparse (and recreate all widgets)
> > 
> > Sounds expensive. :-(
>
>   No, it is not.  libglade automatically caches XML trees, so only the
> first time is the XML file really opened and parsed.  Subsequent
> invocations with same parameters merely construct the widget tree from
> the description in memory.
> 
> 
And it's not like parsing XML would be very expensive anyway.

-- 
Johan Dahlin <[EMAIL PROTECTED]>

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Christian Robottom Reis
On Wed, Aug 11, 2004 at 04:41:11PM -0400, John Ehresman wrote:
> Skip Montanaro wrote:
> >But when the user pokes the "x" won't the underlying X windows be 
> >destroyed?
> >Is there a way to catch the destroy signal and avoid the window 
> >destruction?
> 
> Connect to the 'delete_event' signal on the window.  Return False if you 
> want the default handler to destroy the window and True to indicate that 
> you've handled the event and the default handler should not be invoked.

And yes, that's in the FAQ:

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq10.006.htp

> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Gustavo J. A. M. Carneiro
A Qua, 2004-08-11 às 21:31, Skip Montanaro escreveu:
> >> How do I convince Glade to create new Window and TextView widgets on
> >> subsequent calls to get_widget()?
> 
> Johan> Two possible solutions:
> 
> Johan> 1) Don't destroy the window, just hide it.
> 
> But when the user pokes the "x" won't the underlying X windows be destroyed?
> Is there a way to catch the destroy signal and avoid the window destruction?
> I'd happily just hide the window, but that doesn't seem to work either.
> 
> Johan> 2) Call glade.XML again to reparse (and recreate all widgets)
> 
> Sounds expensive. :-(

  No, it is not.  libglade automatically caches XML trees, so only the
first time is the XML file really opened and parsed.  Subsequent
invocations with same parameters merely construct the widget tree from
the description in memory.

> 
> Thanks for the ideas...
> 
> Skip
> 
> ___
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Skip Montanaro

John> Connect to the 'delete_event' signal on the window.  Return False
John> if you want the default handler to destroy the window and True to
John> indicate that you've handled the event and the default handler
John> should not be invoked.

Thanks a million.  Worked like a charm...

Skip
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread John Ehresman
Skip Montanaro wrote:
But when the user pokes the "x" won't the underlying X windows be destroyed?
Is there a way to catch the destroy signal and avoid the window destruction?
Connect to the 'delete_event' signal on the window.  Return False if you 
want the default handler to destroy the window and True to indicate that 
you've handled the event and the default handler should not be invoked.

John
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Skip Montanaro

>> How do I convince Glade to create new Window and TextView widgets on
>> subsequent calls to get_widget()?

Johan> Two possible solutions:

Johan> 1) Don't destroy the window, just hide it.

But when the user pokes the "x" won't the underlying X windows be destroyed?
Is there a way to catch the destroy signal and avoid the window destruction?
I'd happily just hide the window, but that doesn't seem to work either.

Johan> 2) Call glade.XML again to reparse (and recreate all widgets)

Sounds expensive. :-(

Thanks for the ideas...

Skip

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] repetitive get_widget() using Glade?

2004-08-11 Thread Johan Dahlin
ons 2004-08-11 klockan 21.58 skrev Skip Montanaro:
> I have a simple popup window that contains a TextView widget.  The TV is
> tied to a Python interpreter (code.InteractiveConsole).  The window and TV
> are defined in Glade.  Works great the first time I ask to display it.
> 
> If I poke the "X" button in the window's title bar to destroy it I delete my
> objects (the corresponding X windows are going away, after all) in my
> destroy event handler.  I want to create a new instance the next time I
> select "Interpreter Window" from my debug menu.  Unfortunately, when I call
> .get_widget(...) a second time it returns None instead of a new TextView or
> Window.  How do I convince Glade to create new Window and TextView widgets
> on subsequent calls to get_widget()?

Two possible solutions:

1) Don't destroy the window, just hide it.

2) Call glade.XML again to reparse (and recreate all widgets)

-- 
Johan Dahlin <[EMAIL PROTECTED]>

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/