2011-10-31 19:56:13 +01:00
|
|
|
from gi.repository import Gtk
|
2013-04-03 22:01:15 +02:00
|
|
|
from sugar3.graphics.alert import TimeoutAlert
|
2017-01-11 18:23:08 +01:00
|
|
|
from common import set_theme
|
2011-10-31 19:56:13 +01:00
|
|
|
|
2017-01-05 01:02:26 +01:00
|
|
|
|
2018-02-08 13:15:15 +01:00
|
|
|
set_theme()
|
2011-10-31 19:56:13 +01:00
|
|
|
w = Gtk.Window()
|
2017-01-11 18:23:08 +01:00
|
|
|
w.connect("delete-event", Gtk.main_quit)
|
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
2011-10-31 19:56:13 +01:00
|
|
|
w.add(box)
|
|
|
|
|
2018-02-08 13:15:15 +01:00
|
|
|
# Create a TimeoutAlert Object
|
|
|
|
alert = TimeoutAlert(5)
|
|
|
|
alert.props.title = '<Alert Title>'
|
|
|
|
alert.props.msg = '<Alert Message>'
|
|
|
|
|
|
|
|
# Add Timeout Object to the box
|
2011-10-31 19:56:13 +01:00
|
|
|
box.pack_start(alert, False, False, 0)
|
|
|
|
|
|
|
|
|
2018-02-08 13:15:15 +01:00
|
|
|
# Called when an alert object throws a response event.
|
|
|
|
def __alert_response_cb(alert, response_id):
|
|
|
|
if response_id is Gtk.ResponseType.OK:
|
|
|
|
print 'Continue Button was clicked.'
|
|
|
|
elif response_id is Gtk.ResponseType.CANCEL:
|
|
|
|
print 'Cancel Button was clicked.'
|
|
|
|
elif response_id == -1:
|
|
|
|
print 'Timeout occurred'
|
|
|
|
|
|
|
|
|
|
|
|
alert.connect('response', __alert_response_cb)
|
|
|
|
w.show_all()
|
2011-10-31 19:56:13 +01:00
|
|
|
Gtk.main()
|