[Glade-users] Q: How can I add some close dialog when the close window shortcut
button is clicked...
Neville C. Dempsey
nevillednz.glade@3ttechnology.com
Thu May 12 17:50:48 EDT 2005
(resending as my reply address was wrong, again - apologies to the moderator)
I am new to glade on python, and this has had me puzzled for hours....
This is not a bad thing as I am learning much about gobjects, and gtk...
Can someone give me a hint....
ThanX
NevilleD
Here is my program:
#!/usr/bin/env python
buffer="""<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">U must click here to
close...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
</glade-interface>"""
import gtk
import gtk.glade
def on_button1_clicked(widget):
print "Goodbye...",widget.name,widget
gtk.main_quit()
def ignore_signal(widget,etc):
# basically I want to:
# 1. Ignore for now...
# 2. BUT Put up a popup later...
print "Ignore...",widget.name,widget,etc
print "Soon.. I will put up an exit dialog box... soon..."
print "In the meantime I REALLY DO want the window to stay up!!"
#clickhere=gtk.glade.XML("clickhere.glade")
clickhere=gtk.glade.xml_new_from_buffer(buffer, len(buffer),
root="window1")
print clickhere,dir(clickhere)
window1=clickhere.get_widget("window1")
button1=clickhere.get_widget("button1")
# really want to replace the existing callback on window1!!
w1_ignore=window1.connect("delete-event",ignore_signal)
b1_quit=button1.connect("clicked",on_button1_clicked)
print "current handlers=",w1_ignore,b1_quit
if __name__=="__main__": gtk.main()
--
Neville C. Dempsey <nevillednz at 3ttechnology dot com>
--
---- ==== 3T TECHNOLOGY (SG) PTE LTD. ==== ----
Enterprising Solutions for Enterprising Companies
www.3TTechnology.com/sg || news2005-subscribe@3ttechnology.com
Neville Dempsey ACE CSA - EMail: <NevilleDNZ@sg.3TTechnology.com>
DID/Mob: +65-6873-0548 - SnailMail: #03-01 Singapore 127140
Office: +65-6873-2058 - Facsimile: +65-6873-2508
DISCLAIMER: This electronic message transmission contains information
from 3T Technology (SG) Pte. Ltd. that may be confidential or
privileged. The information is intended solely for the recipient and use
by any other party is not authorized. If you are not the intended
recipient, be aware that any disclosure, copying, distribution or use of
the contents of this information is prohibited. If you have received
this electronic transmission in error, please notify us immediately by
electronic mail.
More information about the Glade-users
mailing list