paulb@48 | 1 | #!/usr/bin/env python |
paulb@48 | 2 | |
paulb@48 | 3 | import desktop.dialog |
paulb@48 | 4 | |
paulb@48 | 5 | def test_open(obj, desktop=None): |
paulb@48 | 6 | try: |
paulb@48 | 7 | return obj.open(desktop) |
paulb@48 | 8 | except OSError: |
paulb@48 | 9 | return None |
paulb@48 | 10 | |
paulb@48 | 11 | """ |
paulb@48 | 12 | obj = desktop.dialog.Question("Are you sure?", 40, 5) |
paulb@48 | 13 | print test_open(obj) |
paulb@48 | 14 | print test_open(obj, "KDE") |
paulb@48 | 15 | print test_open(obj, "GNOME") |
paulb@48 | 16 | print test_open(obj, "X11") |
paulb@48 | 17 | |
paulb@48 | 18 | obj = desktop.dialog.Message("Hello world!", 40, 5) |
paulb@48 | 19 | print test_open(obj) |
paulb@48 | 20 | print test_open(obj, "KDE") |
paulb@48 | 21 | print test_open(obj, "GNOME") |
paulb@48 | 22 | print test_open(obj, "X11") |
paulb@48 | 23 | |
paulb@48 | 24 | obj = desktop.dialog.Warning("Beware of the penguin!", 40, 5) |
paulb@48 | 25 | print test_open(obj) |
paulb@48 | 26 | print test_open(obj, "KDE") |
paulb@48 | 27 | print test_open(obj, "GNOME") |
paulb@48 | 28 | print test_open(obj, "X11") |
paulb@48 | 29 | |
paulb@48 | 30 | obj = desktop.dialog.Error("Penguin invasion complete!", 40, 5) |
paulb@48 | 31 | print test_open(obj) |
paulb@48 | 32 | print test_open(obj, "KDE") |
paulb@48 | 33 | print test_open(obj, "GNOME") |
paulb@48 | 34 | print test_open(obj, "X11") |
paulb@48 | 35 | """ |
paulb@48 | 36 | |
paulb@48 | 37 | obj = desktop.dialog.Menu("Choose an animal", ["*", "Animal"], width=40, height=15, list_height=5) |
paulb@48 | 38 | obj.add("a", "Antelope") |
paulb@48 | 39 | obj.add("b", "Badger") |
paulb@48 | 40 | obj.add("c", "Cow") |
paulb@48 | 41 | obj.add("d", "Dog") |
paulb@48 | 42 | obj.add("e", "Elephant") |
paulb@48 | 43 | obj.add("f", "Fox") |
paulb@48 | 44 | obj.add("g", "Giraffe") |
paulb@48 | 45 | obj.add("h", "Horse") |
paulb@48 | 46 | obj.add("i", "Iguana") |
paulb@48 | 47 | print test_open(obj) |
paulb@48 | 48 | print test_open(obj, "KDE") |
paulb@48 | 49 | print test_open(obj, "GNOME") |
paulb@48 | 50 | print test_open(obj, "X11") |
paulb@48 | 51 | |
paulb@48 | 52 | obj = desktop.dialog.CheckList("Choose some animals", ["S", "*", "Animal"], width=40, height=15, list_height=5) |
paulb@48 | 53 | obj.add("a", "Antelope") |
paulb@48 | 54 | obj.add("b", "Badger", 1) |
paulb@48 | 55 | obj.add("c", "Cow", 0) |
paulb@48 | 56 | obj.add("d", "Dog") |
paulb@48 | 57 | obj.add("e", "Elephant") |
paulb@48 | 58 | obj.add("f", "Fox", 1) |
paulb@48 | 59 | obj.add("g", "Giraffe") |
paulb@48 | 60 | obj.add("h", "Horse") |
paulb@48 | 61 | obj.add("i", "Iguana") |
paulb@48 | 62 | print test_open(obj) |
paulb@48 | 63 | print test_open(obj, "KDE") |
paulb@48 | 64 | print test_open(obj, "GNOME") |
paulb@48 | 65 | print test_open(obj, "X11") |
paulb@48 | 66 | |
paulb@48 | 67 | # vim: tabstop=4 expandtab shiftwidth=4 |