kuuko pushed a commit to branch master.
commit 0ed61d0b6c9ccbc3add59fb70b7c24e9bb587e9e
Author: Kai Huuhko <[email protected]>
Date: Sun Apr 14 20:37:20 2013 +0000
Elementary: Add a simple test for floating objects.
---
examples/elementary/test.py | 4 +++
examples/elementary/test_floating.py | 65 ++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index d6890f3..39619f6 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -42,6 +42,7 @@ from test_fileselector import fileselector_clicked,
fileselector_button_clicked,
fileselector_entry_clicked
from test_flip import flip_clicked, flip_interactive_clicked
from test_flipselector import flipselector_clicked
+from test_floating import floating_clicked
from test_frame import frame_clicked
from test_gengrid import gengrid_clicked
from test_genlist import genlist_clicked, genlist2_clicked, genlist3_clicked,
genlist4_clicked, genlist5_clicked
@@ -163,6 +164,9 @@ items = [
("Genlist Iteration", genlist5_clicked),
("Gengrid", gengrid_clicked),
]),
+ ("Miscellaneous", [
+ ("Floating Objects", floating_clicked),
+ ]),
("Naviframe", [
("Naviframe", naviframe_clicked),
]),
diff --git a/examples/elementary/test_floating.py
b/examples/elementary/test_floating.py
new file mode 100644
index 0000000..3def0ea
--- /dev/null
+++ b/examples/elementary/test_floating.py
@@ -0,0 +1,65 @@
+from math import sin
+
+from efl import elementary
+from efl.elementary.window import StandardWindow
+from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass, \
+ ELM_GENLIST_ITEM_NONE
+from efl.elementary.icon import Icon
+from efl.ecore import Animator, loop_time_get
+from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \
+ EVAS_HINT_FILL
+
+class ItemClass(GenlistItemClass):
+ def text_get(self, obj, part, *args, **kwargs):
+ return "Item #{0}".format(args[0])
+
+ def content_get(self, obj, part, *args, **kwargs):
+ ic = Icon(obj)
+ ic.file = "images/logo_small.png"
+ ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
+ return ic
+
+def gl_sel_cb(obj, event_info, *args):
+ print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data,
obj, event_info))
+
+def anim(*args, **kwargs):
+ gl = args[0]
+ y = 0
+ x = (sin(loop_time_get()) * 500)
+ gl.move(x, y)
+
+ return True
+
+def del_cb(obj, *args, **kwargs):
+ ani = args[0]
+ ani.delete()
+
+def floating_clicked(obj):
+ win = StandardWindow("floating", "Floating")
+ win.autodel = True
+
+ gl = Genlist(win)
+ gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+ gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+ gl.move(800, 0)
+ gl.size = 480, 800
+ gl.show()
+
+ for i in range(20):
+ GenlistItem(ItemClass(), None, ELM_GENLIST_ITEM_NONE, gl_sel_cb,
i).append_to(gl)
+
+ win.size = 480, 800
+ win.show()
+
+ ani = Animator(anim, gl)
+ win.callback_delete_request_add(del_cb, ani)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+if __name__ == "__main__":
+ elementary.init()
+
+ floating_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
--
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter