| 1 | import os |
|---|
| 2 | |
|---|
| 3 | from gi.repository import Gtk |
|---|
| 4 | from jarabe.desktop import keydialog |
|---|
| 5 | from jarabe.model import network |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | class 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 | |
|---|
| 29 | def 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 | |
|---|
| 41 | set_theme() |
|---|
| 42 | |
|---|
| 43 | win = DialogWindow() |
|---|
| 44 | win.connect("delete-event", Gtk.main_quit) |
|---|
| 45 | win.show_all() |
|---|
| 46 | Gtk.main() |
|---|