davemds pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=9b50d34db39def6d8aee4b3f9639c74b93c2683e

commit 9b50d34db39def6d8aee4b3f9639c74b93c2683e
Author: Dave Andreoli <[email protected]>
Date:   Wed Dec 31 12:42:38 2014 +0100

    New test for standard icons
---
 examples/elementary/test.py      |  1 +
 examples/elementary/test_icon.py | 73 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index fbd5d6a..854f6a6 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -162,6 +162,7 @@ items = [
     ("Images", [
         ("Icon", "test_icon", "icon_clicked"),
         ("Icon Transparent", "test_icon", "icon_transparent_clicked"),
+        ("Icon Standard", "test_icon", "icon_standard_clicked"),
         ("Image", "test_image", "image_clicked"),
         ("Photo", "test_photo", "photo_clicked"),
         ("Photocam", "test_photocam", "photocam_clicked"),
diff --git a/examples/elementary/test_icon.py b/examples/elementary/test_icon.py
index 9ea7bd8..9e099b0 100644
--- a/examples/elementary/test_icon.py
+++ b/examples/elementary/test_icon.py
@@ -12,7 +12,11 @@ from efl.elementary.frame import Frame
 from efl.elementary.label import Label
 from efl.elementary.check import Check
 from efl.elementary.list import List
-from efl.elementary.icon import Icon
+from efl.elementary.icon import Icon, ELM_ICON_LOOKUP_FDO_THEME, \
+    ELM_ICON_LOOKUP_THEME_FDO, ELM_ICON_LOOKUP_THEME, ELM_ICON_LOOKUP_FDO
+from efl.elementary.radio import Radio
+from efl.elementary.theme import Theme
+
 
 EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
 EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
@@ -102,6 +106,70 @@ def icon_transparent_clicked(obj, item=None):
     win.show()
 
 
+def standard_list_populate(li, order):
+    li.clear()
+    for group in Theme(default=True).group_base_list_get("elm/icon"):
+        name = '/'.join(group.split('/')[2:-1])
+        if '-' in name or name == 'folder':
+            try:
+                ic = Icon(li, standard=name, order_lookup=order,
+                          size_hint_min=(32,32))
+            except:
+                ic = None
+            li.item_append(name, ic)
+    li.go()
+
+def icon_standard_clicked(obj, item=None):
+    win = StandardWindow("icon-standard", "Icon Standard",
+                         autodel=True, size=(300,400))
+    if obj is None:
+        win.callback_delete_request_add(lambda o: elementary.exit())
+    
+    vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
+    win.resize_object_add(vbox)
+    vbox.show()
+
+    fr = Frame(vbox, text="standard icon order lookup", 
size_hint_align=FILL_BOTH)
+    vbox.pack_end(fr)
+    fr.show()
+
+    hbox = Box(fr, horizontal=True)
+    fr.content = hbox
+    hbox.show()
+
+    li = List(vbox, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
+    vbox.pack_end(li)
+    li.show()
+
+    rdg = Radio(hbox, text="fdo, theme", state_value=ELM_ICON_LOOKUP_FDO_THEME)
+    rdg.callback_changed_add(lambda r: standard_list_populate(li, 
r.state_value))
+    hbox.pack_end(rdg)
+    rdg.show()
+
+    rd = Radio(hbox, text="theme, fdo", state_value=ELM_ICON_LOOKUP_THEME_FDO)
+    rd.group_add(rdg)
+    rd.callback_changed_add(lambda r: standard_list_populate(li, 
r.state_value))
+    hbox.pack_end(rd)
+    rd.show()
+
+    rd = Radio(hbox, text="fdo only", state_value=ELM_ICON_LOOKUP_FDO)
+    rd.group_add(rdg)
+    rd.callback_changed_add(lambda r: standard_list_populate(li, 
r.state_value))
+    hbox.pack_end(rd)
+    rd.show()
+
+    rd = Radio(hbox, text="theme only", state_value=ELM_ICON_LOOKUP_THEME)
+    rd.group_add(rdg)
+    rd.callback_changed_add(lambda r: standard_list_populate(li, 
r.state_value))
+    hbox.pack_end(rd)
+    rd.show()
+
+    rdg.value = ELM_ICON_LOOKUP_THEME_FDO
+    standard_list_populate(li, ELM_ICON_LOOKUP_THEME_FDO)
+
+    win.show()
+
+
 if __name__ == "__main__":
     elementary.init()
     win = StandardWindow("test", "python-elementary test application",
@@ -123,7 +191,8 @@ if __name__ == "__main__":
     fr.show()
 
     items = [("Icon", icon_clicked),
-             ("Icon transparent", icon_transparent_clicked)]
+             ("Icon transparent", icon_transparent_clicked),
+             ("Icon standard", icon_standard_clicked)]
 
     li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     box0.pack_end(li)

-- 


Reply via email to