Re: [pygtk] GtkWindow bring to front

2002-10-22 Thread James Henstridge
LDC - Pablo Endres Lozada wrote:


	Thanks for all your answers guys you've been really helpfull!!

	Here come the question.  Is there a way to bring a window to 
	front?
	  And question two:
	supose you define two windows with libglade and save them in
	the same file. if I start the app like this

	self.widgets = libglade.GladeXML("Gui.glade", 
"MainWindow")	

	how do I acces Window2 to show it?
	I tryed self.widgets.get_widget("Window22)
	but it doesn't work.
 

If the widget is not have its visible attribute set, you can call show() 
on the widget to show it.  If the widget is already showing, you could 
use the window.present() method (available only in the gtk 2.0 version 
of pygtk).

James.

--
Email: [EMAIL PROTECTED]  | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia. 




___
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] GtkWindow bring to front

2002-10-22 Thread Steve McClure
On Tue, 2002-10-22 at 11:16, LDC - Pablo Endres Lozada wrote:
> 
> 
>   Thanks for all your answers guys you've been really helpfull!!
> 
>   Here come the question.  Is there a way to bring a window to 
>   front?

I use this showDialog method when I want to update the dialog. My
dialogs use the map event to trigger loading of contents. The last bit
of checking the MAPPED flag and calling _raise is what you are
interested in.

def showDialog(self, dialog, title = None):
if type(dialog) == types.StringType:
d = self.wtree.get_widget(dialog)
else:
d = dialog

if title:
d.set_title(title)

if d is None:
sl = traceback.extract_stack()
frame = sl[-2]
msg = 'No dialog named %s, fix line %d of %s!' % (dialog,
frame[1], frame[0])
mwsdialogs.mwsErrorDialog(msg, modal=1)
raise KeyError, msg

if d.flags(gtk.MAPPED) == 0:
d.show()
else:
d.get_window()._raise()
# call map again so dialogs will refresh their contents
return d.emit('map', d)


> And question two:
>   supose you define two windows with libglade and save them in
>   the same file. if I start the app like this
> 
>   self.widgets = libglade.GladeXML("Gui.glade", 
> "MainWindow") 
> 
>   how do I acces Window2 to show it?
>   I tryed self.widgets.get_widget("Window22)

That is the method you what to use but you have to make sure you
uniquely, and correctly, name each widget you might want to access
directly.  Also, note that when you specify the root, in your case,
"MainWindow", only that widget hierarchy is created.  I don't specify a
root and just import the whole glade file, otherwise you will have to
instantiate multiple GladeXML objects with different roots.

>   but it doesn't work.
> 
>   Thanks in advance
> 
> -- 
>   Muchas personas creen que piensan,
>   cuando en realidad sólo están reordenando sus
>   prejuicios.
>   - William James
>  
>.-.
>   /  .-.   Pablo Endres Lozada.-.  \
>  |  /   \   Laboratorio Docente de Computacion  /   \  |
>  | |\_.  |USB - Venezuela  |/| |
>  |\|  | /| |\  | |/|
>  | `---' |   [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/
-- 
Steve McClure   430 10th St NW
Racemi  Suite N-210
http://www.racemi.com   Atlanta, GA 30318
[EMAIL PROTECTED] voice/fax: 404-892-5850



signature.asc
Description: This is a digitally signed message part


[pygtk] GtkWindow bring to front

2002-10-22 Thread LDC - Pablo Endres Lozada


Thanks for all your answers guys you've been really helpfull!!

Here come the question.  Is there a way to bring a window to 
front?
  And question two:
supose you define two windows with libglade and save them in
the same file. if I start the app like this

self.widgets = libglade.GladeXML("Gui.glade", 
"MainWindow")   

how do I acces Window2 to show it?
I tryed self.widgets.get_widget("Window22)
but it doesn't work.

Thanks in advance

-- 
Muchas personas creen que piensan,
cuando en realidad sólo están reordenando sus
prejuicios.
- William James
 
   .-.
  /  .-.   Pablo Endres Lozada.-.  \
 |  /   \   Laboratorio Docente de Computacion  /   \  |
 | |\_.  |USB - Venezuela  |/| |
 |\|  | /| |\  | |/|
 | `---' |   [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/