Ticket #3971: testdialog.py

File testdialog.py, 1.2 KB (added by erikos, 10 years ago)

test app

Line 
1import os
2
3from gi.repository import Gtk
4from jarabe.desktop import keydialog
5from jarabe.model import network
6
7
8class DialogWindow(Gtk.Window):
9
10    def __init__(self):
11        Gtk.Window.__init__(self, title="Dialog Example")
12
13        self.set_border_width(6)
14
15        button = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
16        button.connect("clicked", self.on_button_clicked)
17
18        self.add(button)
19
20    def reply(self, a):
21        print 'reply ', a
22
23    def error(self, a):
24        print 'error'
25
26    def on_button_clicked(self, widget):
27        keydialog.create('pennylane', 1, 332, 332, 63, network.SecretsResponse(self.reply, self.error))
28
29def set_theme():
30    settings = Gtk.Settings.get_default()
31    sugar_theme = 'sugar-72'
32    if 'SUGAR_SCALING' in os.environ:
33        if os.environ['SUGAR_SCALING'] == '100':
34            sugar_theme = 'sugar-100'
35    print  sugar_theme
36    settings.set_property('gtk-theme-name', sugar_theme)
37    settings.set_property('gtk-icon-theme-name', 'sugar')
38    settings.set_property('gtk-menu-images', 1)
39    settings.set_property('gtk-button-images', 1)
40
41set_theme()
42
43win = DialogWindow()
44win.connect("delete-event", Gtk.main_quit)
45win.show_all()
46Gtk.main()