Ticket #3569: iconentry_testcase.py

File iconentry_testcase.py, 1.0 KB (added by humitos, 11 years ago)

test case to run inside a "make shell" (sugar-build); we can switch between run it with the sugar theme or not

Line 
1#!/usr/bin/env python
2
3import os
4
5from gi.repository import Gtk
6from sugar3.graphics.iconentry import IconEntry
7
8def set_theme():
9    settings = Gtk.Settings.get_default()
10    sugar_theme = 'sugar-72'
11    if 'SUGAR_SCALING' in os.environ:
12        if os.environ['SUGAR_SCALING'] == '100':
13            sugar_theme = 'sugar-100'
14    settings.set_property('gtk-theme-name', sugar_theme)
15    settings.set_property('gtk-icon-theme-name', 'sugar')
16
17
18def main():
19    window = Gtk.Window()
20
21    iconentry = IconEntry()
22    iconentry.set_icon_from_name(
23        Gtk.EntryIconPosition.PRIMARY,
24        'system-search'
25    )
26
27    # set_theme()
28    iconentry.set_icon_from_name(
29        Gtk.EntryIconPosition.SECONDARY,
30        'system-search'
31    )
32
33
34    # iconentry.set_icon_from_name(
35    #     Gtk.EntryIconPosition.SECONDARY,
36    #     'dialog-cancel'
37    # )
38
39    # iconentry.add_clear_button()
40
41    window.add(iconentry)
42
43    window.connect("destroy", Gtk.main_quit)
44    window.show_all()
45    Gtk.main()
46
47if __name__ == "__main__":
48    main()