I am writing my first program using python + gtk + glade. I want to show
dialog when the user pressed the close button of the main window. This
happens, but still the mainwindow is closed, immediately, before the
user has done something with the quit dialog. I have stopped the destroy
signal of the main window (see below). When I run the program, I see on
the console:
GLib-GObject-WARNING **: gsignal.c:788: no emission of signal "destroy"
to stop for instance `0x8245158'


The program consists of two classes: one for the main window and one for
the quit dialog.
In the __init__() of the main window class I do:

self.widgetTree = gtk.glade.XML(PATH + "file.glade", "MainWindow")
self.widgetTree.get_widget("MainWindow").emit_stop_by_name("destroy")

to prevent the main window from being closed. The callback function is
properly connected to the destroy signal. In this function I create and
run the quit dialog:

Dialog=QuitDialog(self.widgetTree.get_widget("MainWindow"))
response=Dialog.Run()
if response == gtk.RESPONSE_OK:
        gtk.main_quit() 
if response == gtk.RESPONSE_CANCEL:
        return gtk.TRUE

The constructor of the quit dialog does basically:
self.WidgetTree = gtk.glade.XML(PATH + "file.glade", "QuitDialog")
self.Dialog = self.WidgetTree.get_widget("QuitDialog")

I noticed that when I say
self.widgetTree = gtk.glade.XML(PATH + "file.glade")
self.WidgetTree = gtk.glade.XML(PATH + "file.glade")
instead of:
self.widgetTree = gtk.glade.XML(PATH + "file.glade", "MainWindow")
self.WidgetTree = gtk.glade.XML(PATH + "file.glade", "QuitDialog")

and the QuitDialog is called, the main window is rebuilt, allthough not
in the correct status. When I then press cancel in the quit dialog, the
main window does not react, except that I can quit it. But when I do so,
gtk.main_quit() is not called.

I hope somebody on the list can point me to the solution of my problem
and explain me the behaviour I described.


Thanks in advance and bye,

Martijn Brouwer



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

Reply via email to