diff options
author | Davide Andreoli <dave@gurumeditation.it> | 2012-06-06 21:31:32 +0000 |
---|---|---|
committer | Davide Andreoli <dave@gurumeditation.it> | 2012-06-06 21:31:32 +0000 |
commit | ca7b60b2692b9f6c8fc87d83bfc06d7e2d858c2d (patch) | |
tree | 4aa354cdb5e4e97f971ffc55b087b29d76838a28 /tests | |
parent | 1317d096bf3c736dca6cd060bdd25939e79f8ab4 (diff) | |
download | python-elementary-ca7b60b2692b9f6c8fc87d83bfc06d7e2d858c2d.tar.gz python-elementary-ca7b60b2692b9f6c8fc87d83bfc06d7e2d858c2d.tar.bz2 python-elementary-ca7b60b2692b9f6c8fc87d83bfc06d7e2d858c2d.zip |
Python elm: New test "Window States"
and a small addition to the inwin test
SVN revision: 71767
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.py | 2 | ||||
-rw-r--r-- | tests/test_inwin.py | 8 | ||||
-rw-r--r-- | tests/test_win.py | 103 |
3 files changed, 113 insertions, 0 deletions
diff --git a/tests/test.py b/tests/test.py index 41f6f7b..f1c7dd1 100644 --- a/tests/test.py +++ b/tests/test.py @@ -38,6 +38,7 @@ from test_table import table_clicked from test_toolbar import toolbar_clicked from test_tooltip import tooltip_clicked from test_web import web_clicked +from test_win import window_states_clicked #----- Main -{{{- def destroy(obj, str1, str2, str3, str4): @@ -174,6 +175,7 @@ if __name__ == "__main__": ("Bg Plain", bg_plain_clicked), ("Bg Image", bg_image_clicked), ("InnerWindow", inner_window_clicked), + ("Window States", window_states_clicked), ]) ] diff --git a/tests/test_inwin.py b/tests/test_inwin.py index 55aa988..eb94c5b 100644 --- a/tests/test_inwin.py +++ b/tests/test_inwin.py @@ -16,7 +16,15 @@ def inner_window_clicked(obj): bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bg.show() + lb = elementary.Label(win) + lb.text_set("This is an \"inwin\" - a window in a<br/>" + "window. This is handy for quick popups<br/>" + "you want centered, taking over the window<br/>" + "until dismissed somehow. Unlike hovers they<br/>" + "don't hover over their target.") + iw = elementary.InnerWindow(win) + iw.content_set(lb) iw.show() win.resize(320, 320) diff --git a/tests/test_win.py b/tests/test_win.py new file mode 100644 index 0000000..d3340c9 --- /dev/null +++ b/tests/test_win.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python +import os +import elementary +import edje +import ecore +import evas + +#----- Window -{{{- +def cb_alpha(bt, win, bg, on): + win.alpha = on + if on: + bg.hide() + else: + bg.show() + +def cb_rot(bt, win, ck, rot): + if ck.state: + win.rotation_with_resize_set(rot) + else: + win.rotation = rot + +def cb_win_moved(win): + print "MOVE - win geom:", win.geometry + +def window_states_clicked(obj): + win = elementary.Window("window-states", elementary.ELM_WIN_BASIC) + win.title = "Window States test" + win.autodel = True + win.callback_moved_add(cb_win_moved) + + bg = elementary.Background(win) + win.resize_object_add(bg) + bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) + bg.show() + + vbox = elementary.Box(win) + vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) + win.resize_object_add(vbox) + vbox.show() + + hbox = elementary.Box(win) + hbox.horizontal = True + hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0) + hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) + vbox.pack_end(hbox) + hbox.show() + + for state in [True, False]: + bt = elementary.Button(win) + bt.text = "Alpha " + ("On" if state else "Off") + bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0) + bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) + bt.callback_clicked_add(cb_alpha, win, bg, state) + hbox.pack_end(bt) + bt.show() + + sl = elementary.Slider(win) + sl.text = "Visual test" + sl.indicator_format = "%3.0f" + sl.min_max = (50, 150) + sl.value = 50 + sl.inverted = True + sl.size_hint_align = (0.5, evas.EVAS_HINT_FILL) + sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) + vbox.pack_end(sl) + sl.show() + + ck = elementary.Check(win) + ck.text = "Resize on rotate" + ck.size_hint_align = (0.0, 0.0) + vbox.pack_end(ck) + ck.show() + + hbox = elementary.Box(win) + hbox.horizontal = True + hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0) + hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) + vbox.pack_end(hbox) + hbox.show() + + for rot in [0, 90, 180, 270]: + bt = elementary.Button(win) + bt.text = "Rot " + str(rot) + bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0) + bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0) + bt.callback_clicked_add(cb_rot, win, ck, rot) + hbox.pack_end(bt) + bt.show() + + win.resize(280, 400) + win.show() +# }}} + +#----- Main -{{{- +if __name__ == "__main__": + elementary.init() + + window_states_clicked(None) + + elementary.run() + elementary.shutdown() +# }}} +# vim:foldmethod=marker |