aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary
diff options
context:
space:
mode:
authorDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
committerDavide Andreoli <dave@gurumeditation.it>2013-02-15 20:41:55 +0000
commitb58be93f121c2ca240b888d1dd41896d4779927f (patch)
tree371d4e331b3e685e106b211ce3e28b31e9886ada /examples/elementary
parentPython-EFL: Cleanup and enable compilation of emotion, cleaned also the test. (diff)
downloadpython-efl-b58be93f121c2ca240b888d1dd41896d4779927f.tar.gz
move elementary and emotion tests in a new examples dir. Now tests/ contain only unittest while examples/ all the other tests that need user interaction
SVN revision: 83964
Diffstat (limited to 'examples/elementary')
-rw-r--r--examples/elementary/cursors.edjbin0 -> 7000 bytes
-rw-r--r--examples/elementary/images/clo.pngbin0 -> 120231 bytes
-rw-r--r--examples/elementary/images/icon_00.pngbin0 -> 9793 bytes
-rw-r--r--examples/elementary/images/icon_01.pngbin0 -> 11371 bytes
-rw-r--r--examples/elementary/images/icon_02.pngbin0 -> 12432 bytes
-rw-r--r--examples/elementary/images/icon_03.pngbin0 -> 15014 bytes
-rw-r--r--examples/elementary/images/icon_04.pngbin0 -> 7912 bytes
-rw-r--r--examples/elementary/images/icon_05.pngbin0 -> 1483 bytes
-rw-r--r--examples/elementary/images/icon_06.pngbin0 -> 4977 bytes
-rw-r--r--examples/elementary/images/icon_07.pngbin0 -> 2548 bytes
-rw-r--r--examples/elementary/images/icon_08.pngbin0 -> 4861 bytes
-rw-r--r--examples/elementary/images/icon_09.pngbin0 -> 7774 bytes
-rw-r--r--examples/elementary/images/icon_10.pngbin0 -> 4745 bytes
-rw-r--r--examples/elementary/images/icon_11.pngbin0 -> 8684 bytes
-rw-r--r--examples/elementary/images/icon_12.pngbin0 -> 3018 bytes
-rw-r--r--examples/elementary/images/icon_13.pngbin0 -> 5051 bytes
-rw-r--r--examples/elementary/images/icon_14.pngbin0 -> 8448 bytes
-rw-r--r--examples/elementary/images/icon_15.pngbin0 -> 8706 bytes
-rw-r--r--examples/elementary/images/icon_16.pngbin0 -> 11758 bytes
-rw-r--r--examples/elementary/images/icon_17.pngbin0 -> 13769 bytes
-rw-r--r--examples/elementary/images/icon_18.pngbin0 -> 6079 bytes
-rw-r--r--examples/elementary/images/icon_19.pngbin0 -> 11785 bytes
-rw-r--r--examples/elementary/images/icon_20.pngbin0 -> 8278 bytes
-rw-r--r--examples/elementary/images/icon_21.pngbin0 -> 14661 bytes
-rw-r--r--examples/elementary/images/icon_22.pngbin0 -> 12215 bytes
-rw-r--r--examples/elementary/images/icon_23.pngbin0 -> 10078 bytes
-rw-r--r--examples/elementary/images/icon_right_arrow.pngbin0 -> 1832 bytes
-rw-r--r--examples/elementary/images/insanely_huge_test_image.jpgbin0 -> 1260785 bytes
-rw-r--r--examples/elementary/images/logo.pngbin0 -> 81162 bytes
-rw-r--r--examples/elementary/images/logo_small.pngbin0 -> 5655 bytes
-rw-r--r--examples/elementary/images/mystrale.jpgbin0 -> 74115 bytes
-rw-r--r--examples/elementary/images/mystrale_2.jpgbin0 -> 355595 bytes
-rw-r--r--examples/elementary/images/panel_01.jpgbin0 -> 63544 bytes
-rw-r--r--examples/elementary/images/plant_01.jpgbin0 -> 165867 bytes
-rw-r--r--examples/elementary/images/rock_01.jpgbin0 -> 330094 bytes
-rw-r--r--examples/elementary/images/rock_02.jpgbin0 -> 285555 bytes
-rw-r--r--examples/elementary/images/sky.jpgbin0 -> 69378 bytes
-rw-r--r--examples/elementary/images/sky_01.jpgbin0 -> 134813 bytes
-rw-r--r--examples/elementary/images/sky_02.jpgbin0 -> 31413 bytes
-rw-r--r--examples/elementary/images/sky_03.jpgbin0 -> 73364 bytes
-rw-r--r--examples/elementary/images/sky_04.jpgbin0 -> 25078 bytes
-rw-r--r--examples/elementary/images/under.pngbin0 -> 36742 bytes
-rw-r--r--examples/elementary/images/wood_01.jpgbin0 -> 96136 bytes
-rw-r--r--examples/elementary/test.edjbin0 -> 201415 bytes
-rw-r--r--examples/elementary/test.py330
-rw-r--r--examples/elementary/test_3d.py263
-rw-r--r--examples/elementary/test_actionslider.py176
-rw-r--r--examples/elementary/test_bg.py94
-rw-r--r--examples/elementary/test_box.py330
-rw-r--r--examples/elementary/test_bubble.py151
-rw-r--r--examples/elementary/test_button.py70
-rw-r--r--examples/elementary/test_calendar.py278
-rw-r--r--examples/elementary/test_check.py107
-rw-r--r--examples/elementary/test_clock.py74
-rw-r--r--examples/elementary/test_colorselector.py134
-rw-r--r--examples/elementary/test_config.py21
-rw-r--r--examples/elementary/test_core_evas_canvas_callbacks.py84
-rw-r--r--examples/elementary/test_core_evas_object_callbacks.py168
-rw-r--r--examples/elementary/test_core_evas_objects.py59
-rw-r--r--examples/elementary/test_ctxpopup.py182
-rw-r--r--examples/elementary/test_cursor.py258
-rw-r--r--examples/elementary/test_datetime.py69
-rw-r--r--examples/elementary/test_dayselector.py84
-rw-r--r--examples/elementary/test_diskselector.py130
-rw-r--r--examples/elementary/test_entry.py228
-rw-r--r--examples/elementary/test_external.edjbin0 -> 416327 bytes
-rw-r--r--examples/elementary/test_external.py180
-rw-r--r--examples/elementary/test_fileselector.py340
-rw-r--r--examples/elementary/test_flip.py300
-rw-r--r--examples/elementary/test_flipselector.py136
-rw-r--r--examples/elementary/test_frame.py60
-rw-r--r--examples/elementary/test_gengrid.py394
-rw-r--r--examples/elementary/test_genlist.py443
-rw-r--r--examples/elementary/test_grid.py104
-rw-r--r--examples/elementary/test_hover.py217
-rw-r--r--examples/elementary/test_hoversel.py112
-rw-r--r--examples/elementary/test_icon.py179
-rw-r--r--examples/elementary/test_index.py119
-rw-r--r--examples/elementary/test_inwin.py41
-rw-r--r--examples/elementary/test_label.py169
-rw-r--r--examples/elementary/test_layout.py56
-rw-r--r--examples/elementary/test_list.py381
-rw-r--r--examples/elementary/test_map.py172
-rw-r--r--examples/elementary/test_map2.py216
-rw-r--r--examples/elementary/test_map3.py260
-rw-r--r--examples/elementary/test_mapbuf.py190
-rw-r--r--examples/elementary/test_menu.py100
-rw-r--r--examples/elementary/test_multibuttonentry.py173
-rw-r--r--examples/elementary/test_naviframe.py143
-rw-r--r--examples/elementary/test_notify.py118
-rw-r--r--examples/elementary/test_panel.py52
-rw-r--r--examples/elementary/test_panes.py66
-rw-r--r--examples/elementary/test_photo.py75
-rw-r--r--examples/elementary/test_popup.py239
-rw-r--r--examples/elementary/test_progressbar.py182
-rw-r--r--examples/elementary/test_radio.py100
-rw-r--r--examples/elementary/test_scroller.py135
-rw-r--r--examples/elementary/test_segment_control.py112
-rw-r--r--examples/elementary/test_separator.py81
-rw-r--r--examples/elementary/test_slideshow.py175
-rw-r--r--examples/elementary/test_spinner.py64
-rw-r--r--examples/elementary/test_table.py76
-rw-r--r--examples/elementary/test_thumb.py65
-rw-r--r--examples/elementary/test_toolbar.py122
-rw-r--r--examples/elementary/test_tooltip.py230
-rw-r--r--examples/elementary/test_video.py77
-rw-r--r--examples/elementary/test_web.py124
-rw-r--r--examples/elementary/test_win.py102
108 files changed, 9970 insertions, 0 deletions
diff --git a/examples/elementary/cursors.edj b/examples/elementary/cursors.edj
new file mode 100644
index 0000000..b7d23eb
--- /dev/null
+++ b/examples/elementary/cursors.edj
Binary files differ
diff --git a/examples/elementary/images/clo.png b/examples/elementary/images/clo.png
new file mode 100644
index 0000000..dedfc51
--- /dev/null
+++ b/examples/elementary/images/clo.png
Binary files differ
diff --git a/examples/elementary/images/icon_00.png b/examples/elementary/images/icon_00.png
new file mode 100644
index 0000000..d026778
--- /dev/null
+++ b/examples/elementary/images/icon_00.png
Binary files differ
diff --git a/examples/elementary/images/icon_01.png b/examples/elementary/images/icon_01.png
new file mode 100644
index 0000000..faf524c
--- /dev/null
+++ b/examples/elementary/images/icon_01.png
Binary files differ
diff --git a/examples/elementary/images/icon_02.png b/examples/elementary/images/icon_02.png
new file mode 100644
index 0000000..592cb5a
--- /dev/null
+++ b/examples/elementary/images/icon_02.png
Binary files differ
diff --git a/examples/elementary/images/icon_03.png b/examples/elementary/images/icon_03.png
new file mode 100644
index 0000000..3d3063b
--- /dev/null
+++ b/examples/elementary/images/icon_03.png
Binary files differ
diff --git a/examples/elementary/images/icon_04.png b/examples/elementary/images/icon_04.png
new file mode 100644
index 0000000..454bd62
--- /dev/null
+++ b/examples/elementary/images/icon_04.png
Binary files differ
diff --git a/examples/elementary/images/icon_05.png b/examples/elementary/images/icon_05.png
new file mode 100644
index 0000000..bb81792
--- /dev/null
+++ b/examples/elementary/images/icon_05.png
Binary files differ
diff --git a/examples/elementary/images/icon_06.png b/examples/elementary/images/icon_06.png
new file mode 100644
index 0000000..7f72520
--- /dev/null
+++ b/examples/elementary/images/icon_06.png
Binary files differ
diff --git a/examples/elementary/images/icon_07.png b/examples/elementary/images/icon_07.png
new file mode 100644
index 0000000..1c76beb
--- /dev/null
+++ b/examples/elementary/images/icon_07.png
Binary files differ
diff --git a/examples/elementary/images/icon_08.png b/examples/elementary/images/icon_08.png
new file mode 100644
index 0000000..c8fc8d2
--- /dev/null
+++ b/examples/elementary/images/icon_08.png
Binary files differ
diff --git a/examples/elementary/images/icon_09.png b/examples/elementary/images/icon_09.png
new file mode 100644
index 0000000..f321617
--- /dev/null
+++ b/examples/elementary/images/icon_09.png
Binary files differ
diff --git a/examples/elementary/images/icon_10.png b/examples/elementary/images/icon_10.png
new file mode 100644
index 0000000..c72918b
--- /dev/null
+++ b/examples/elementary/images/icon_10.png
Binary files differ
diff --git a/examples/elementary/images/icon_11.png b/examples/elementary/images/icon_11.png
new file mode 100644
index 0000000..cdb212e
--- /dev/null
+++ b/examples/elementary/images/icon_11.png
Binary files differ
diff --git a/examples/elementary/images/icon_12.png b/examples/elementary/images/icon_12.png
new file mode 100644
index 0000000..1954b9b
--- /dev/null
+++ b/examples/elementary/images/icon_12.png
Binary files differ
diff --git a/examples/elementary/images/icon_13.png b/examples/elementary/images/icon_13.png
new file mode 100644
index 0000000..27d964e
--- /dev/null
+++ b/examples/elementary/images/icon_13.png
Binary files differ
diff --git a/examples/elementary/images/icon_14.png b/examples/elementary/images/icon_14.png
new file mode 100644
index 0000000..2434b05
--- /dev/null
+++ b/examples/elementary/images/icon_14.png
Binary files differ
diff --git a/examples/elementary/images/icon_15.png b/examples/elementary/images/icon_15.png
new file mode 100644
index 0000000..8ab20ce
--- /dev/null
+++ b/examples/elementary/images/icon_15.png
Binary files differ
diff --git a/examples/elementary/images/icon_16.png b/examples/elementary/images/icon_16.png
new file mode 100644
index 0000000..7f5ad1e
--- /dev/null
+++ b/examples/elementary/images/icon_16.png
Binary files differ
diff --git a/examples/elementary/images/icon_17.png b/examples/elementary/images/icon_17.png
new file mode 100644
index 0000000..6afaf7a
--- /dev/null
+++ b/examples/elementary/images/icon_17.png
Binary files differ
diff --git a/examples/elementary/images/icon_18.png b/examples/elementary/images/icon_18.png
new file mode 100644
index 0000000..74eb0d6
--- /dev/null
+++ b/examples/elementary/images/icon_18.png
Binary files differ
diff --git a/examples/elementary/images/icon_19.png b/examples/elementary/images/icon_19.png
new file mode 100644
index 0000000..d8784e0
--- /dev/null
+++ b/examples/elementary/images/icon_19.png
Binary files differ
diff --git a/examples/elementary/images/icon_20.png b/examples/elementary/images/icon_20.png
new file mode 100644
index 0000000..69a9dca
--- /dev/null
+++ b/examples/elementary/images/icon_20.png
Binary files differ
diff --git a/examples/elementary/images/icon_21.png b/examples/elementary/images/icon_21.png
new file mode 100644
index 0000000..6561e5f
--- /dev/null
+++ b/examples/elementary/images/icon_21.png
Binary files differ
diff --git a/examples/elementary/images/icon_22.png b/examples/elementary/images/icon_22.png
new file mode 100644
index 0000000..d6130e8
--- /dev/null
+++ b/examples/elementary/images/icon_22.png
Binary files differ
diff --git a/examples/elementary/images/icon_23.png b/examples/elementary/images/icon_23.png
new file mode 100644
index 0000000..27f5457
--- /dev/null
+++ b/examples/elementary/images/icon_23.png
Binary files differ
diff --git a/examples/elementary/images/icon_right_arrow.png b/examples/elementary/images/icon_right_arrow.png
new file mode 100644
index 0000000..6bbb2c6
--- /dev/null
+++ b/examples/elementary/images/icon_right_arrow.png
Binary files differ
diff --git a/examples/elementary/images/insanely_huge_test_image.jpg b/examples/elementary/images/insanely_huge_test_image.jpg
new file mode 100644
index 0000000..e5789df
--- /dev/null
+++ b/examples/elementary/images/insanely_huge_test_image.jpg
Binary files differ
diff --git a/examples/elementary/images/logo.png b/examples/elementary/images/logo.png
new file mode 100644
index 0000000..ee0446f
--- /dev/null
+++ b/examples/elementary/images/logo.png
Binary files differ
diff --git a/examples/elementary/images/logo_small.png b/examples/elementary/images/logo_small.png
new file mode 100644
index 0000000..c7dc665
--- /dev/null
+++ b/examples/elementary/images/logo_small.png
Binary files differ
diff --git a/examples/elementary/images/mystrale.jpg b/examples/elementary/images/mystrale.jpg
new file mode 100644
index 0000000..31edf4a
--- /dev/null
+++ b/examples/elementary/images/mystrale.jpg
Binary files differ
diff --git a/examples/elementary/images/mystrale_2.jpg b/examples/elementary/images/mystrale_2.jpg
new file mode 100644
index 0000000..88d86d6
--- /dev/null
+++ b/examples/elementary/images/mystrale_2.jpg
Binary files differ
diff --git a/examples/elementary/images/panel_01.jpg b/examples/elementary/images/panel_01.jpg
new file mode 100644
index 0000000..46fbdb9
--- /dev/null
+++ b/examples/elementary/images/panel_01.jpg
Binary files differ
diff --git a/examples/elementary/images/plant_01.jpg b/examples/elementary/images/plant_01.jpg
new file mode 100644
index 0000000..f1714dd
--- /dev/null
+++ b/examples/elementary/images/plant_01.jpg
Binary files differ
diff --git a/examples/elementary/images/rock_01.jpg b/examples/elementary/images/rock_01.jpg
new file mode 100644
index 0000000..c50ccb3
--- /dev/null
+++ b/examples/elementary/images/rock_01.jpg
Binary files differ
diff --git a/examples/elementary/images/rock_02.jpg b/examples/elementary/images/rock_02.jpg
new file mode 100644
index 0000000..04aea8a
--- /dev/null
+++ b/examples/elementary/images/rock_02.jpg
Binary files differ
diff --git a/examples/elementary/images/sky.jpg b/examples/elementary/images/sky.jpg
new file mode 100644
index 0000000..6132e7c
--- /dev/null
+++ b/examples/elementary/images/sky.jpg
Binary files differ
diff --git a/examples/elementary/images/sky_01.jpg b/examples/elementary/images/sky_01.jpg
new file mode 100644
index 0000000..22f3050
--- /dev/null
+++ b/examples/elementary/images/sky_01.jpg
Binary files differ
diff --git a/examples/elementary/images/sky_02.jpg b/examples/elementary/images/sky_02.jpg
new file mode 100644
index 0000000..d0d7448
--- /dev/null
+++ b/examples/elementary/images/sky_02.jpg
Binary files differ
diff --git a/examples/elementary/images/sky_03.jpg b/examples/elementary/images/sky_03.jpg
new file mode 100644
index 0000000..cbad02a
--- /dev/null
+++ b/examples/elementary/images/sky_03.jpg
Binary files differ
diff --git a/examples/elementary/images/sky_04.jpg b/examples/elementary/images/sky_04.jpg
new file mode 100644
index 0000000..c5cbc18
--- /dev/null
+++ b/examples/elementary/images/sky_04.jpg
Binary files differ
diff --git a/examples/elementary/images/under.png b/examples/elementary/images/under.png
new file mode 100644
index 0000000..91cb3fb
--- /dev/null
+++ b/examples/elementary/images/under.png
Binary files differ
diff --git a/examples/elementary/images/wood_01.jpg b/examples/elementary/images/wood_01.jpg
new file mode 100644
index 0000000..89f1006
--- /dev/null
+++ b/examples/elementary/images/wood_01.jpg
Binary files differ
diff --git a/examples/elementary/test.edj b/examples/elementary/test.edj
new file mode 100644
index 0000000..43b0874
--- /dev/null
+++ b/examples/elementary/test.edj
Binary files differ
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
new file mode 100644
index 0000000..168d557
--- /dev/null
+++ b/examples/elementary/test.py
@@ -0,0 +1,330 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os
+from efl import elementary
+from efl import evas
+
+from test_3d import evas3d_clicked
+from test_actionslider import actionslider_clicked
+from test_bg import bg_plain_clicked, bg_image_clicked
+from test_box import box_vert_clicked, box_vert2_clicked, box_horiz_clicked
+from test_box import box_layout_clicked, box_transition_clicked
+from test_bubble import bubble_clicked
+from test_button import buttons_clicked
+from test_calendar import calendar_clicked
+from test_check import check_clicked
+from test_clock import clock_clicked
+from test_colorselector import colorselector_clicked
+from test_core_evas_object_callbacks import core_evas_object_callbacks_clicked
+from test_core_evas_canvas_callbacks import core_evas_canvas_callbacks_clicked
+from test_core_evas_objects import core_evas_objects_clicked
+from test_ctxpopup import ctxpopup_clicked
+from test_cursor import cursor_clicked, cursor2_clicked, cursor3_clicked
+from test_datetime import datetime_clicked
+from test_dayselector import dayselector_clicked
+from test_diskselector import diskselector_clicked
+from test_entry import entry_clicked, entry_scrolled_clicked, entry_anchor_clicked
+from test_external import edje_external_button_clicked, edje_external_pbar_clicked, \
+ edje_external_scroller_clicked, edje_external_slider_clicked, edje_external_video_clicked
+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_frame import frame_clicked
+from test_gengrid import gengrid_clicked
+from test_genlist import genlist_clicked, genlist2_clicked, genlist3_clicked
+from test_grid import grid_clicked
+from test_hover import hover_clicked, hover2_clicked
+from test_hoversel import hoversel_clicked
+from test_icon import icon_clicked, icon_transparent_clicked
+from test_index import index_clicked
+from test_inwin import inner_window_clicked
+from test_label import label_clicked
+from test_layout import layout_clicked
+from test_list import list_clicked, list2_clicked, list3_clicked
+from test_mapbuf import mapbuf_clicked
+from test_map import map_clicked
+from test_map2 import map_overlays_clicked
+from test_map3 import map_route_clicked
+from test_menu import menu_clicked
+from test_multibuttonentry import multibuttonentry_clicked
+from test_naviframe import naviframe_clicked
+from test_notify import notify_clicked
+from test_panel import panel_clicked
+from test_panes import panes_clicked
+from test_photo import photo_clicked
+from test_popup import popup_clicked
+from test_progressbar import progressbar_clicked
+from test_radio import radio_clicked
+from test_scroller import scroller_clicked
+from test_segment_control import segment_control_clicked
+from test_separator import separator_clicked
+from test_slideshow import slideshow_clicked
+from test_spinner import spinner_clicked
+from test_table import table_clicked
+from test_thumb import thumb_clicked
+from test_toolbar import toolbar_clicked
+from test_tooltip import tooltip_clicked
+from test_video import video_clicked
+from test_web import web_clicked
+from test_win import window_states_clicked
+
+
+items = [
+ ("Core Libs", [
+ ("Evas Objects", core_evas_objects_clicked),
+ ("Evas Canvas Callbacks", core_evas_canvas_callbacks_clicked),
+ ("Evas Object Callbacks", core_evas_object_callbacks_clicked),
+ ]),
+ ("3D", [
+ ("Evas Map 3D", evas3d_clicked),
+ ]),
+ ("Booleans", [
+ ("Checks", check_clicked),
+ # ("Toggles", toggles_clicked),TODO make a toggle with check
+ ]),
+ ("Boundaries", [
+ ("Bubble", bubble_clicked),
+ ("Separator", separator_clicked),
+ ]),
+ ("Buttons", [
+ ("Buttons", buttons_clicked),
+ ]),
+ ("Containers", [
+ ("Box Horiz", box_horiz_clicked),
+ ("Box Vert", box_vert_clicked),
+ ("Box Vert2", box_vert2_clicked),
+ ("Box Layout", box_layout_clicked),
+ ("Box Layout Transition", box_transition_clicked),
+ ("Table", table_clicked),
+ ("Layout", layout_clicked),
+ ("Grid", grid_clicked),
+ ("Frame", frame_clicked),
+ ]),
+ ("Cursors", [
+ ("Cursor", cursor_clicked),
+ ("Cursor2", cursor2_clicked),
+ ("Cursor3", cursor3_clicked),
+ ]),
+ ("Dividers", [
+ ("Panel", panel_clicked),
+ ("Panes", panes_clicked),
+ ]),
+ ("Effects", [
+ ("Flip", flip_clicked),
+ ("Flip Interactive", flip_interactive_clicked),
+ ]),
+ ("Entries", [
+ ("Entry", entry_clicked),
+ ("Entry Scrolled", entry_scrolled_clicked),
+ ("Entry Anchor", entry_anchor_clicked),
+ ("MultiButtonEntry", multibuttonentry_clicked),
+ ]),
+ ("Edje External", [
+ ("Ext Button", edje_external_button_clicked),
+ ("Ext ProgressBar", edje_external_pbar_clicked),
+ ("Ext Scroller", edje_external_scroller_clicked),
+ ("Ext Slider", edje_external_slider_clicked),
+ ("Ext Video", edje_external_video_clicked),
+ ]),
+ ("Geographic", [
+ ("Map", map_clicked),
+ ("Map Overlay", map_overlays_clicked),
+ ("Map Route", map_route_clicked),
+ ]),
+ ("Images", [
+ ("Icon", icon_clicked),
+ ("Icon Transparent", icon_transparent_clicked),
+ ("Photo", photo_clicked),
+ ("Slideshow", slideshow_clicked),
+ ("Thumb", thumb_clicked),
+ ("Video", video_clicked),
+ ]),
+ ("Lists", [
+ ("List", list_clicked),
+ ("List 2", list2_clicked),
+ ("List 3", list3_clicked),
+ ("Genlist", genlist_clicked),
+ ("Genlist 2", genlist2_clicked),
+ ("Genlist Group", genlist3_clicked),
+ ("Gengrid", gengrid_clicked),
+ ]),
+ ("Naviframe", [
+ ("Naviframe", naviframe_clicked),
+ ]),
+ ("Popups", [
+ ("Hover", hover_clicked),
+ ("Hover 2", hover2_clicked),
+ ("Notify", notify_clicked),
+ ("Tooltip", tooltip_clicked),
+ ("Ctxpopup", ctxpopup_clicked),
+ ("Popup", popup_clicked),
+ ]),
+ ("Range Values", [
+ ("Spinner", spinner_clicked),
+ ("Progressbar", progressbar_clicked),
+ ]),
+ ("Scroller", [
+ ("Scroller", scroller_clicked),
+ ]),
+ ("Selectors", [
+ ("Action Slider", actionslider_clicked),
+ ("Color Selector", colorselector_clicked),
+ ("Day Selector", dayselector_clicked),
+ ("Disk Selector", diskselector_clicked),
+ ("Flip Selector", flipselector_clicked),
+ ("File Selector", fileselector_clicked),
+ ("Fileselector button", fileselector_button_clicked),
+ ("Fileselector entry", fileselector_entry_clicked),
+ ("Hoversel", hoversel_clicked),
+ ("Index", index_clicked),
+ ("Menu", menu_clicked),
+ ("Radios", radio_clicked),
+ ("Segment Control", segment_control_clicked),
+ ]),
+ ("Stored Surface Buffer", [
+ ("Launcher", mapbuf_clicked),
+ ]),
+ ("Text", [
+ ("Label", label_clicked),
+ ]),
+ ("Times & Dates", [
+ ("Calendar", calendar_clicked),
+ ("Clock", clock_clicked),
+ ("Datetime", datetime_clicked),
+ ]),
+ ("Toolbars", [
+ ("Toolbar", toolbar_clicked),
+ ]),
+ ("Web", [
+ ("Web", web_clicked),
+ ]),
+ ("Window / Background", [
+ ("Bg Plain", bg_plain_clicked),
+ ("Bg Image", bg_image_clicked),
+ ("InnerWindow", inner_window_clicked),
+ ("Window States", window_states_clicked),
+ ])
+ ]
+
+
+def menu_create(search, win):
+ tbx.clear()
+ for category in items:
+ frame = elementary.Frame(win)
+ frame.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ frame.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ frame.text = category[0]
+ frame.show()
+ tbx.pack_end(frame)
+
+ tbx2 = elementary.Box(win)
+ tbx2.layout_set(elementary.ELM_BOX_LAYOUT_FLOW_HORIZONTAL)
+ tbx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ tbx2.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ frame.content_set(tbx2)
+ tbx2.show()
+
+ cnt = 0
+ for test in category[1]:
+ if (search == None) or (test[0].lower().find(search.lower()) > -1):
+ bt = elementary.Button(win)
+ bt.text = test[0]
+ bt.callback_clicked_add(test[1])
+ bt.show()
+ tbx2.pack_end(bt)
+ cnt += 1
+
+ if cnt < 1:
+ frame.delete()
+
+def destroy(obj, str1, str2, str3, str4):
+ print("DEBUG: window destroy callback called!")
+ print(("DEBUG: str1='%s', str2='%s', str3='%s', str4='%s'" %(str1, str2,
+ str3, str4)))
+ elementary.exit()
+
+def cb_mirroring(toggle):
+ elementary.Configuration().mirrored = toggle.state
+
+def cb_filter(en, win):
+ menu_create(en.text_get(), win)
+
+if __name__ == "__main__":
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy, "test1", "test2", str3="test3", str4="test4")
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ tg = elementary.Check(win)
+ tg.style = "toggle"
+ tg.text = "UI-Mirroring:"
+ tg.callback_changed_add(cb_mirroring)
+ box0.pack_end(tg)
+ tg.show()
+
+ bx1 = elementary.Box(win)
+ bx1.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx1.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ bx1.horizontal_set(True)
+ box0.pack_end(bx1)
+ bx1.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Filter:")
+ bx1.pack_end(lb)
+ lb.show()
+
+ en = elementary.Entry(win)
+ en.single_line_set(True)
+ en.scrollable_set(True)
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ en.callback_changed_add(cb_filter, win)
+ bx1.pack_end(en)
+ en.show()
+ en.focus_set(True)
+
+ sc = elementary.Scroller(win)
+ sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sc.bounce_set(False, True)
+ sc.show()
+ box0.pack_end(sc)
+
+ tbx = elementary.Box(win)
+ tbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ tbx.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ sc.content_set(tbx)
+ tbx.show()
+
+ menu_create(None, win)
+
+ win.resize(320, 480)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_3d.py b/examples/elementary/test_3d.py
new file mode 100644
index 0000000..ff2e224
--- /dev/null
+++ b/examples/elementary/test_3d.py
@@ -0,0 +1,263 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+class Point(object):
+ def __init__(self, x, y, z, u, v):
+ self.x = x
+ self.y = y
+ self.z = z
+ self.u = u
+ self.v = v
+
+
+class Side(object):
+ def __init__(self, eva):
+ self.obj = None
+ self.points = []
+
+ img = evas.Image(eva)
+ img.file_set("images/rock_02.jpg")
+ img.fill_set(0, 0, 256, 256)
+ img.resize(256, 256)
+ img.smooth_scale_set(False)
+ img.show()
+ self.obj = img
+
+
+class Cube(object):
+ def __init__(self, win, w, h, d):
+ self.win = win
+ self.sides = []
+
+ self.rotx = 0.0
+ self.roty = 0.0
+ self.rotz = 0.0
+ self.cxo = 0.0
+ self.cyo = 0.0
+ self.focv = 256.0
+ self.z0v = 0.0
+
+ for i in range(6):
+ self.sides.append(Side(win.evas_get()))
+
+ w -= (w / 2)
+ h -= (h / 2)
+ d -= (d / 2)
+
+ self.sides[0].points.append(Point(-w, -h, -d, 0, 0))
+ self.sides[0].points.append(Point( w, -h, -d, 256, 0))
+ self.sides[0].points.append(Point( w, h, -d, 256, 256))
+ self.sides[0].points.append(Point(-w, h, -d, 0, 256))
+
+ self.sides[1].points.append(Point( w, -h, -d, 0, 0))
+ self.sides[1].points.append(Point( w, -h, d, 256, 0))
+ self.sides[1].points.append(Point( w, h, d, 256, 256))
+ self.sides[1].points.append(Point( w, h, -d, 0, 256))
+
+ self.sides[2].points.append(Point( w, -h, d, 0, 0))
+ self.sides[2].points.append(Point(-w, -h, d, 256, 0))
+ self.sides[2].points.append(Point(-w, h, d, 256, 256))
+ self.sides[2].points.append(Point( w, h, d, 0, 256))
+
+ self.sides[3].points.append(Point(-w, -h, d, 0, 0))
+ self.sides[3].points.append(Point(-w, -h, -d, 256, 0))
+ self.sides[3].points.append(Point(-w, h, -d, 256, 256))
+ self.sides[3].points.append(Point(-w, h, d, 0, 256))
+
+ self.sides[4].points.append(Point(-w, -h, d, 0, 0))
+ self.sides[4].points.append(Point( w, -h, d, 256, 0))
+ self.sides[4].points.append(Point( w, -h, -d, 256, 256))
+ self.sides[4].points.append(Point(-w, -h, -d, 0, 256))
+
+ self.sides[5].points.append(Point(-w, h, -d, 0, 0))
+ self.sides[5].points.append(Point( w, h, -d, 256, 0))
+ self.sides[5].points.append(Point( w, h, d, 256, 256))
+ self.sides[5].points.append(Point(-w, h, d, 0, 256))
+
+ def update(self):
+ (x, y, w, h) = self.win.geometry
+
+ x = w / 2
+ y = h / 2
+ z = 512
+ dx = self.rotx
+ dy = self.roty
+ dz = self.rotz
+ cx = (w / 2) + self.cxo
+ cy = (h / 2) + self.cyo
+ foc = self.z0v
+ z0 = self.focv
+
+ m = evas.Map(4)
+ m.smooth = True
+
+ for i in range(6):
+ for j in range(4):
+ m.point_coord_set(j, self.sides[i].points[j].x + x,
+ self.sides[i].points[j].y + y,
+ self.sides[i].points[j].z + z)
+ m.point_image_uv_set(j, self.sides[i].points[j].u,
+ self.sides[i].points[j].v)
+ m.point_color_set(j, 255, 255, 255, 255)
+
+ m.util_3d_rotate(dx, dy, dz, x, y, z)
+ m.util_3d_lighting(-1000, -1000, -1000,
+ 255, 255, 255,
+ 20, 20, 20)
+ m.util_3d_perspective(cx, cy, foc, z0)
+
+ if m.util_clockwise:
+ self.sides[i].obj.map_enabled = True
+ self.sides[i].obj.map = m
+ self.sides[i].obj.show()
+ else:
+ self.sides[i].obj.hide()
+
+ m.delete()
+
+
+def ch_rot_x(sl, cube):
+ cube.rotx = sl.value
+ cube.update()
+
+def ch_rot_y(sl, cube):
+ cube.roty = sl.value
+ cube.update()
+
+def ch_rot_z(sl, cube):
+ cube.rotz = sl.value
+ cube.update()
+
+def ch_cx(sl, cube):
+ cube.cxo = sl.value
+ cube.update()
+
+def ch_cy(sl, cube):
+ cube.cyo = sl.value
+ cube.update()
+
+def ch_foc(sl, cube):
+ cube.focv = sl.value
+ cube.update()
+
+def ch_z0(sl, cube):
+ cube.z0v = sl.value
+ cube.update()
+
+def evas3d_clicked(obj, item=None):
+ win = elementary.Window("evas3d", elementary.ELM_WIN_BASIC)
+ win.title_set("Evas 3d test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ cube = Cube(win, 240, 240, 240)
+
+ vbox = elementary.Box(win)
+ vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Rot X"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (0, 360)
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_rot_x, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Rot Y"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (0, 360)
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_rot_y, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Rot Z"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (0, 360)
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_rot_z, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "CX Off"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (-320, 320)
+ sl.value = cube.cxo
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_cx, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "CY Off"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (-320, 320)
+ sl.value = cube.cyo
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_cy, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Foc"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (1, 2000)
+ sl.value = cube.focv
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_foc, cube)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Z0"
+ sl.unit_format = "%1.0f units"
+ sl.span_size = 360
+ sl.min_max = (-2000, 2000)
+ sl.value = cube.z0v
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sl)
+ sl.callback_changed_add(ch_z0, cube)
+ sl.show()
+
+ win.resize(480, 480)
+ cube.update()
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ evas3d_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_actionslider.py b/examples/elementary/test_actionslider.py
new file mode 100644
index 0000000..bc40e8d
--- /dev/null
+++ b/examples/elementary/test_actionslider.py
@@ -0,0 +1,176 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+def _pos_selected_cb(obj, event_info):
+ print(("Selection: %s" % (event_info)))
+ print(("Label selected: %s" % (obj.selected_label_get())))
+
+ ipos = obj.indicator_pos_get()
+ print("actionslider indicator pos: ")
+ if ipos == elementary.ELM_ACTIONSLIDER_NONE:
+ print("none!")
+ elif ipos == elementary.ELM_ACTIONSLIDER_ALL:
+ print("all!")
+ else:
+ if (ipos & elementary.ELM_ACTIONSLIDER_LEFT):
+ print("left ")
+ if (ipos & elementary.ELM_ACTIONSLIDER_CENTER):
+ print("center ")
+ if (ipos & elementary.ELM_ACTIONSLIDER_RIGHT):
+ print("right ")
+ print("")
+
+ mpos = obj.magnet_pos_get()
+ print("actionslider magnet pos: ")
+ if mpos == elementary.ELM_ACTIONSLIDER_NONE:
+ print("none!")
+ elif mpos == elementary.ELM_ACTIONSLIDER_ALL:
+ print("all!")
+ else:
+ if (mpos & elementary.ELM_ACTIONSLIDER_LEFT):
+ print("left ")
+ if (mpos & elementary.ELM_ACTIONSLIDER_CENTER):
+ print("center ")
+ if (mpos & elementary.ELM_ACTIONSLIDER_RIGHT):
+ print("right ")
+ print("")
+
+ epos = obj.enabled_pos_get()
+ print("actionslider enabled pos: ")
+ if epos == elementary.ELM_ACTIONSLIDER_NONE:
+ print("none!")
+ elif epos == elementary.ELM_ACTIONSLIDER_ALL:
+ print("all!")
+ else:
+ if (epos & elementary.ELM_ACTIONSLIDER_LEFT):
+ print("left ")
+ if (epos & elementary.ELM_ACTIONSLIDER_CENTER):
+ print("center ")
+ if (epos & elementary.ELM_ACTIONSLIDER_RIGHT):
+ print("right ")
+ print("")
+
+def _position_change_magnetic_cb(obj, event_info):
+ if event_info == "left":
+ obj.magnet_pos_set(elementary.ELM_ACTIONSLIDER_LEFT)
+ elif event_info == "right":
+ obj.magnet_pos_set(elementary.ELM_ACTIONSLIDER_RIGHT)
+
+def _magnet_enable_disable_cb(obj, event_info):
+ if event_info == "left":
+ obj.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER)
+ elif event_info == "right":
+ obj.magnet_pos_set(elementary.ELM_ACTIONSLIDER_NONE)
+
+def actionslider_clicked(obj):
+ win = elementary.Window("actionslider", elementary.ELM_WIN_BASIC)
+ win.title_set("Actionslider")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bg)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ acts = elementary.Actionslider(win)
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.part_text_set("left", "Snooze")
+ acts.part_text_set("center", "")
+ acts.part_text_set("right", "Stop")
+ acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_LEFT | elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.callback_pos_changed_add(_position_change_magnetic_cb)
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ acts = elementary.Actionslider(win)
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_CENTER)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER)
+ acts.part_text_set("left", "Snooze")
+ acts.part_text_set("center", "")
+ acts.part_text_set("right", "Stop")
+ acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_LEFT | elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ acts = elementary.Actionslider(win)
+ acts.style_set("bar")
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER | elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.enabled_pos_set(elementary.ELM_ACTIONSLIDER_CENTER | elementary.ELM_ACTIONSLIDER_RIGHT)
+ acts.part_text_set("left", "")
+ acts.part_text_set("center", "Accept")
+ acts.part_text_set("right", "Reject")
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ acts = elementary.Actionslider(win)
+ acts.style_set("bar")
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_LEFT)
+ acts.part_text_set("left", "")
+ acts.part_text_set("center", "Accept")
+ acts.part_text_set("right", "Reject")
+ acts.text_set("Go")
+ acts.callback_pos_changed_add(_position_change_magnetic_cb)
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ acts = elementary.Actionslider(win)
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_LEFT)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_ALL)
+ acts.part_text_set("left", "Left")
+ acts.part_text_set("center", "Center")
+ acts.part_text_set("right", "Right")
+ acts.text_set("Go");
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ acts = elementary.Actionslider(win)
+ acts.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ acts.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ acts.indicator_pos_set(elementary.ELM_ACTIONSLIDER_CENTER)
+ acts.magnet_pos_set(elementary.ELM_ACTIONSLIDER_CENTER)
+ acts.part_text_set("left", "Enable")
+ acts.part_text_set("center", "Magnet")
+ acts.part_text_set("right", "Disable")
+ acts.callback_pos_changed_add(_magnet_enable_disable_cb)
+ acts.callback_selected_add(_pos_selected_cb)
+ bx.pack_end(acts)
+ acts.show()
+
+ win.resize(320, 400)
+ win.show()
+
+if __name__ == "__main__":
+ elementary.init()
+
+ actionslider_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_bg.py b/examples/elementary/test_bg.py
new file mode 100644
index 0000000..5900652
--- /dev/null
+++ b/examples/elementary/test_bg.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+
+from efl import elementary
+from efl import evas
+
+
+def bg_plain_clicked(obj, item=None):
+ win = elementary.Window("bg plain", elementary.ELM_WIN_BASIC)
+ win.title_set("Bg Plain")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+def bg_image_clicked(obj, item=None):
+ win = elementary.Window("bg-image", elementary.ELM_WIN_BASIC)
+ win.title_set("Bg Image")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.file_set("images/plant_01.jpg")
+ bg.option_set(elementary.ELM_BG_OPTION_SCALE)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ win.size_hint_min_set(160, 160)
+ win.size_hint_max_set(320, 320)
+ win.resize(320, 320)
+ win.show()
+
+ (filename, group) = bg.file_get()
+ print(("Background image: '%s' group: '%s'" % (filename, group)))
+ print(("Option: %d" % (bg.option_get())))
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Bg Plain", bg_plain_clicked),
+ ("Bg Image", bg_image_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_box.py b/examples/elementary/test_box.py
new file mode 100644
index 0000000..535fa47
--- /dev/null
+++ b/examples/elementary/test_box.py
@@ -0,0 +1,330 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def box_vert_clicked(obj, item=None):
+ win = elementary.Window("box-vert", elementary.ELM_WIN_BASIC)
+ win.title_set("Box Vert")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.0, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(evas.EVAS_HINT_EXPAND, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ win.show()
+
+def boxvert2_del_cb(bt, bx):
+ bx.unpack(bt)
+ bt.move(0, 0)
+ bt.color_set(128, 64, 0, 128)
+
+def box_vert2_clicked(obj, item=None):
+ win = elementary.Window("box-vert2", elementary.ELM_WIN_BASIC)
+ win.title_set("Box Vert 2")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(0.0, 0.0)
+ bx.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 1")
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.callback_clicked_add(boxvert2_del_cb, bx)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 2")
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.callback_clicked_add(boxvert2_del_cb, bx)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 3")
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.callback_clicked_add(boxvert2_del_cb, bx)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 4")
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.callback_clicked_add(boxvert2_del_cb, bx)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 5")
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.callback_clicked_add(boxvert2_del_cb, bx)
+ bx.pack_end(bt)
+ bt.show()
+
+ win.show()
+
+def box_horiz_clicked(obj, item=None):
+ win = elementary.Window("box-horiz", elementary.ELM_WIN_BASIC)
+ win.title_set("Box Horiz")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.horizontal_set(True)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.0)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(ic)
+ ic.show()
+
+ win.show()
+
+
+layout_list = ["horizontal","vertical","homogeneous_vertical",
+ "homogeneous_horizontal", "homogeneous_max_size_horizontal",
+ "homogeneous_max_size_vertical", "flow_horizontal", "flow_vertical", "stack"]
+current_layout = elementary.ELM_BOX_LAYOUT_HORIZONTAL
+
+
+def box_layout_button_cb(obj, box):
+ global current_layout
+
+ current_layout += 1
+ if current_layout >= len(layout_list):
+ current_layout = 0
+ obj.text_set("layout: %s" % layout_list[current_layout])
+ box.layout_set(current_layout)
+
+def box_layout_clicked(obj, item=None):
+ win = elementary.Window("box-layout", elementary.ELM_WIN_BASIC)
+ win.title_set("Box Layout")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ win.resize_object_add(vbox)
+ vbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.show()
+
+ bx = elementary.Box(win)
+ bx.layout_set(elementary.ELM_BOX_LAYOUT_HORIZONTAL)
+ bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(bx)
+ bx.show()
+
+ sep = elementary.Separator(win)
+ sep.horizontal_set(True)
+ vbox.pack_end(sep)
+ sep.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("layout: %s" % layout_list[current_layout])
+ bt.callback_clicked_add(box_layout_button_cb, bx)
+ vbox.pack_end(bt)
+ bt.show()
+
+ for i in range(5):
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(1.0, 1.0)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.0, 0.0)
+ bx.pack_end(ic)
+ ic.show()
+
+ win.show()
+
+def box_transition_button_cb(obj, box):
+ global current_layout
+
+ from_ly = current_layout
+ current_layout += 1
+ if current_layout >= len(layout_list):
+ current_layout = 0
+
+ obj.text_set("layout: %s" % layout_list[current_layout])
+ box.layout_transition(0.4, from_ly, current_layout)
+
+def box_transition_clicked(obj, item=None):
+ win = elementary.Window("box-layout-transition", elementary.ELM_WIN_BASIC)
+ win.title_set("Box Layout Transition")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ win.resize_object_add(vbox)
+ vbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.show()
+
+ bx = elementary.Box(win)
+ bx.layout_set(elementary.ELM_BOX_LAYOUT_HORIZONTAL)
+ bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(bx)
+ bx.show()
+
+ sep = elementary.Separator(win)
+ sep.horizontal_set(True)
+ vbox.pack_end(sep)
+ sep.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("layout: %s" % layout_list[current_layout])
+ bt.callback_clicked_add(box_transition_button_cb, bx)
+ vbox.pack_end(bt)
+ bt.show()
+
+ for i in range(4):
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Box Vert", box_vert_clicked),
+ ("Box Vert 2", box_vert2_clicked),
+ ("Box Horiz", box_horiz_clicked),
+ ("Box Layout", box_layout_clicked),
+ ("Box Layout Transition", box_transition_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_bubble.py b/examples/elementary/test_bubble.py
new file mode 100644
index 0000000..af9fd0c
--- /dev/null
+++ b/examples/elementary/test_bubble.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def bubble_clicked(obj, item=None):
+ win = elementary.Window("bubble", elementary.ELM_WIN_BASIC)
+ win.title_set("Bubble")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ # bb 1
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+
+ lb = elementary.Label(win)
+ lb.text_set("Blah, Blah, Blah")
+
+ bb = elementary.Bubble(win)
+ bb.text_set("Message 1")
+ bb.part_text_set("info", "Corner: top_left")
+ bb.content_set(lb)
+ bb.part_content_set("icon", ic)
+ bb.pos = elementary.ELM_BUBBLE_POS_TOP_LEFT
+ bb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(bb)
+ bb.show()
+
+ # bb 2
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+
+ lb = elementary.Label(win)
+ lb.text_set("Blah, Blah, Blah")
+
+ bb = elementary.Bubble(win)
+ bb.text_set("Message 2")
+ bb.part_text_set("info", "Corner: top_right")
+ bb.content_set(lb)
+ bb.part_content_set("icon", ic)
+ bb.pos = elementary.ELM_BUBBLE_POS_TOP_RIGHT
+ bb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(bb)
+ bb.show()
+
+ # bb 3
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+
+ lb = elementary.Label(win)
+ lb.text_set("Blah, Blah, Blah")
+
+ bb = elementary.Bubble(win)
+ bb.text_set("Message 3")
+ bb.part_text_set("info", "Corner: bottom_left")
+ bb.content_set(ic)
+ bb.pos = elementary.ELM_BUBBLE_POS_BOTTOM_LEFT
+ bb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(bb)
+ bb.show()
+
+ # bb 4
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+
+ lb = elementary.Label(win)
+ lb.text_set("Blah, Blah, Blah")
+
+ bb = elementary.Bubble(win)
+ bb.text_set("Message 4")
+ bb.part_text_set("info", "Corner: bottom_right")
+ bb.content_set(lb)
+ bb.part_content_set("icon", ic)
+ bb.pos = elementary.ELM_BUBBLE_POS_BOTTOM_RIGHT
+ bb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(bb)
+ bb.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Bubble", bubble_clicked),
+ ]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_button.py b/examples/elementary/test_button.py
new file mode 100644
index 0000000..d8576aa
--- /dev/null
+++ b/examples/elementary/test_button.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def buttons_clicked(obj):
+ win = elementary.Window("buttons", elementary.ELM_WIN_BASIC)
+ win.title_set("Buttons")
+ win.focus_highlight_enabled_set(True)
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ bt = elementary.Button(win)
+ bt.text_set("Icon sized to button")
+ bt.content_set(ic)
+ bx.pack_end(bt)
+ bt.show()
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ bt = elementary.Button(win)
+ bt.text_set("Icon no scale")
+ bt.content_set(ic)
+ bx.pack_end(bt)
+ bt.show()
+ ic.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("No icon")
+ bx.pack_end(bt)
+ bt.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ bt = elementary.Button(win)
+ bt.content_set(ic)
+ bx.pack_end(bt)
+ bt.show()
+ ic.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ buttons_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_calendar.py b/examples/elementary/test_calendar.py
new file mode 100644
index 0000000..7d5e338
--- /dev/null
+++ b/examples/elementary/test_calendar.py
@@ -0,0 +1,278 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+from datetime import datetime
+
+
+api = {
+ "state" : 0, # What state we are testing
+ "box" : None # box used in set_api_state
+}
+
+STATE_MARK_MONTHLY = 0
+STATE_MARK_WEEKLY = 1
+STATE_SUNDAY_HIGHLIGHT = 2
+STATE_SELECT_DATE_DISABLED_WITH_MARKS = 3
+STATE_SELECT_DATE_DISABLED_NO_MARKS = 4
+API_STATE_LAST = 5
+
+def set_api_state(api):
+ items = api["box"].children
+ if not items:
+ return
+ m = None
+
+ if api["state"] == STATE_MARK_MONTHLY:
+ cal = items[0]
+ cal.min_max_year = (2010, 2011)
+ the_time = datetime(2010, 12, 31)
+ m = cal.mark_add("checked", the_time, elementary.ELM_CALENDAR_MONTHLY)
+ cal.selected_time = the_time
+ elif api["state"] == STATE_MARK_WEEKLY:
+ cal = items[0]
+ the_time = datetime(2010, 12, 26)
+ if m is not None:
+ m.delete()
+ m = cal.mark_add("checked", the_time, elementary.ELM_CALENDAR_WEEKLY)
+ cal.selected_time = the_time
+ elif api["state"] == STATE_SUNDAY_HIGHLIGHT:
+ cal = items[0]
+ the_time = datetime(2010, 12, 25)
+ # elm_calendar_mark_del(m)
+ m = cal.mark_add("holiday", the_time, elementary.ELM_CALENDAR_WEEKLY)
+ cal.selected_time = the_time
+ elif api["state"] == STATE_SELECT_DATE_DISABLED_WITH_MARKS:
+ cal = items[0]
+ the_time = datetime(2011, 01, 01)
+ cal.select_mode = elementary.ELM_CALENDAR_SELECT_MODE_NONE
+ cal.selected_time = the_time
+ elif api["state"] == STATE_SELECT_DATE_DISABLED_NO_MARKS:
+ cal = items[0]
+ the_time = datetime(2011, 02, 01)
+ del cal.marks
+ cal.select_mode = elementary.ELM_CALENDAR_SELECT_MODE_NONE
+ cal.selected_time = the_time
+ elif api["state"] == API_STATE_LAST:
+ return
+ else:
+ return
+
+def api_bt_clicked(bt, a):
+ print("clicked event on API Button: api_state=<%d>\n" % a["state"])
+ set_api_state(a)
+ a["state"] = a["state"] + 1
+ bt.text = "Next API function (%d)" % a["state"]
+ if a["state"] == API_STATE_LAST:
+ bt.disabled = True
+
+# A simple test, just displaying calendar in it's default state
+def calendar_clicked(obj):
+ win = elementary.StandardWindow("calendar", "Calendar")
+ win.autodel = True
+
+ bxx = elementary.Box(win)
+ win.resize_object_add(bxx)
+ bxx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bxx.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ api["box"] = bx
+ bx.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Next API function"
+ bt.callback_clicked_add(api_bt_clicked, api)
+ bxx.pack_end(bt)
+ if api["state"] == API_STATE_LAST:
+ bt.disabled = True
+ bt.show()
+
+ bxx.pack_end(bx)
+
+ cal = elementary.Calendar(win)
+ cal.first_day_of_week = elementary.ELM_DAY_MONDAY
+ cal.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(cal)
+
+ the_time = datetime(2010, 12, 31)
+ cal.selected_time = the_time
+ cal.min_max_year = (2010, 2012)
+
+ cal.show()
+
+ win.show()
+
+"""
+def print_cal_info(Evas_Object *cal, Evas_Object *en):
+ char info[1024]
+ double interval
+ int year_min, year_max
+ Eina_Bool sel_enabled
+ const char **wds
+ struct tm stm
+
+ if (!elm_calendar_selected_time_get(cal, &stm))
+ return
+
+ interval = elm_calendar_interval_get(cal)
+ elm_calendar_min_max_year_get(cal, &year_min, &year_max)
+ sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_MODE_NONE)
+ wds = elm_calendar_weekdays_names_get(cal)
+
+ snprintf(info, sizeof(info),
+ " Day: %i, Mon: %i, Year %i, WeekDay: %i<br/>"
+ " Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br/>"
+ " Weekdays: %s, %s, %s, %s, %s, %s, %s<br/>",
+ stm.tm_mday, stm.tm_mon, stm.tm_year + 1900, stm.tm_wday,
+ interval, year_min, year_max, sel_enabled,
+ wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6])
+
+ elm_object_text_set(en, info)
+
+def _print_cal_info_cb(void *data, Evas_Object *obj, void *event_info):
+ _print_cal_info(obj, data)
+
+static char *
+_format_month_year(struct tm *stm)
+ char buf[32]
+ if (!strftime(buf, sizeof(buf), "%b %y", stm)) return NULL
+ return strdup(buf)
+
+# A test intended to cover all the calendar api and much use cases as possible
+def test_calendar2(obj):
+ Evas_Object *win, *bx, *bxh, *cal, *cal2, *cal3, *en
+ Elm_Calendar_Mark *mark
+ struct tm selected_time
+ time_t current_time
+ const char *weekdays[] =
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ }
+
+ win = elm_win_util_standard_add("calendar2", "Calendar 2")
+ elm_win_autodel_set(win, EINA_TRUE)
+
+ bx = elm_box_add(win)
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ elm_win_resize_object_add(win, bx)
+ evas_object_show(bx)
+
+ bxh = elm_box_add(win)
+ elm_box_horizontal_set(bxh, EINA_TRUE)
+ evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_size_hint_align_set(bxh, EVAS_HINT_FILL, EVAS_HINT_FILL)
+ evas_object_show(bxh)
+ elm_box_pack_end(bx, bxh)
+
+ cal = elm_calendar_add(win)
+ evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL)
+ evas_object_show(cal)
+ elm_box_pack_end(bx, cal)
+
+ cal2 = elm_calendar_add(win)
+ evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL)
+ elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_MODE_NONE)
+ evas_object_show(cal2)
+ elm_box_pack_end(bxh, cal2)
+
+ cal3 = elm_calendar_add(win)
+ evas_object_size_hint_weight_set(cal3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_size_hint_align_set(cal3, EVAS_HINT_FILL, EVAS_HINT_FILL)
+ current_time = time(NULL) + 34 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_selected_time_set(cal3, &selected_time)
+ current_time = time(NULL) + 1 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_UNIQUE)
+ elm_calendar_marks_clear(cal3)
+ current_time = time(NULL)
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_DAILY)
+ elm_calendar_mark_add(cal3, "holiday", &selected_time, ELM_CALENDAR_DAILY)
+ elm_calendar_marks_draw(cal3)
+ evas_object_show(cal3)
+ elm_box_pack_end(bxh, cal3)
+
+ en = elm_entry_add(win)
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL)
+ evas_object_show(en)
+ elm_box_pack_end(bx, en)
+ elm_entry_editable_set(en, EINA_FALSE)
+ evas_object_show(win)
+
+ elm_calendar_min_max_year_set(cal3, -1, -1)
+
+ elm_calendar_weekdays_names_set(cal, weekdays)
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_SATURDAY)
+ elm_calendar_interval_set(cal, 0.4)
+ elm_calendar_format_function_set(cal, _format_month_year)
+ elm_calendar_min_max_year_set(cal, 2010, 2020)
+
+ current_time = time(NULL) + 4 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_ANNUALLY)
+
+ current_time = time(NULL) + 1 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE)
+
+ current_time = time(NULL) - 363 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_MONTHLY)
+
+ current_time = time(NULL) - 5 * 84600
+ localtime_r(&current_time, &selected_time)
+ mark = elm_calendar_mark_add(cal, "holiday", &selected_time,
+ ELM_CALENDAR_WEEKLY)
+
+ current_time = time(NULL) + 1 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_WEEKLY)
+
+ elm_calendar_mark_del(mark)
+ elm_calendar_marks_draw(cal)
+
+ _print_cal_info(cal, en)
+ evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en)
+
+def test_calendar3(obj):
+ Evas_Object *win, *cal, *bxx
+ struct tm selected_time
+ time_t current_time
+
+ win = elm_win_util_standard_add("calendar", "Calendar")
+ elm_win_autodel_set(win, EINA_TRUE)
+
+ bxx = elm_box_add(win)
+ elm_win_resize_object_add(win, bxx)
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ evas_object_show(bxx)
+
+ cal = elm_calendar_add(win)
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY)
+ elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND)
+ current_time = time(NULL) + 34 * 84600
+ localtime_r(&current_time, &selected_time)
+ elm_calendar_selected_time_set(cal, &selected_time)
+ evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ elm_box_pack_end(bxx, cal)
+
+ evas_object_show(cal)
+
+ evas_object_show(win)
+"""
+if __name__ == "__main__":
+ elementary.init()
+
+ calendar_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_check.py b/examples/elementary/test_check.py
new file mode 100644
index 0000000..e1c3c1d
--- /dev/null
+++ b/examples/elementary/test_check.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def ck_1(obj):
+ print(("test check 1 state:", obj.state))
+
+def ck_2(obj):
+ print(("test check 2 state:", obj.state))
+
+def ck_never(obj):
+ print("disabled check changed (should never happen unless you enable or set it)")
+
+def ck_3(obj):
+ print(("test check 3 state:", obj.state))
+
+def ck_4(obj):
+ print(("test check 4 state:", obj.state))
+
+def check_clicked(obj):
+ win = elementary.Window("check", elementary.ELM_WIN_BASIC)
+ win.title_set("Check test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ ck = elementary.Check(win)
+ ck.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ck.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ ck.text_set("Icon sized to check")
+ ck.content_set(ic)
+ ck.state_set(True)
+ ck.callback_changed_add(ck_1)
+ bx.pack_end(ck)
+ ck.show()
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ck = elementary.Check(win)
+ ck.text_set("Icon no scale")
+ ck.content_set(ic)
+ ck.callback_changed_add(ck_2)
+ bx.pack_end(ck)
+ ck.show()
+ ic.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("Label Only")
+ ck.callback_changed_add(ck_3)
+ bx.pack_end(ck)
+ ck.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ ck = elementary.Check(win)
+ ck.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ck.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ ck.text_set("Disabled check")
+ ck.content_set(ic)
+ ck.state_set(True)
+ ck.callback_changed_add(ck_never)
+ bx.pack_end(ck)
+ ck.disabled_set(True)
+ ck.show()
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ ic.resizable_set(0, 0)
+ ck = elementary.Check(win)
+ ck.content_set(ic)
+ ck.callback_changed_add(ck_4)
+ bx.pack_end(ck)
+ ck.show()
+ ic.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ check_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_clock.py b/examples/elementary/test_clock.py
new file mode 100644
index 0000000..107d887
--- /dev/null
+++ b/examples/elementary/test_clock.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def clock_clicked(obj):
+ win = elementary.Window("clock", elementary.ELM_WIN_BASIC)
+ win.title_set("Clock")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ ck = elementary.Clock(win)
+ bx.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Clock(win)
+ ck.show_am_pm_set(True)
+ bx.pack_end(ck)
+ ck.show()
+
+ print((ck.time_get()))
+
+ ck = elementary.Clock(win)
+ ck.show_seconds_set(True)
+ bx.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Clock(win)
+ ck.show_seconds_set(True)
+ ck.show_am_pm_set(True)
+ bx.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Clock(win)
+ ck.edit_set(True)
+ ck.show_seconds_set(True)
+ ck.show_am_pm_set(True)
+ ck.time_set(10, 11, 12)
+ bx.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Clock(win)
+ ck.edit_set(True)
+ ck.show_seconds_set(True)
+ ck.edit_mode = elementary.ELM_CLOCK_EDIT_HOUR_DECIMAL | \
+ elementary.ELM_CLOCK_EDIT_MIN_DECIMAL | \
+ elementary.ELM_CLOCK_EDIT_SEC_DECIMAL
+ bx.pack_end(ck)
+ ck.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ clock_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_colorselector.py b/examples/elementary/test_colorselector.py
new file mode 100644
index 0000000..9d0c79b
--- /dev/null
+++ b/examples/elementary/test_colorselector.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_cs_changed(cs, rect):
+ print("changed")
+ (r, g, b, a) = cs.color
+ r = (r * a) / 255
+ g = (g * a) / 255
+ b = (b * a) / 255
+ rect.color = (r, g, b, a)
+
+def cb_cs_item_sel(cs, item, rect):
+ print("selected")
+ (r, g, b, a) = item.color
+ r = (r * a) / 255
+ g = (g * a) / 255
+ b = (b * a) / 255
+ rect.color = (r, g, b, a)
+
+def cb_cs_item_lp(cs, item, rect):
+ print("longpressed")
+ (r, g, b, a) = item.color
+ r = (r * a) / 255
+ g = (g * a) / 255
+ b = (b * a) / 255
+ rect.color = (r, g, b, a)
+
+def colorselector_clicked(obj):
+ win = elementary.Window("colorselector", elementary.ELM_WIN_BASIC)
+ win.title = "ColorSelector test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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()
+
+ fr = elementary.Frame(win)
+ fr.text = "Color View"
+ fr.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ fr.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.pack_end(fr)
+ fr.show()
+
+ re = evas.Rectangle(win.evas)
+ re.size_hint_min = (1, 100)
+ fr.content = re
+ re.show()
+
+ fr = elementary.Frame(win)
+ fr.text = "Color Selector"
+ fr.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fr.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.pack_end(fr)
+ fr.show()
+
+ cs = elementary.Colorselector(win)
+ cs.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ cs.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ cs.callback_changed_add(cb_cs_changed, re)
+ cs.callback_color_item_selected_add(cb_cs_item_sel, re)
+ cs.callback_color_item_longpressed_add(cb_cs_item_lp, re)
+ cs.color = (255, 160, 132, 255)
+ fr.content = cs
+ cs.show()
+
+ re.color = cs.color
+ cs.palette_color_add(255, 90, 18, 255)
+ cs.palette_color_add(255, 213, 0, 255)
+ cs.palette_color_add(146, 255, 11, 255)
+ cs.palette_color_add(9, 186, 10, 255)
+ cs.palette_color_add(86, 201, 242, 255)
+ cs.palette_color_add(18, 83, 128, 255)
+ cs.palette_color_add(140, 53, 238, 255)
+ cs.palette_color_add(255, 145, 145, 255)
+ cs.palette_color_add(255, 59, 119, 255)
+ cs.palette_color_add(133, 100, 69, 255)
+ cs.palette_color_add(255, 255, 119, 255)
+ cs.palette_color_add(133, 100, 255, 255)
+
+ 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()
+
+ bt = elementary.Button(win)
+ bt.text = "Palette"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda btn: cs.mode_set(elementary.ELM_COLORSELECTOR_PALETTE))
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Components"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda btn: cs.mode_set(elementary.ELM_COLORSELECTOR_COMPONENTS))
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Both"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda btn: cs.mode_set(elementary.ELM_COLORSELECTOR_BOTH))
+ hbox.pack_end(bt)
+ bt.show()
+
+ win.resize(320, 550)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ colorselector_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_config.py b/examples/elementary/test_config.py
new file mode 100644
index 0000000..eb487cb
--- /dev/null
+++ b/examples/elementary/test_config.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+
+
+def config_clicked(obj):
+ # TODO: Write a better test!
+ c = elementary.Configuration()
+ for i in (c.engine, c.finger_size, c.mirrored, c.profile_list, c.font_overlay_list, c.text_classes_list):
+ print(i)
+ print((elementary.config_finger_size_get()))
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ config_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_core_evas_canvas_callbacks.py b/examples/elementary/test_core_evas_canvas_callbacks.py
new file mode 100644
index 0000000..8f4f1a6
--- /dev/null
+++ b/examples/elementary/test_core_evas_canvas_callbacks.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def btn_del_cbs_cb(button):
+ canvas = button.evas_get()
+ canvas.event_callback_del(evas.EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1)
+ canvas.event_callback_del(evas.EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1)
+ # canvas.event_callback_del(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb1)
+ # canvas.event_callback_del(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb1)
+ canvas.event_callback_del(evas.EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1)
+ canvas.event_callback_del(evas.EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1)
+ canvas.event_callback_del(evas.EVAS_CALLBACK_RENDER_PRE, events_cb1)
+ canvas.event_callback_del(evas.EVAS_CALLBACK_RENDER_POST, events_cb1)
+
+
+def events_cb1(rect, event_name):
+ print(event_name + " No data for event")
+
+def events_cb2(rect, evtinfo, event_name):
+ print(event_name + " " + str(evtinfo))
+
+
+def core_evas_canvas_callbacks_clicked(obj, item=None):
+ win = elementary.Window("evascanvascbs", elementary.ELM_WIN_BASIC)
+ win.title_set("Evas canvas callbacks")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bg.show()
+
+ text = evas.Text(win.evas, text="Events printed on console", size=(300, 30), color=(0,0,0,255))
+ text.font_set("Sans", 12)
+ text.pos = (10, 10)
+ text.show()
+
+ canvas = win.evas_get()
+ canvas.event_callback_add(evas.EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN")
+ canvas.event_callback_add(evas.EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_OUT")
+ # canvas.event_callback_add(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN")
+ # canvas.event_callback_add(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb1, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT")
+
+ canvas.event_callback_add(evas.EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_PRE")
+ canvas.event_callback_add(evas.EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_POST")
+ canvas.event_callback_add(evas.EVAS_CALLBACK_RENDER_PRE, events_cb2, "EVAS_CALLBACK_RENDER_PRE")
+ canvas.event_callback_add(evas.EVAS_CALLBACK_RENDER_POST, events_cb2, "EVAS_CALLBACK_RENDER_POST")
+
+ r2 = evas.Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70))
+ r2.show()
+
+ hbox = elementary.Box(win)
+ win.resize_object_add(hbox)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ hbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ hbox.horizontal = True
+ hbox.show()
+
+ b = elementary.Button(win)
+ b.text = "del cbs"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(btn_del_cbs_cb)
+ b.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ core_evas_canvas_callbacks_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_core_evas_object_callbacks.py b/examples/elementary/test_core_evas_object_callbacks.py
new file mode 100644
index 0000000..89a5086
--- /dev/null
+++ b/examples/elementary/test_core_evas_object_callbacks.py
@@ -0,0 +1,168 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def btn_del_cbs_cb(button, rect):
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_IN, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_OUT, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_DOWN, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_UP, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_MOVE, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOUSE_WHEEL, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MULTI_DOWN, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MULTI_UP, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MULTI_MOVE, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_FREE, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_KEY_DOWN, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_KEY_UP, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_FOCUS_IN, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_FOCUS_OUT, events_cb2)
+ rect.event_callback_del(evas.EVAS_CALLBACK_SHOW, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_HIDE, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_MOVE, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_RESIZE, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_RESTACK, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_DEL, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_HOLD, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_CHANGED_SIZE_HINTS, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_IMAGE_PRELOADED, events_cb1)
+ rect.event_callback_del(evas.EVAS_CALLBACK_IMAGE_UNLOADED, events_cb1)
+
+
+def events_cb1(rect, event_name):
+ print(event_name + " No data for event")
+
+def events_cb2(rect, evtinfo, event_name):
+ print(event_name + " " + str(evtinfo))
+
+
+def core_evas_object_callbacks_clicked(obj, item=None):
+ win = elementary.Window("evas3d", elementary.ELM_WIN_BASIC)
+ win.title_set("Evas object callbacks")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bg.show()
+
+ text = evas.Text(win.evas, text="Events printed on console", size=(300, 30), color=(0,0,0,255))
+ text.font_set("Sans", 12)
+ text.pos = (10, 10)
+ text.show()
+
+ r = evas.Rectangle(win.evas, size=(100,100), color=(100,0,0,200), pos=(50,50))
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, events_cb2, "EVAS_CALLBACK_MOUSE_IN")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, events_cb2, "EVAS_CALLBACK_MOUSE_OUT")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, events_cb2, "EVAS_CALLBACK_MOUSE_DOWN")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_UP, events_cb2, "EVAS_CALLBACK_MOUSE_UP")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, events_cb2, "EVAS_CALLBACK_MOUSE_MOVE")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOUSE_WHEEL, events_cb2, "EVAS_CALLBACK_MOUSE_WHEEL")
+ r.event_callback_add(evas.EVAS_CALLBACK_MULTI_DOWN, events_cb2, "EVAS_CALLBACK_MULTI_DOWN")
+ r.event_callback_add(evas.EVAS_CALLBACK_MULTI_UP, events_cb2, "EVAS_CALLBACK_MULTI_UP")
+ r.event_callback_add(evas.EVAS_CALLBACK_MULTI_MOVE, events_cb2, "EVAS_CALLBACK_MULTI_MOVE")
+ r.event_callback_add(evas.EVAS_CALLBACK_FREE, events_cb1, "EVAS_CALLBACK_FREE")
+ r.event_callback_add(evas.EVAS_CALLBACK_KEY_DOWN, events_cb2, "EVAS_CALLBACK_KEY_DOWN")
+ r.event_callback_add(evas.EVAS_CALLBACK_KEY_UP, events_cb2, "EVAS_CALLBACK_KEY_UP")
+ r.event_callback_add(evas.EVAS_CALLBACK_FOCUS_IN, events_cb2, "EVAS_CALLBACK_FOCUS_IN")
+ r.event_callback_add(evas.EVAS_CALLBACK_FOCUS_OUT, events_cb2, "EVAS_CALLBACK_FOCUS_OUT")
+ r.event_callback_add(evas.EVAS_CALLBACK_SHOW, events_cb1, "EVAS_CALLBACK_SHOW")
+ r.event_callback_add(evas.EVAS_CALLBACK_HIDE, events_cb1, "EVAS_CALLBACK_HIDE")
+ r.event_callback_add(evas.EVAS_CALLBACK_MOVE, events_cb1, "EVAS_CALLBACK_MOVE")
+ r.event_callback_add(evas.EVAS_CALLBACK_RESIZE, events_cb1, "EVAS_CALLBACK_RESIZE")
+ r.event_callback_add(evas.EVAS_CALLBACK_RESTACK, events_cb1, "EVAS_CALLBACK_RESTACK")
+ r.event_callback_add(evas.EVAS_CALLBACK_DEL, events_cb1, "EVAS_CALLBACK_DEL")
+ r.event_callback_add(evas.EVAS_CALLBACK_HOLD, events_cb1, "EVAS_CALLBACK_HOLD")
+ r.event_callback_add(evas.EVAS_CALLBACK_CHANGED_SIZE_HINTS, events_cb1, "EVAS_CALLBACK_CHANGED_SIZE_HINTS")
+ r.event_callback_add(evas.EVAS_CALLBACK_IMAGE_PRELOADED, events_cb1, "EVAS_CALLBACK_IMAGE_PRELOADED")
+ r.event_callback_add(evas.EVAS_CALLBACK_IMAGE_UNLOADED, events_cb1, "EVAS_CALLBACK_IMAGE_UNLOADED")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1, "")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1, "")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1, "")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb1, "")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT, events_cb1, "")
+
+ ## r.event_callback_add(evas.EVAS_CALLBACK_RENDER_PRE, events_cb1, "")
+ ## r.event_callback_add(evas.EVAS_CALLBACK_RENDER_POST, events_cb1, "")
+ #? r.event_callback_add(evas.EVAS_CALLBACK_IMAGE_RESIZE, events_cb1, "")
+ #? r.event_callback_add(evas.EVAS_CALLBACK_DEVICE_CHANGED, events_cb1, "")
+ r.show()
+
+ r2 = evas.Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70))
+ r2.show()
+
+ hbox = elementary.Box(win)
+ win.resize_object_add(hbox)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ hbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ hbox.horizontal = True
+ hbox.show()
+
+ b = elementary.Button(win)
+ b.text = "show / hide"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, r: r.hide() if r.visible else r.show(), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "move"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, t: r.pos_set(r.pos[0] + 1, r.pos[1]), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "resize"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, r: r.size_set(r.size[0] + 1, r.size[1] + 1), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "delete"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, r: r.delete(), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "raise"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, r: r.raise_(), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "hints"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(lambda b, r: r.size_hint_align_set(0.0, 0.0), r)
+ b.show()
+
+ b = elementary.Button(win)
+ b.text = "del cbs"
+ b.size_hint_align_set(0.5, 1.0)
+ hbox.pack_end(b)
+ b.callback_clicked_add(btn_del_cbs_cb, r)
+ b.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ core_evas_object_callbacks_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_core_evas_objects.py b/examples/elementary/test_core_evas_objects.py
new file mode 100644
index 0000000..5461004
--- /dev/null
+++ b/examples/elementary/test_core_evas_objects.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+
+def events_cb1(rect, event_name):
+ print(event_name + " No data for event")
+
+def events_cb2(rect, evtinfo, event_name):
+ print(event_name + " " + str(evtinfo))
+
+
+def core_evas_objects_clicked(obj, item=None):
+
+ win = elementary.Window("evasobjects", elementary.ELM_WIN_BASIC)
+ win.title_set("Evas Objects Test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bg.show()
+
+
+ rect = evas.Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70))
+ rect.show()
+
+ line = evas.Line(win.evas, start=(20,40), end=(200,100), color=(255,0,0,255))
+ line.show()
+
+ text = evas.Text(win.evas, text="Evas Text Object", size=(300, 30), color=(0,0,0,255))
+ text.font_set("Sans", 16)
+ text.pos = (40, 20)
+ text.show()
+
+ poly = evas.Polygon(win.evas, color=(200, 0, 200, 200))
+ poly.point_add(10,100)
+ poly.point_add(100,120)
+ poly.point_add(20,30)
+ poly.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ core_evas_objects_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_ctxpopup.py b/examples/elementary/test_ctxpopup.py
new file mode 100644
index 0000000..dd6dc39
--- /dev/null
+++ b/examples/elementary/test_ctxpopup.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_items(li, item):
+ print(("ctxpopup item selected: %s" % (item.text)))
+
+def item_new(cp, label, icon = None):
+ if icon:
+ ic = elementary.Icon(cp)
+ ic.standard_set(icon)
+ ic.resizable_set(False, False)
+ return cp.item_append(label, ic, cb_items)
+ else:
+ return cp.item_append(label, None, cb_items)
+
+def cb_btn(btn):
+ cp = btn.data["ctxpopup"]
+ if "img" in cp.data:
+ return
+ img = evas.FilledImage(btn.evas)
+ img.file_set("images/sky_04.jpg")
+ img.move(40, 40)
+ img.resize(320, 320)
+ img.show()
+
+ cp = btn.data["ctxpopup"]
+ cp.data["img"] = img
+ cp.raise_()
+ # NOTE: the '_' is wanted as 'raise' is a reserved word in py
+
+def cb_dismissed(cp):
+ if "img" in cp.data:
+ cp.data["img"].delete()
+
+def cb_item1(li, item):
+ cp = elementary.Ctxpopup(li)
+ it = item_new(cp, "Go to home folder", "home")
+ it = item_new(cp, "Save file", "file")
+ it = item_new(cp, "Delete file", "delete")
+ it = item_new(cp, "Navigate to folder", "folder")
+ it.disabled = True
+ it = item_new(cp, "Edit entry", "edit")
+ it = item_new(cp, "Sate date and time", "clock")
+ it.disabled = True
+
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+
+def cb_item2(li, item):
+ cp = elementary.Ctxpopup(li)
+ it = item_new(cp, "", "home")
+ it = item_new(cp, "", "file")
+ it = item_new(cp, "", "delete")
+ it = item_new(cp, "", "folder")
+ it = item_new(cp, "", "edit")
+ it.disabled = True
+ it = item_new(cp, "", "clock")
+
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+
+def cb_item3(li, item):
+ cp = elementary.Ctxpopup(li)
+ it = item_new(cp, "Eina")
+ it = item_new(cp, "Eet")
+ it = item_new(cp, "Evas")
+ it = item_new(cp, "Ecore")
+ it.disabled = True
+ it = item_new(cp, "Embryo")
+ it = item_new(cp, "Edje")
+
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+
+def cb_item4(li, item):
+ cp = elementary.Ctxpopup(li)
+ cp.horizontal = True
+ it = item_new(cp, "", "home")
+ it = item_new(cp, "", "file")
+ it = item_new(cp, "", "delete")
+ it = item_new(cp, "", "folder")
+ it = item_new(cp, "", "edit")
+ it = item_new(cp, "", "clock")
+
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+
+def cb_item5(li, item):
+ box = elementary.Box(li)
+ box.size_hint_min = (150, 150)
+
+ sc = elementary.Scroller(li)
+ sc.bounce = (False, True)
+ sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.show()
+
+ bt = elementary.Button(li)
+ bt.text = "Enlightenment"
+ bt.size_hint_min = (140, 140)
+
+ sc.content = bt
+ box.pack_end(sc)
+
+ cp = elementary.Ctxpopup(li)
+ cp.content = box
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+
+def cb_item6(li, item):
+ box = elementary.Box(li)
+ box.size_hint_min = (200, 150)
+
+ sc = elementary.Scroller(li)
+ sc.bounce = (False, True)
+ sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.show()
+
+ bt = elementary.Button(li)
+ bt.text = "Ctxpop will be on the top of layer"
+ bt.callback_clicked_add(cb_btn)
+ bt.size_hint_min = (190, 140)
+
+ sc.content = bt
+ box.pack_end(sc)
+
+ cp = elementary.Ctxpopup(li)
+ cp.callback_dismissed_add(cb_dismissed)
+ cp.content = box
+ (x, y) = li.evas.pointer_canvas_xy_get()
+ cp.move(x, y)
+ cp.show()
+ bt.data["ctxpopup"] = cp
+
+def ctxpopup_clicked(obj):
+ win = elementary.Window("ctxpopup", elementary.ELM_WIN_BASIC)
+ win.title = "Context popup test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ li = elementary.List(win)
+ win.resize_object_add(li)
+ li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.mode = elementary.ELM_LIST_COMPRESS
+ li.show()
+
+ li.item_append("Ctxpopup with icons and labels", callback=cb_item1)
+ li.item_append("Ctxpopup with icons only", callback=cb_item2)
+ li.item_append("Ctxpopup with labels only", callback=cb_item3)
+ li.item_append("Ctxpopup at horizontal mode", callback=cb_item4)
+ li.item_append("Ctxpopup with user content", callback=cb_item5)
+ li.item_append("Ctxpopup with restacking", callback=cb_item6)
+ li.go()
+
+ win.resize(400, 400)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ ctxpopup_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_cursor.py b/examples/elementary/test_cursor.py
new file mode 100644
index 0000000..9d4de95
--- /dev/null
+++ b/examples/elementary/test_cursor.py
@@ -0,0 +1,258 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+
+from efl import elementary
+# from efl.elementary import cursors
+from efl import evas
+
+
+def cursor_clicked(obj, item=None):
+ win = elementary.Window("cursors", elementary.ELM_WIN_BASIC)
+ win.title_set("Cursors")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ ck = elementary.Clock(win)
+ ck.cursor_set(elementary.ELM_CURSOR_CLOCK)
+ bx.pack_end(ck)
+ ck.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Coffee Mug")
+ bt.cursor_set(elementary.ELM_CURSOR_COFFEE_MUG)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Cursor unset")
+ bt.cursor_set(elementary.ELM_CURSOR_BOGOSITY)
+ bt.cursor_unset()
+ bx.pack_end(bt)
+ bt.show()
+
+ lst = elementary.List(win)
+ lst.item_append("watch over list")
+ lst.item_append("watch over list")
+ lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ lst.cursor_set(elementary.ELM_CURSOR_WATCH)
+ bx.pack_end(lst)
+ lst.go()
+ lst.show()
+
+ en = elementary.Entry(win)
+ en.scrollable_set(True)
+ en.single_line_set(True)
+ en.entry_set("Xterm cursor")
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ en.cursor_set(elementary.ELM_CURSOR_XTERM)
+ bx.pack_end(en)
+ en.show()
+
+ win.resize(320, 480)
+ win.show()
+
+
+def cursor2_clicked(obj, item=None):
+ win = elementary.Window("cursors", elementary.ELM_WIN_BASIC)
+ win.title_set("Cursors 2")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ tb = elementary.Toolbar(win)
+ ti = tb.item_append("folder-new", "Bogosity", None, None)
+ ti.cursor_set(elementary.ELM_CURSOR_BOGOSITY)
+ ti = tb.item_append("clock", "Unset", None, None)
+ ti.cursor_set(elementary.ELM_CURSOR_BOGOSITY)
+ ti.cursor_unset()
+ ti = tb.item_append("document-print", "Xterm", None, None)
+ ti.cursor_set(elementary.ELM_CURSOR_XTERM)
+ tb.size_hint_weight_set(0.0, 0.0)
+ tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ bx.pack_end(tb)
+ tb.show()
+
+ lst = elementary.List(win)
+ li = lst.item_append("cursor bogosity")
+ li.cursor_set(elementary.ELM_CURSOR_BOGOSITY)
+ li = lst.item_append("cursor unset")
+ li.cursor_set(elementary.ELM_CURSOR_BOGOSITY)
+ li.cursor_unset()
+ li = lst.item_append("cursor xterm")
+ li.cursor_set(elementary.ELM_CURSOR_XTERM)
+ lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(lst)
+ lst.go()
+ lst.show()
+
+ win.resize(320, 480)
+ win.show()
+
+
+def cursor3_clicked(obj, item=None):
+ win = elementary.Window("cursors", elementary.ELM_WIN_BASIC)
+ win.title_set("Cursors 3")
+ win.autodel_set(True)
+
+ elementary.theme_extension_add("./cursors.edj")
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("hand1")
+ bt.cursor_set(elementary.ELM_CURSOR_HAND1)
+ bt.cursor_theme_search_enabled_set(False)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("hand2 x")
+ bt.cursor_set(elementary.ELM_CURSOR_HAND2)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("hand2")
+ bt.cursor_set(elementary.ELM_CURSOR_HAND2)
+ bt.cursor_theme_search_enabled_set(False)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("hand3")
+ bt.cursor_set("hand3")
+ bt.cursor_theme_search_enabled_set(False)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("hand3")
+ bt.cursor_set("hand3")
+ bt.cursor_theme_search_enabled_set(False)
+ bt.cursor_style_set("transparent")
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("not existent")
+ bt.cursor_set("hand4")
+ bt.cursor_theme_search_enabled_set(False)
+ bx.pack_end(bt)
+ bt.show()
+
+ elementary.cursor_engine_only_set(False)
+ bt = elementary.Button(win)
+ bt.text_set("hand 2 engine only config false")
+ bt.cursor_set("hand2")
+ bx.pack_end(bt)
+ bt.show()
+
+ elementary.cursor_engine_only_set(True)
+ bt = elementary.Button(win)
+ bt.text_set("hand 2 engine only config true")
+ bt.cursor_set("hand2")
+ bx.pack_end(bt)
+ bt.show()
+
+ lst = elementary.List(win)
+ li = lst.item_append("cursor hand2 x")
+ li.cursor_set(elementary.ELM_CURSOR_HAND2)
+ li = lst.item_append("cursor hand2")
+ li.cursor_set(elementary.ELM_CURSOR_HAND2)
+ li.cursor_engine_only_set(False)
+ li = lst.item_append("cursor hand3")
+ li.cursor_set("hand3")
+ li.cursor_engine_only_set(False)
+ li = lst.item_append("cursor hand3 transparent")
+ li.cursor_set("hand3")
+ bt.cursor_style_set("transparent")
+ li.cursor_engine_only_set(False)
+ lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(lst)
+ lst.go()
+ lst.show()
+
+ win.resize(320, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Cursor", cursor_clicked),
+ ("Cursor 2", cursor2_clicked),
+ ("Cursor 3", cursor3_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320, 480)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_datetime.py b/examples/elementary/test_datetime.py
new file mode 100644
index 0000000..3c2ed12
--- /dev/null
+++ b/examples/elementary/test_datetime.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+
+from efl import elementary
+from efl import evas
+
+from datetime import datetime
+
+
+def changed_cb(obj):
+ printf("Datetime value is changed\n")
+
+def datetime_clicked(obj):
+ win = elementary.StandardWindow("dt", "DateTime")
+ win.autodel = True
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.horizontal = False
+ bx.show()
+ bx.size_hint_min_set(360, 240)
+
+ dt = elementary.Datetime(bx)
+ dt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ dt.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ dt.field_visible_set(elementary.ELM_DATETIME_HOUR, False)
+ dt.field_visible_set(elementary.ELM_DATETIME_MINUTE, False)
+ dt.field_visible_set(elementary.ELM_DATETIME_AMPM, False)
+ bx.pack_end(dt)
+ dt.show()
+
+ dt = elementary.Datetime(bx)
+ dt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ dt.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ dt.field_visible_set(elementary.ELM_DATETIME_YEAR, False)
+ dt.field_visible_set(elementary.ELM_DATETIME_MONTH, False)
+ dt.field_visible_set(elementary.ELM_DATETIME_DATE, False)
+ bx.pack_end(dt)
+ dt.show()
+
+ dt = elementary.Datetime(bx)
+ dt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ dt.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+
+ # get the current local time
+ time1 = datetime.now()
+ # set the max year as 2030 and the remaining fields are equal to current time values
+ time1.replace(year = 130)
+ dt.value_max = time1
+ # set the min time limit as "1980 January 10th 02:30 PM"
+ time1.replace(year = 80, month = 4, day = 10, hour = 14, minute = 30)
+ dt.value_min = time1
+ # minutes can be input only in between 15 and 45
+ dt.field_limit = (elementary.ELM_DATETIME_MINUTE, 15, 45)
+ dt.callback_changed_add(changed_cb)
+ bx.pack_end(dt)
+ dt.show()
+
+ win.show()
+
+if __name__ == "__main__":
+ elementary.init()
+
+ datetime_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_dayselector.py b/examples/elementary/test_dayselector.py
new file mode 100644
index 0000000..3a6f829
--- /dev/null
+++ b/examples/elementary/test_dayselector.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_changed(ds):
+ print("\nSelected Days:")
+ print(("Sun:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_SUN)))
+ print(("Mon:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_MON)))
+ print(("Tue:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_TUE)))
+ print(("Wed:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_WED)))
+ print(("Thu:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_THU)))
+ print(("Fri:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_FRI)))
+ print(("Sat:", ds.day_selected_get(elementary.ELM_DAYSELECTOR_SAT)))
+
+
+def dayselector_clicked(obj):
+ win = elementary.Window("dayselector", elementary.ELM_WIN_BASIC)
+ win.title = "Dayselector test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box = elementary.Box(win)
+ box.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ box.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(box)
+ box.show()
+
+ # default
+ ds = elementary.Dayselector(win)
+ ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ box.pack_end(ds)
+ ds.show()
+ ds.callback_dayselector_changed_add(cb_changed)
+
+ # Sunday first
+ ds = elementary.Dayselector(win)
+ ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ box.pack_end(ds)
+ ds.show()
+ ds.callback_dayselector_changed_add(cb_changed)
+ try:
+ sunday = ds.part_content_get("day0")
+ sunday.signal_emit("elm,type,weekend,style1", "")
+ except:
+ print("BUG HERE !!!")
+
+ # Monday first
+ ds = elementary.Dayselector(win)
+ ds.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ds.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ ds.callback_dayselector_changed_add(cb_changed)
+ box.pack_end(ds)
+ ds.show()
+ ds.week_start = elementary.ELM_DAY_MONDAY
+ try:
+ sunday = ds.part_content_get("day0")
+ sunday.signal_emit("elm,type,weekend,style1", "")
+ except:
+ print("BUG HERE !!!")
+
+
+ win.resize(350, 120)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ dayselector_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_diskselector.py b/examples/elementary/test_diskselector.py
new file mode 100644
index 0000000..e898d70
--- /dev/null
+++ b/examples/elementary/test_diskselector.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+months=["January", "February", "March", "April", "May", "June", "August", "September", "October", "November", "December"]
+weekdays=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
+months_short=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+
+def disk_create(win, rnd):
+ di = elementary.Diskselector(win)
+ for m in months:
+ if m == "August":
+ it = di.item_append(m)
+ else:
+ di.item_append(m)
+
+ it.selected = True
+ di.round_enabled = rnd
+
+ return di
+
+def cb_sel(ds, item):
+ print(("Selected item: %s" % (item.text)))
+
+
+def diskselector_clicked(obj):
+ win = elementary.Window("diskselector", elementary.ELM_WIN_BASIC)
+ win.title = "Diskselector test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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()
+
+ di = disk_create(win, True)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.first_item.selected = True
+
+ di = disk_create(win, False)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.first_item.next.selected = True
+
+ di = disk_create(win, False)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.side_text_max_length = 4
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ di = elementary.Diskselector(win)
+ di.item_append("Sunday", ic)
+ for day in weekdays:
+ di.item_append(day)
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ di = elementary.Diskselector(win)
+ di.item_append("머리스타일", ic)
+ for lan in ["プロが伝授する", "生上访要求政府", "English", "والشريعة", "עִבְרִית", "Grüßen"]:
+ di.item_append(lan)
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+
+ di = elementary.Diskselector(win)
+ di.display_item_num = 5
+ for m in months_short:
+ di.item_append(m)
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.last_item.selected = True
+
+ di = elementary.Diskselector(win)
+ di.display_item_num = 7
+ for i in range(31):
+ di.item_append(str(i))
+ di.round_enabled = True
+ di.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ di.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ di.callback_selected_add(cb_sel)
+ vbox.pack_end(di)
+ di.show()
+ di.last_item.selected = True
+
+
+ win.resize(320, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ diskselector_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_entry.py b/examples/elementary/test_entry.py
new file mode 100644
index 0000000..826b941
--- /dev/null
+++ b/examples/elementary/test_entry.py
@@ -0,0 +1,228 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_entry_bt_1(bt, en):
+ en.entry_set("")
+
+def my_entry_bt_2(bt, en):
+ str = en.entry_get()
+ print(("ENTRY: %s" % str))
+
+def my_entry_bt_3(bt, en):
+ str = en.selection_get()
+ print(("SELECTION: %s" % str))
+
+def my_entry_bt_4(bt, en):
+ en.entry_insert("Insert some <b>BOLD</> text")
+
+def my_entry_anchor_test(obj, anchor, en, *args, **kwargs):
+ en.entry_insert("ANCHOR CLICKED")
+
+
+def entry_clicked(obj, item=None):
+ win = elementary.Window("entry", elementary.ELM_WIN_BASIC)
+ win.title_set("Entry")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ en = elementary.Entry(win)
+ en.line_wrap_set(False)
+ en.entry_set("This is an entry widget in this window that<br>"
+ "uses markup <b>like this</> for styling and<br>"
+ "formatting <em>like this</>, as well as<br>"
+ "<a href=X><link>links in the text</></a>, so enter text<br>"
+ "in here to edit it. By the way, links are<br>"
+ "called <a href=anc-02>Anchors</a> so you will need<br>"
+ "to refer to them this way.")
+ en.callback_anchor_clicked_add(my_entry_anchor_test, en)
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(en)
+ en.show()
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+ bt = elementary.Button(win)
+ bt.text_set("Clear")
+ bt.callback_clicked_add(my_entry_bt_1, en)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Print")
+ bt.callback_clicked_add(my_entry_bt_2, en)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Selection")
+ bt.callback_clicked_add(my_entry_bt_3, en)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Insert")
+ bt.callback_clicked_add(my_entry_bt_4, en)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx.pack_end(bx2)
+ bx2.show()
+
+ en.focus_set(True)
+ win.show()
+
+
+def entry_scrolled_clicked(obj, item=None):
+ win = elementary.Window("entry", elementary.ELM_WIN_BASIC)
+ win.title_set("Scrolled Entry")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ en = elementary.Entry(win)
+ win.resize_object_add(en)
+ en.scrollable_set(True)
+ en.line_wrap_set(False)
+ en.entry_set("This is an entry widget in this window that<br>"
+ "uses markup <b>like this</> for styling and<br>"
+ "formatting <em>like this</>, as well as<br>"
+ "<a href=X><link>links in the text</></a>, so enter text<br>"
+ "in here to edit it. By the way, links are<br>"
+ "called <a href=anc-02>Anchors</a> so you will need<br>"
+ "to refer to them this way.<br><br>" * 10)
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ en.size_hint_min_set(200, 200)
+ en.show()
+
+ en.focus_set(True)
+ win.show()
+
+
+def anchor_clicked(obj, event_info):
+ print(("Entry object is %s" % (obj)))
+ print(("We should have EntryAnchorInfo here: %s" % (str(event_info))))
+ print(("EntryAnchorInfo has the following properties and methods: %s" % (dir(event_info))))
+
+def anchor_hover_opened(obj, event_info):
+ print(("We should have EntryAnchorHoverInfo here: %s" % (event_info)))
+ print(("EntryAnchorHoverInfo has the following properties and methods: %s" % (dir(event_info))))
+ btn = Button(obj)
+ btn.text_set("Testing entry anchor")
+ event_info.hover.content_set("middle", btn)
+ btn.show()
+
+def entry_anchor_clicked(obj, item=None):
+ win = elementary.Window("entry", elementary.ELM_WIN_BASIC)
+ win.title_set("Entry Anchor")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(1.0, 1.0)
+ win.resize_object_add(bg)
+ bg.show()
+
+ box = elementary.Box(win)
+ box.size_hint_weight_set(1.0, 1.0)
+ win.resize_object_add(box)
+
+ entry = elementary.Entry(win)
+ entry.text_set("<a href=url:http://www.enlightenment.org/>Enlightenment</a>")
+ entry.callback_anchor_clicked_add(anchor_clicked)
+ entry.anchor_hover_style_set("popout")
+ entry.anchor_hover_parent_set(win)
+ entry.callback_anchor_hover_opened_add(anchor_hover_opened)
+ entry.show()
+
+ frame = elementary.Frame(win)
+ frame.size_hint_align_set(-1.0, -1.0)
+ frame.text_set("Entry test")
+ frame.content_set(entry)
+ frame.show()
+
+ box.pack_end(frame)
+ box.show()
+
+ win.resize(400, 400)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Entry", entry_clicked),
+ ("Entry Scrolled", entry_scrolled_clicked),
+ ("Entry Anchor", entry_anchor_clicked)
+ ]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_external.edj b/examples/elementary/test_external.edj
new file mode 100644
index 0000000..2c3b8f6
--- /dev/null
+++ b/examples/elementary/test_external.edj
Binary files differ
diff --git a/examples/elementary/test_external.py b/examples/elementary/test_external.py
new file mode 100644
index 0000000..8f5fea1
--- /dev/null
+++ b/examples/elementary/test_external.py
@@ -0,0 +1,180 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import evas
+from efl import ecore
+from efl import elementary
+
+
+
+def edje_external_button_clicked(obj, item=None):
+ win = elementary.Window("edje-external-button", elementary.ELM_WIN_BASIC)
+ win.title_set("Edje External Button")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ ly = elementary.Layout(win)
+ ly.file_set("test_external.edj", "external/button")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ win.resize(320, 400)
+ win.show()
+
+
+def animate(ly):
+ val = ly.edje_get().part_external_object_get("ext_pbar1").value
+ val += 0.0123
+
+ for part_name in ["ext_pbar1", "ext_pbar3", "ext_pbar4", "ext_pbar6"]:
+ ly.edje_get().part_external_object_get(part_name).value = val
+
+ if val < 1:
+ ecore.timer_add(0.1, animate, ly)
+ else:
+ for part_name in ["ext_pbar2", "ext_pbar5", "ext_pbar7"]:
+ ly.edje_get().part_external_object_get(part_name).pulse(False)
+ for part_name in ["ext_button1", "ext_button2", "ext_button3"]:
+ ly.edje_get().part_external_object_get(part_name).disabled = False
+
+ return False
+
+def cb_btn3_clicked(bt, ly):
+ ly.edje_get().part_external_object_get("ext_pbar1").value = 0.0
+
+ for part_name in ["ext_pbar2", "ext_pbar5", "ext_pbar7"]:
+ ly.edje_get().part_external_object_get(part_name).pulse(True)
+ for part_name in ["ext_button1", "ext_button2", "ext_button3"]:
+ ly.edje_get().part_external_object_get(part_name).disabled = True
+
+ ecore.timer_add(0.1, animate, ly)
+
+def edje_external_pbar_clicked(obj, item=None):
+ win = elementary.Window("edje-external-pbar", elementary.ELM_WIN_BASIC)
+ win.title_set("Edje External Progress Bar")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ ly = elementary.Layout(win)
+ ly.file_set("test_external.edj", "external/pbar")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ bt = ly.edje_get().part_external_object_get("ext_button3")
+ bt.text = "...or from Python"
+ bt.callback_clicked_add(cb_btn3_clicked, ly)
+
+ win.resize(320, 400)
+ win.show()
+
+
+def edje_external_scroller_clicked(obj, item=None):
+ win = elementary.Window("edje-external-scroller", elementary.ELM_WIN_BASIC)
+ win.title_set("Edje External Scroller")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ ly = elementary.Layout(win)
+ ly.file_set("test_external.edj", "external/scroller")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ win.resize(320, 400)
+ win.show()
+
+
+def edje_external_slider_clicked(obj, item=None):
+ win = elementary.Window("edje-external-slider", elementary.ELM_WIN_BASIC)
+ win.title_set("Edje External Slider")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ ly = elementary.Layout(win)
+ ly.file_set("test_external.edj", "external/slider")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ win.resize(320, 400)
+ win.show()
+
+
+def edje_external_video_clicked(obj, item=None):
+ win = elementary.Window("edje-external-video", elementary.ELM_WIN_BASIC)
+ win.title_set("Edje External Video")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ ly = elementary.Layout(win)
+ ly.file_set("test_external.edj", "external/video")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ win.resize(320, 400)
+ win.show()
+
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Ext Button", edje_external_button_clicked),
+ ("Ext ProgressBar", edje_external_pbar_clicked),
+ ("Ext Scroller", edje_external_scroller_clicked),
+ ("Ext Slider", edje_external_slider_clicked),
+ ("Ext Video", edje_external_video_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+ ecore.shutdown()
+ evas.shutdown()
diff --git a/examples/elementary/test_fileselector.py b/examples/elementary/test_fileselector.py
new file mode 100644
index 0000000..cfde09a
--- /dev/null
+++ b/examples/elementary/test_fileselector.py
@@ -0,0 +1,340 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os
+from efl import elementary
+from efl import evas
+
+
+
+def fs_cb_done(fs, selected, win):
+ win.delete()
+
+def fs_cb_selected(fs, selected, win):
+ print(("Selected file:", selected))
+ print((" or:", fs.selected_get()))
+
+def fs_cb_directory_open(fs, folder, win):
+ print(("Folder open:", folder))
+
+def ck_cb_is_save(bt, fs):
+ print("Toggle is save")
+ fs.is_save = not fs.is_save
+
+def ck_cb_folder_only(bt, fs):
+ print("Toggle folder_only")
+ fs.folder_only = not fs.folder_only
+
+def ck_cb_expandable(bt, fs):
+ print("Toggle expandable")
+ fs.expandable = not fs.expandable
+
+def ck_cb_buttons(bt, fs):
+ print("Toggle buttons_ok_cancel")
+ fs.buttons_ok_cancel = not fs.buttons_ok_cancel
+
+def bt_cb_sel_get(bt, fs):
+ print(("Get Selected:", fs.selected_get()))
+
+def bt_cb_path_get(bt, fs):
+ print(("Get Path:", fs.path_get()))
+
+def bt_cb_mode_cycle(bt, fs):
+ mode = fs.mode + 1
+ fs.mode_set(mode if mode < 2 else 0)
+
+
+def fileselector_clicked(obj, item=None):
+ win = elementary.Window("fileselector", elementary.ELM_WIN_BASIC)
+ win.title_set("File selector test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ win.resize_object_add(vbox)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.show()
+
+ fs = elementary.Fileselector(win)
+ fs.is_save_set(True)
+ fs.expandable_set(False)
+ fs.folder_only_set(False)
+ fs.path_set(os.getenv("HOME"))
+ fs.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fs.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fs.callback_done_add(fs_cb_done, win)
+ fs.callback_selected_add(fs_cb_selected, win)
+ fs.callback_directory_open_add(fs_cb_directory_open, win)
+ vbox.pack_end(fs)
+ fs.show()
+
+ sep = elementary.Separator(win)
+ sep.horizontal_set(True)
+ vbox.pack_end(sep)
+ sep.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal_set(True)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("is_save")
+ ck.state_set(fs.is_save)
+ ck.callback_changed_add(ck_cb_is_save, fs)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("folder_only")
+ ck.state_set(fs.folder_only)
+ ck.callback_changed_add(ck_cb_folder_only, fs)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("expandable")
+ ck.state_set(fs.expandable)
+ ck.callback_changed_add(ck_cb_expandable, fs)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("buttons")
+ ck.state_set(fs.buttons_ok_cancel)
+ ck.callback_changed_add(ck_cb_buttons, fs)
+ hbox.pack_end(ck)
+ ck.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal_set(True)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("selected_get")
+ bt.callback_clicked_add(bt_cb_sel_get, fs)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("path_get")
+ bt.callback_clicked_add(bt_cb_path_get, fs)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("mode cycle")
+ bt.callback_clicked_add(bt_cb_mode_cycle, fs)
+ hbox.pack_end(bt)
+ bt.show()
+
+ win.resize(240, 350)
+ win.show()
+
+
+def fileselector_button_clicked(obj, item=None):
+ win = elementary.Window("fileselector", elementary.ELM_WIN_BASIC)
+ win.title_set("File selector test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ win.resize_object_add(vbox)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.show()
+
+ fse = elementary.FileselectorButton(win)
+ fse.text_set("Select a file")
+ fse.inwin_mode_set(False)
+ fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(fse)
+ fse.show()
+
+ sep = elementary.Separator(win)
+ sep.horizontal_set(True)
+ vbox.pack_end(sep)
+ sep.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal_set(True)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("inwin")
+ ck.state_set(fse.inwin_mode)
+ ck.callback_changed_add(ck_entry_cb_inwin, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("folder_only")
+ ck.state_set(fse.folder_only)
+ ck.callback_changed_add(ck_entry_cb_folder_only, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("is_save")
+ ck.state_set(fse.is_save)
+ ck.callback_changed_add(ck_entry_cb_is_save, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("expandable")
+ ck.state_set(fse.expandable)
+ ck.callback_changed_add(ck_entry_cb_expandable, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ win.resize(240, 350)
+ win.show()
+
+
+def ck_entry_cb_is_save(bt, fse):
+ print("Toggle is save")
+ fse.is_save = not fse.is_save
+
+def ck_entry_cb_inwin(bt, fse):
+ print("Toggle inwin mode")
+ fse.inwin_mode = not fse.inwin_mode
+
+def ck_entry_cb_folder_only(bt, fse):
+ print("Toggle folder_only")
+ fse.folder_only = not fse.folder_only
+
+def ck_entry_cb_expandable(bt, fse):
+ print("Toggle expandable")
+ fse.expandable = not fse.expandable
+
+
+def fileselector_entry_clicked(obj, item=None):
+ win = elementary.Window("fileselector", elementary.ELM_WIN_BASIC)
+ win.title_set("File selector test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ win.resize_object_add(vbox)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.show()
+
+ fse = elementary.FileselectorEntry(win)
+ fse.text_set("Select a file")
+ fse.inwin_mode_set(False)
+ fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(fse)
+ fse.show()
+
+ sep = elementary.Separator(win)
+ sep.horizontal_set(True)
+ vbox.pack_end(sep)
+ sep.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal_set(True)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("inwin")
+ ck.state_set(fse.inwin_mode)
+ ck.callback_changed_add(ck_entry_cb_inwin, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("folder_only")
+ ck.state_set(fse.folder_only)
+ ck.callback_changed_add(ck_entry_cb_folder_only, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("is_save")
+ ck.state_set(fse.is_save)
+ ck.callback_changed_add(ck_entry_cb_is_save, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text_set("expandable")
+ ck.state_set(fse.expandable)
+ ck.callback_changed_add(ck_entry_cb_expandable, fse)
+ hbox.pack_end(ck)
+ ck.show()
+
+ win.resize(240, 150)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Fileselector", fileselector_clicked),
+ ("Fileselector Button", fileselector_button_clicked),
+ ("Fileselector Entry", fileselector_entry_clicked),
+ ]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_flip.py b/examples/elementary/test_flip.py
new file mode 100644
index 0000000..f7be694
--- /dev/null
+++ b/examples/elementary/test_flip.py
@@ -0,0 +1,300 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_flip_go(bt, fl, mode):
+ fl.go(mode)
+
+def my_flip_animate_begin(fl):
+ print("Animation Begin")
+
+def my_flip_animate_done(fl):
+ print("Animation Done")
+
+def flip_clicked(obj, item=None):
+ # window
+ win = elementary.Window("flip", elementary.ELM_WIN_BASIC)
+ win.autodel_set(True)
+ win.title_set("Flip")
+
+ # background
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ # main vertical box
+ box = elementary.Box(win)
+ box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box)
+ box.show()
+
+ # flip object
+ fl = elementary.Flip(win)
+ fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fl.callback_animate_begin_add(my_flip_animate_begin)
+ fl.callback_animate_done_add(my_flip_animate_done)
+ box.pack_end(fl)
+ fl.show()
+
+
+ # front content (image)
+ o = elementary.Background(win)
+ o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ o.file_set("images/sky_01.jpg")
+ fl.part_content_set("front", o)
+ o.show()
+
+ # back content (layout)
+ ly = elementary.Layout(win)
+ ly.file_set("test.edj", "layout")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fl.part_content_set("back", ly)
+ ly.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 1")
+ ly.part_content_set("element1", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 2")
+ ly.part_content_set("element2", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 3")
+ ly.part_content_set("element3", bt)
+ bt.show()
+
+ # flip buttons (first row)
+ hbox = elementary.Box(win)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ hbox.horizontal_set(True)
+ hbox.show()
+ box.pack_end(hbox)
+ count = 1
+
+ for mode in [elementary.ELM_FLIP_ROTATE_X_CENTER_AXIS,
+ elementary.ELM_FLIP_ROTATE_Y_CENTER_AXIS,
+ elementary.ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
+ elementary.ELM_FLIP_ROTATE_YZ_CENTER_AXIS]:
+ bt = elementary.Button(win)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.text_set(str(count))
+ bt.callback_clicked_add(my_flip_go, fl, mode)
+ hbox.pack_end(bt)
+ bt.show()
+ count += 1
+
+ # flip buttons (second row)
+ hbox = elementary.Box(win)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ hbox.horizontal_set(True)
+ hbox.show()
+ box.pack_end(hbox)
+
+ for mode in [elementary.ELM_FLIP_CUBE_LEFT,
+ elementary.ELM_FLIP_CUBE_RIGHT,
+ elementary.ELM_FLIP_CUBE_UP,
+ elementary.ELM_FLIP_CUBE_DOWN]:
+ bt = elementary.Button(win)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.text_set(str(count))
+ bt.callback_clicked_add(my_flip_go, fl, mode)
+ hbox.pack_end(bt)
+ bt.show()
+ count += 1
+
+ # flip buttons (third row)
+ hbox = elementary.Box(win)
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ hbox.horizontal_set(True)
+ hbox.show()
+ box.pack_end(hbox)
+
+ for mode in [elementary.ELM_FLIP_PAGE_LEFT,
+ elementary.ELM_FLIP_PAGE_RIGHT,
+ elementary.ELM_FLIP_PAGE_UP,
+ elementary.ELM_FLIP_PAGE_DOWN]:
+ bt = elementary.Button(win)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.text_set(str(count))
+ bt.callback_clicked_add(my_flip_go, fl, mode)
+ hbox.pack_end(bt)
+ bt.show()
+ count += 1
+
+ # window show
+ win.resize(320, 320)
+ win.show()
+
+
+def my_cb_radios (rd, fl):
+ print((rd.value_get()))
+ fl.interaction_set(rd.value_get())
+
+def flip_interactive_clicked(obj, item=None):
+ # window
+ win = elementary.Window("flip", elementary.ELM_WIN_BASIC)
+ win.autodel_set(True)
+ win.title_set("Flip")
+
+ # background
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ # main vertical box
+ box = elementary.Box(win)
+ box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box)
+ box.show()
+
+ # flip object
+ fl = elementary.Flip(win)
+ fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fl.interaction_set(elementary.ELM_FLIP_INTERACTION_NONE);
+ fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_UP, True);
+ fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_DOWN, True);
+ fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_LEFT, True);
+ fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_RIGHT, True);
+ fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_UP, 0.25);
+ fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_DOWN, 0.25);
+ fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_LEFT, 0.25);
+ fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_RIGHT, 0.25);
+ fl.callback_animate_begin_add(my_flip_animate_begin)
+ fl.callback_animate_done_add(my_flip_animate_done)
+ box.pack_end(fl)
+ fl.show()
+
+ # front content (image)
+ o = elementary.Background(win)
+ o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ o.file_set("images/sky_01.jpg")
+ fl.part_content_set("front", o)
+ o.show()
+
+ # back content (layout)
+ ly = elementary.Layout(win)
+ ly.file_set("test.edj", "layout")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fl.part_content_set("back", ly)
+ ly.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 1")
+ ly.part_content_set("element1", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 2")
+ ly.part_content_set("element2", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 3")
+ ly.part_content_set("element3", bt)
+ bt.show()
+
+
+ # radio buttons
+ rd = elementary.Radio(win)
+ rd.state_value_set(elementary.ELM_FLIP_INTERACTION_NONE)
+ rd.text_set("None")
+ rd.callback_changed_add(my_cb_radios, fl)
+ box.pack_end(rd)
+ rd.show()
+ rdg = rd
+
+ rd = elementary.Radio(win)
+ rd.state_value_set(elementary.ELM_FLIP_INTERACTION_ROTATE)
+ rd.text_set("Rotate")
+ rd.callback_changed_add(my_cb_radios, fl)
+ rd.group_add(rdg)
+ box.pack_end(rd)
+ rd.show()
+
+ rd = elementary.Radio(win)
+ rd.state_value_set(elementary.ELM_FLIP_INTERACTION_CUBE)
+ rd.text_set("Cube")
+ rd.callback_changed_add(my_cb_radios, fl)
+ rd.group_add(rdg)
+ box.pack_end(rd)
+ rd.show()
+
+ rd = elementary.Radio(win)
+ rd.state_value_set(elementary.ELM_FLIP_INTERACTION_PAGE)
+ rd.text_set("Page")
+ rd.callback_changed_add(my_cb_radios, fl)
+ rd.group_add(rdg)
+ box.pack_end(rd)
+ rd.show()
+
+ # window show
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Flip", flip_clicked),
+ ("Flip Interactive", flip_interactive_clicked),
+ ]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_flipselector.py b/examples/elementary/test_flipselector.py
new file mode 100644
index 0000000..6fdec19
--- /dev/null
+++ b/examples/elementary/test_flipselector.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def sel_cb(fp, *args):
+ if args:
+ print("label of selected item is: %s\n" % args[0].text)
+
+def unsel_cb(bt, fp):
+ fp.selected_item.selected = False
+
+def last_cb(bt, fp):
+ fp.last_item.selected = True
+
+def third_from_end_cb(bt, fp):
+ fp.last_item.prev.prev.selected = True
+
+def underflow_cb(fp):
+ print("underflow!\n")
+
+def overflow_cb(fp):
+ print("overflow!\n")
+
+def slider_change_cb(sl, fp):
+ fp.first_interval = sl.value
+
+def flip_next_cb(bt, fp):
+ fp.next()
+
+def flip_prev_cb(bt, fp):
+ fp.prev()
+
+def flipselector_clicked(obj):
+ lbl = (
+ "Elementary",
+ "Evas",
+ "Eina",
+ "Edje",
+ "Eet",
+ "Ecore",
+ "Efreet",
+ "Edbus"
+ )
+
+ win = elementary.StandardWindow("flipselector", "Flip Selector")
+ win.autodel = True
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ fp = elementary.FlipSelector(win)
+ fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fp.callback_selected_add(sel_cb)
+ fp.callback_underflowed_add(overflow_cb)
+ fp.callback_overflowed_add(underflow_cb)
+ for i in range(0, len(lbl)):
+ it = fp.item_append(lbl[i])
+ if (i == 3):
+ edje_it = it
+ edje_it.selected = True
+ bx.pack_end(fp)
+ fp.show()
+
+ bx2 = elementary.Box(win)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx2.horizontal = True
+ bx.pack_end(bx2)
+ bx2.show()
+
+ fp = elementary.FlipSelector(win)
+ fp.callback_underflowed_add(overflow_cb)
+ fp.callback_overflowed_add(underflow_cb)
+ fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ for i in range(1990, 2100):
+ fp.item_append(str(i), sel_cb)
+
+ bt = elementary.Button(win)
+ bt.text = "Flip Prev"
+ bt.callback_clicked_add(flip_prev_cb, fp)
+
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx2.pack_end(fp)
+ fp.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Flip Next"
+ bt.callback_clicked_add(flip_next_cb, fp)
+ bx2.pack_end(bt)
+ bt.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Flip Iterval:"
+ sl.unit_format = "%1.2f"
+ sl.min_max = (0.0, 3.0)
+ sl.value = (0.85)
+ sl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(sl)
+ sl.show()
+ sl.callback_changed_add(slider_change_cb, fp)
+
+ bt = elementary.Button(win)
+ bt.text = "Select Last"
+ bt.callback_clicked_add(last_cb, fp)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Select 2097"
+ bt.callback_clicked_add(third_from_end_cb, fp)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Unselect year"
+ bt.callback_clicked_add(unsel_cb, fp)
+ bx.pack_end(bt)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ flipselector_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_frame.py b/examples/elementary/test_frame.py
new file mode 100644
index 0000000..73131a0
--- /dev/null
+++ b/examples/elementary/test_frame.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def frame_clicked(obj):
+ win = elementary.Window("frame", elementary.ELM_WIN_BASIC)
+ win.title_set("Frame test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ # frame 1
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+
+ fr = elementary.Frame(win)
+ fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fr.text_set("Frame title")
+ fr.content_set(ic)
+ vbox.pack_end(fr)
+ fr.show()
+
+ # frame 2 (collapsable)
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+
+ fr = elementary.Frame(win)
+ fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ fr.autocollapse_set(True)
+ fr.text_set("Frame collapsable (BROKEN)")
+ fr.content_set(ic)
+ vbox.pack_end(fr)
+ fr.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ frame_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_gengrid.py b/examples/elementary/test_gengrid.py
new file mode 100644
index 0000000..97c940b
--- /dev/null
+++ b/examples/elementary/test_gengrid.py
@@ -0,0 +1,394 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import random
+
+from efl import elementary
+from efl import evas
+
+
+images = ["panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg",
+ "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg", "wood_01.jpg"]
+
+
+def gg_text_get(obj, part, item_data):
+ return "Item # %s" % (item_data)
+
+def gg_content_get(obj, part, data):
+ if part == "elm.swallow.icon":
+ im = elementary.Image(obj)
+ im.file_set("images/" + random.choice(images))
+ im.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1)
+ return im
+ return None
+
+def gg_state_get(obj, part, item_data):
+ return False
+
+def gg_del(obj, item_data):
+ # commented out because this make clear() slow with many items
+ # print "[item del] # %d - %s" % (item_data, obj)
+ pass
+
+def gg_sel(gg, ggi, *args, **kwargs):
+ (x, y) = ggi.pos_get()
+ print(("[item selected] # %d at pos %d %d" % (ggi.data, x, y)))
+
+def gg_unsel(gg, ggi, *args, **kwargs):
+ print(("[item unselected] # %d" % (ggi.data)))
+
+def gg_clicked_double(gg, ggi, *args, **kwargs):
+ print(("[item double clicked] # %d" % (ggi.data)))
+
+
+def gengrid_clicked(obj):
+
+ global item_count
+ item_count = 5#25
+
+ # window
+ win = elementary.Window("gengrid", elementary.ELM_WIN_BASIC)
+ win.title_set("Gengrid")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ # background
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ # main table
+ tb = elementary.Table(win)
+ win.resize_object_add(tb)
+ tb.homogeneous_set(0)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb.show()
+
+ # gengrid
+ itc = elementary.GengridItemClass(item_style="default",
+ text_get_func=gg_text_get,
+ content_get_func=gg_content_get,
+ state_get_func=gg_state_get,
+ del_func=gg_del)
+ gg = elementary.Gengrid(win)
+ gg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ gg.horizontal_set(False)
+ gg.bounce_set(False, True)
+ gg.item_size_set(80, 80)
+ gg.align_set(0.5, 0.0)
+ tb.pack(gg, 0, 0, 6, 1)
+ gg.callback_selected_add(gg_sel)
+ gg.callback_unselected_add(gg_unsel)
+ gg.callback_clicked_double_add(gg_clicked_double)
+ gg.show()
+
+ # add the first items
+ for i in range(item_count):
+ gg.item_append(itc, i, None)
+
+
+ # multi select
+ def multi_select_changed(bt, gg):
+ gg.multi_select_set(bt.state)
+ print((gg.multi_select_get()))
+
+ bt = elementary.Check(win)
+ bt.text = "MultiSelect"
+ bt.state = gg.multi_select_get()
+ bt.callback_changed_add(multi_select_changed, gg)
+ tb.pack(bt, 0, 1, 1, 1)
+ bt.show()
+
+ # horizontal
+ def horizontal_changed(bt, gg):
+ gg.horizontal_set(bt.state)
+
+ bt = elementary.Check(win)
+ bt.text_set("Horizontal")
+ bt.callback_changed_add(horizontal_changed, gg)
+ tb.pack(bt, 1, 1, 1, 1)
+ bt.show()
+
+ # bounce h
+ def bounce_h_changed(bt, gg):
+ (h_bounce, v_bounce) = gg.bounce_get()
+ gg.bounce_set(bt.state, v_bounce)
+ print((gg.bounce_get()))
+
+ bt = elementary.Check(win)
+ bt.text_set("BounceH")
+ (h_bounce, v_bounce) = gg.bounce_get()
+ bt.state = h_bounce
+ bt.callback_changed_add(bounce_h_changed, gg)
+ tb.pack(bt, 4, 1, 1, 1)
+ bt.show()
+
+ # bounce v
+ def bounce_v_changed(bt, gg):
+ (h_bounce, v_bounce) = gg.bounce_get()
+ gg.bounce_set(h_bounce, bt.state)
+ print((gg.bounce_get()))
+
+ bt = elementary.Check(win)
+ bt.text_set("BounceV")
+ (h_bounce, v_bounce) = gg.bounce_get()
+ bt.state = v_bounce
+ bt.callback_changed_add(bounce_v_changed, gg)
+ tb.pack(bt, 5, 1, 1, 1)
+ bt.show()
+
+ # item size
+ def item_size_w_changed(sl, gg):
+ (w, h) = gg.item_size_get()
+ gg.item_size_set(sl.value, h)
+ print((gg.item_size_get()))
+
+ def item_size_h_changed(sl, gg):
+ (w, h) = gg.item_size_get()
+ gg.item_size_set(w, sl.value)
+ print((gg.item_size_get()))
+
+ sl = elementary.Slider(win)
+ sl.text_set("ItemSizeW")
+ sl.min_max_set(0, 500)
+ sl.indicator_format_set("%.0f")
+ sl.unit_format_set("%.0f")
+ sl.span_size_set(100)
+ (w, h) = gg.item_size_get()
+ sl.value = w
+ sl.callback_changed_add(item_size_w_changed, gg)
+ tb.pack(sl, 0, 2, 2, 1)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text_set("ItemSizeH")
+ sl.min_max_set(0, 500)
+ sl.indicator_format_set("%.0f")
+ sl.unit_format_set("%.0f")
+ sl.span_size_set(100)
+ (w, h) = gg.item_size_get()
+ sl.value = h
+ sl.callback_changed_add(item_size_h_changed, gg)
+ tb.pack(sl, 0, 3, 2, 1)
+ sl.show()
+
+ # align
+ def alignx_changed(sl, gg):
+ (ax, ay) = gg.align_get()
+ gg.align_set(sl.value, ay)
+ print((gg.align_get()))
+
+ def aligny_changed(sl, gg):
+ (ax, ay) = gg.align_get()
+ gg.align_set(ax, sl.value)
+ print((gg.align_get()))
+
+ sl = elementary.Slider(win)
+ sl.text_set("AlignX")
+ sl.min_max_set(0.0, 1.0)
+ sl.indicator_format_set("%.2f")
+ sl.unit_format_set("%.2f")
+ sl.span_size_set(100)
+ (ax, ay) = gg.align_get()
+ sl.value = ax
+ sl.callback_changed_add(alignx_changed, gg)
+ tb.pack(sl, 0, 4, 2, 1)
+ sl.show()
+
+ sl = elementary.Slider(win)
+ sl.text_set("AlignY")
+ sl.min_max_set(0.0, 1.0)
+ sl.indicator_format_set("%.2f")
+ sl.unit_format_set("%.2f")
+ sl.span_size_set(100)
+ (ax, ay) = gg.align_get()
+ sl.value = ax
+ sl.callback_changed_add(aligny_changed, gg)
+ tb.pack(sl, 0, 5, 2, 1)
+ sl.show()
+
+ # select first
+ def select_first_clicked(bt, gg):
+ ggi = gg.first_item
+ ggi.selected = not ggi.selected
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Select first")
+ bt.callback_clicked_add(select_first_clicked, gg)
+ tb.pack(bt, 2, 2, 1, 1)
+ bt.show()
+
+ # select last
+ def select_last_clicked(bt, gg):
+ ggi = gg.last_item
+ ggi.selected = not ggi.selected
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Select last")
+ bt.callback_clicked_add(select_last_clicked, gg)
+ tb.pack(bt, 3, 2, 1, 1)
+ bt.show()
+
+ # selection del
+ def seldel_clicked(bt, gg):
+ for ggi in gg.selected_items_get():
+ ggi.delete()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Sel del")
+ bt.callback_clicked_add(seldel_clicked, gg)
+ tb.pack(bt, 4, 2, 1, 1)
+ bt.show()
+
+ # clear
+ def clear_clicked(bt, gg):
+ global item_count
+ item_count = 0
+ gg.clear()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Clear")
+ bt.callback_clicked_add(clear_clicked, gg)
+ tb.pack(bt, 5, 2, 1, 1)
+ bt.show()
+
+ # show first/last
+ def show_clicked(bt, gg, first):
+ ggi = gg.first_item if first else gg.last_item
+ ggi.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Show first")
+ bt.callback_clicked_add(show_clicked, gg, True)
+ tb.pack(bt, 2, 3, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Show last")
+ bt.callback_clicked_add(show_clicked, gg, False)
+ tb.pack(bt, 3, 3, 1, 1)
+ bt.show()
+
+ # bring-in first/last
+ def bring_in_clicked(bt, gg, first):
+ ggi = gg.first_item if first else gg.last_item
+ ggi.bring_in()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("BringIn first")
+ bt.callback_clicked_add(bring_in_clicked, gg, True)
+ tb.pack(bt, 4, 3, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("BringIn last")
+ bt.callback_clicked_add(bring_in_clicked, gg, False)
+ tb.pack(bt, 5, 3, 1, 1)
+ bt.show()
+
+ # append
+ def append_clicked(bt, gg, n):
+ global item_count
+ while n:
+ item_count += 1
+ gg.item_append(itc, item_count, None)
+ n -= 1
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Append 1")
+ bt.callback_clicked_add(append_clicked, gg, 1)
+ tb.pack(bt, 2, 4, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Append 100")
+ bt.callback_clicked_add(append_clicked, gg, 100)
+ tb.pack(bt, 3, 4, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Append 1000")
+ bt.callback_clicked_add(append_clicked, gg, 1000)
+ tb.pack(bt, 4, 4, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Append 10000 :)")
+ bt.callback_clicked_add(append_clicked, gg, 10000)
+ tb.pack(bt, 5, 4, 1, 1)
+ bt.show()
+
+ # prepend
+ def prepend_clicked(bt, gg):
+ global item_count
+ item_count += 1
+ gg.item_prepend(itc, item_count)
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Prepend")
+ bt.callback_clicked_add(prepend_clicked, gg)
+ tb.pack(bt, 2, 5, 1, 1)
+ bt.show()
+
+ # insert_before
+ def ins_before_clicked(bt, gg):
+ global item_count
+ item_count += 1
+ before = gg.selected_item_get()
+ if before:
+ gg.item_insert_before(itc, item_count, before)
+ else:
+ print("nothing selected")
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Ins before")
+ bt.callback_clicked_add(ins_before_clicked, gg)
+ tb.pack(bt, 3, 5, 1, 1)
+ bt.show()
+
+ # insert_after
+ def ins_after_clicked(bt, gg):
+ global item_count
+ item_count += 1
+ after = gg.selected_item_get()
+ if after:
+ gg.item_insert_after(itc, item_count, after)
+ else:
+ print("nothing selected")
+
+ bt = elementary.Button(win)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
+ bt.text_set("Ins after")
+ bt.callback_clicked_add(ins_after_clicked, gg)
+ tb.pack(bt, 4, 5, 1, 1)
+ bt.show()
+
+ print gg
+ win.resize(480, 800)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ gengrid_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_genlist.py b/examples/elementary/test_genlist.py
new file mode 100644
index 0000000..e9a94aa
--- /dev/null
+++ b/examples/elementary/test_genlist.py
@@ -0,0 +1,443 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def gl_text_get(obj, part, item_data):
+ return "Item # %i" % (item_data,)
+
+def gl_content_get(obj, part, data):
+ ic = elementary.Icon(obj)
+ ic.file_set("images/logo_small.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ return ic
+
+def gl_state_get(obj, part, item_data):
+ return False
+
+def gl_item_sel(gli, gl, *args, **kwargs):
+ print("\n---GenlistItem selected---")
+ print(gli)
+ print(gl)
+ print(args)
+ print(kwargs)
+ print(("item_data: %s" % gli.data_get()))
+
+def glg_text_get(obj, part, item_data):
+ return "Group # %i" % (item_data,)
+
+def glg_content_get(obj, part, data):
+ ic = elementary.Icon(obj)
+ ic.file_set("images/logo.png")
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ return ic
+
+def _gl_selected(gl, gli, *args, **kwargs):
+ print("\n---Genlist selected---")
+ print(gl)
+ print(gli)
+ print(args)
+ print(kwargs)
+
+def _gl_clicked_double(gl, gli, *args, **kwargs):
+ print("\n---Genlist double clcked---")
+ print(gl)
+ print(gli)
+ print(args)
+ print(kwargs)
+
+def _gl_longpressed(gl, gli, *args, **kwargs):
+ print("\n---Genlist longpressed---")
+ print(gl)
+ print(gli)
+ print(args)
+ print(kwargs)
+
+def _gl_over_click(evas, evt, gl):
+ print("\n---OverRect click---")
+ gli = gl.at_xy_item_get(evt.position.canvas.x, evt.position.canvas.y)
+ if gli:
+ print(gli)
+ else:
+ print("over none")
+
+
+def genlist_clicked(obj, item=None):
+ win = elementary.Window("Genlist", elementary.ELM_WIN_BASIC)
+ win.title_set("Genlist test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ gl = elementary.Genlist(win)
+ gl.callback_selected_add(_gl_selected, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
+ gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
+ gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
+ gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(gl)
+ gl.show()
+
+ over = evas.Rectangle(win.evas_get())
+ over.color_set(0, 0, 0, 0)
+ over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl)
+ over.repeat_events_set(True)
+ over.show()
+ over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(over)
+
+ vbx = elementary.Box(win)
+ vbx.horizontal_set(True)
+ bx.pack_end(vbx)
+ vbx.show()
+
+ itc1 = elementary.GenlistItemClass(item_style="default",
+ text_get_func=gl_text_get,
+ content_get_func=gl_content_get,
+ state_get_func=gl_state_get)
+
+ bt_50 = elementary.Button(win)
+ bt_50.text_set("Go to 50")
+ vbx.pack_end(bt_50)
+ bt_50.show()
+
+ bt_1500 = elementary.Button(win)
+ bt_1500.text_set("Go to 1500")
+ vbx.pack_end(bt_1500)
+ bt_1500.show()
+
+ for i in range(0, 2000):
+ gli = gl.item_append(itc1, i, func=gl_item_sel)
+ if i == 50:
+ bt_50._callback_add("clicked", lambda bt, it: it.bring_in(), gli)
+ elif i == 1500:
+ bt_1500._callback_add("clicked", lambda bt, it: it.bring_in(), gli)
+
+ win.resize(480, 800)
+ win.show()
+
+
+def genlist2_clicked(obj, item=None):
+ win = elementary.Window("Genlist", elementary.ELM_WIN_BASIC)
+ win.title_set("Genlist test 2")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.file_set("images/plant_01.jpg")
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ gl = elementary.Genlist(win)
+ gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gl.show()
+
+ itc1 = elementary.GenlistItemClass(item_style="default",
+ text_get_func=gl_text_get,
+ content_get_func=gl_content_get,
+ state_get_func=gl_state_get)
+
+ gl.item_append(itc1, 1001, func=gl_item_sel)
+ gl.item_append(itc1, 1002, func=gl_item_sel)
+ gl.item_append(itc1, 1003, func=gl_item_sel)
+ gl.item_append(itc1, 1004, func=gl_item_sel)
+ gl.item_append(itc1, 1005, func=gl_item_sel)
+ gl.item_append(itc1, 1006, func=gl_item_sel)
+ gl.item_append(itc1, 1007, func=gl_item_sel)
+
+ bx.pack_end(gl)
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+ bx2.homogeneous_set(True)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+
+ def my_gl_first(bt, gl):
+ gli = gl.first_item_get()
+ if gli:
+ gli.show()
+ gli.selected = True
+
+ bt = elementary.Button(win)
+ bt.text_set("/\\")
+ bt.callback_clicked_add(my_gl_first, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ def my_gl_last(bt, gl):
+ gli = gl.last_item_get()
+ if gli:
+ gli.show()
+ gli.selected = True
+
+ bt = elementary.Button(win)
+ bt.text_set("\\/")
+ bt.callback_clicked_add(my_gl_last, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ def my_gl_disable(bt, gl):
+ gli = gl.selected_item_get()
+ if gli:
+ gli.disabled = True
+ gli.selected = False
+ gli.update()
+ else:
+ print("no item selected")
+
+ bt = elementary.Button(win)
+ bt.text_set("#")
+ bt.callback_clicked_add(my_gl_disable, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ def my_gl_update_all(bt, gl):
+ gli = gl.first_item_get()
+ i = 0
+ while gli:
+ gli.update()
+ print(i)
+ i = i + 1
+ gli = gli.next_get()
+
+ bt = elementary.Button(win)
+ bt.text_set("U")
+ bt.callback_clicked_add(my_gl_update_all, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx.pack_end(bx2)
+ bx2.show()
+
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+ bx2.homogeneous_set(True)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+
+ def my_gl_clear(bt, gl):
+ gl.clear()
+
+ bt = elementary.Button(win)
+ bt.text_set("X")
+ bt.callback_clicked_add(my_gl_clear, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ class MyGlAdd:
+ i = 0
+ def my_gl_add(bt, gl, itc1):
+ gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
+ MyGlAdd.i = MyGlAdd.i + 1
+
+ bt = elementary.Button(win)
+ bt.text_set("+")
+ bt.callback_clicked_add(my_gl_add, gl, itc1)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ def my_gl_del(bt, gl):
+ gli = gl.selected_item_get()
+ if gli:
+ gli.delete()
+ else:
+ print("no item selected")
+
+ bt = elementary.Button(win)
+ bt.text_set("-")
+ bt.callback_clicked_add(my_gl_del, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx.pack_end(bx2)
+ bx2.show()
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+ bx2.homogeneous_set(True)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+
+ class MyGlInsertBefore:
+ i = 0
+ def my_gl_insert_before(bt, gl, itc1):
+ gli = gl.selected_item_get()
+ if gli:
+ gl.item_insert_before(itc1, MyGlInsertBefore.i, gli, func=gl_item_sel)
+ MyGlInsertBefore.i = MyGlInsertBefore.i + 1
+ else:
+ print("no item selected")
+
+ bt = elementary.Button(win)
+ bt.text_set("+ before")
+ bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ class MyGlInsertAfter:
+ i = 0
+ def my_gl_insert_after(bt, gl, itc1):
+ gli = gl.selected_item_get()
+ if gli:
+ gl.item_insert_after(itc1, MyGlInsertAfter.i, gli, func=gl_item_sel)
+ MyGlInsertAfter.i = MyGlInsertAfter.i + 1
+ else:
+ print("no item selected")
+
+ bt = elementary.Button(win)
+ bt.text_set("+ after")
+ bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+
+ def my_gl_flush(bt, gl):
+ def my_gl_flush_delay():
+ elm_cache_all_flush()
+ ecore.timer_add(1.2, my_gl_flush_delay)
+ bt = elementary.Button(win)
+ bt.text_set("Flush")
+ bt.callback_clicked_add(my_gl_flush, gl)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx.pack_end(bx2)
+ bx2.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+def genlist3_clicked(obj, item=None):
+ win = elementary.Window("Genlist", elementary.ELM_WIN_BASIC)
+ win.title_set("Genlist Group test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ gl = elementary.Genlist(win)
+ win.resize_object_add(gl)
+ gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gl.show()
+
+ itc_i = elementary.GenlistItemClass(item_style="default",
+ text_get_func=gl_text_get,
+ content_get_func=gl_content_get,
+ state_get_func=gl_state_get)
+
+ itc_g = elementary.GenlistItemClass(item_style="group_index",
+ text_get_func=glg_text_get,
+ content_get_func=glg_content_get)
+
+ for i in range(300):
+ if i % 10 == 0:
+ git = gl.item_append(itc_g, i/10,
+ flags=elementary.ELM_GENLIST_ITEM_GROUP)
+ git.select_mode_set(elementary.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
+ gl.item_append(itc_i, i, git)
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Genlist", genlist_clicked),
+ ("Genlist 2", genlist2_clicked),
+ ("Genlist Group", genlist3_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_grid.py b/examples/elementary/test_grid.py
new file mode 100644
index 0000000..f81d768
--- /dev/null
+++ b/examples/elementary/test_grid.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_change(bt, grid):
+ (x, y, w, h) = grid.pack_get(bt)
+ grid.pack_set(bt, x - 2, y - 2, w + 4, h + 4)
+
+def grid_clicked(obj):
+ win = elementary.Window("grid", elementary.ELM_WIN_BASIC)
+ win.title = "Grid test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ gd = elementary.Grid(win)
+ gd.size = (100, 100)
+ win.resize_object_add(gd)
+ gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gd.show()
+
+ en = elementary.Entry(win)
+ en.scrollable = True
+ en.text = "Entry text 2"
+ en.single_line = True
+ gd.pack(en, 60, 20, 30, 10)
+ en.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Next API function"
+ gd.pack(bt, 30, 0, 40, 10)
+ bt.disabled = True
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Button"
+ gd.pack(bt, 0, 0, 20, 20)
+ bt.show()
+
+ bt = elementary.Button(win);
+ bt.text = "Button"
+ gd.pack(bt, 10, 10, 40, 20)
+ bt.show()
+
+ bt = elementary.Button(win);
+ bt.text = "Button"
+ gd.pack(bt, 10, 30, 20, 50)
+ bt.show()
+
+ bt = elementary.Button(win);
+ bt.text = "Button"
+ gd.pack(bt, 80, 80, 20, 20)
+ bt.show()
+
+ bt = elementary.Button(win);
+ bt.text = "Change"
+ bt.callback_clicked_add(cb_change, gd)
+ gd.pack(bt, 40, 40, 20, 20)
+ bt.show()
+
+ re = evas.Rectangle(win.evas)
+ re.color = (128, 0, 0, 128)
+ gd.pack(re, 40, 70, 20, 10)
+ re.show()
+
+ re = evas.Rectangle(win.evas)
+ re.color = (0, 128, 0, 128)
+ gd.pack(re, 60, 70, 10, 10)
+ re.show()
+
+ re = evas.Rectangle(win.evas)
+ re.color = (0, 0, 128, 128)
+ gd.pack(re, 40, 80, 10, 10)
+ re.show()
+
+ re = evas.Rectangle(win.evas)
+ re.color = (128, 0, 128, 128)
+ gd.pack(re, 50, 80, 10, 10)
+ re.show()
+
+ re = evas.Rectangle(win.evas)
+ re.color = (128, 64, 0, 128)
+ gd.pack(re, 60, 80, 10, 10)
+ re.show()
+
+ win.resize(480, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ grid_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_hover.py b/examples/elementary/test_hover.py
new file mode 100644
index 0000000..c430205
--- /dev/null
+++ b/examples/elementary/test_hover.py
@@ -0,0 +1,217 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def hover_bt1_clicked(bt, hv):
+ hv.show()
+
+def hover_clicked(obj, item=None):
+ win = elementary.Window("hover", elementary.ELM_WIN_BASIC)
+ win.title_set("Hover")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ hv = elementary.Hover(win)
+
+ bt = elementary.Button(win)
+ bt.text_set("Button")
+ bt.callback_clicked_add(hover_bt1_clicked, hv)
+ bx.pack_end(bt)
+ bt.show()
+ hv.parent_set(win)
+ hv.target_set(bt)
+
+ bt = elementary.Button(win)
+ bt.text_set("Popup")
+ hv.part_content_set("middle", bt)
+ bt.show()
+
+ bx = elementary.Box(win)
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ bx.pack_end(ic)
+ ic.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 1")
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 2")
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 3")
+ bx.pack_end(bt)
+ bt.show()
+
+ bx.show()
+
+ hv.part_content_set("top", bx)
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom")
+ hv.part_content_set("bottom", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left")
+ hv.part_content_set("left", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right")
+ hv.part_content_set("right", bt)
+ bt.show()
+
+ bg.size_hint_min_set(160, 160)
+ bg.size_hint_max_set(640, 640)
+
+ win.resize(320, 320)
+ win.show()
+
+
+def hover2_clicked(obj, item=None):
+ win = elementary.Window("hover2", elementary.ELM_WIN_BASIC)
+ win.title_set("Hover 2")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ hv = elementary.Hover(win)
+ hv.style_set("popout")
+
+ bt = elementary.Button(win)
+ bt.text_set("Button")
+ bt.callback_clicked_add(hover_bt1_clicked, hv)
+ bx.pack_end(bt)
+ bt.show()
+ hv.parent_set(win)
+ hv.target_set(bt)
+
+ bt = elementary.Button(win)
+ bt.text_set("Popup")
+ hv.part_content_set("middle", bt)
+ bt.show()
+
+ bx = elementary.Box(win)
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ bx.pack_end(ic)
+ ic.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 1")
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 2")
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top 3")
+ bx.pack_end(bt)
+ bt.show()
+
+ bx.show()
+ hv.part_content_set("top", bx)
+
+ bt = elementary.Button(win)
+ bt.text_set("Bot")
+ hv.part_content_set("bottom", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left")
+ hv.part_content_set("left", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right")
+ hv.part_content_set("right", bt)
+ bt.show()
+
+ bg.size_hint_min_set(160, 160)
+ bg.size_hint_max_set(640, 640)
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Hover", hover_clicked),
+ ("Hover 2", hover2_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_hoversel.py b/examples/elementary/test_hoversel.py
new file mode 100644
index 0000000..253bccf
--- /dev/null
+++ b/examples/elementary/test_hoversel.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def hoversel_clicked(obj):
+ win = elementary.Window("hoversel", elementary.ELM_WIN_BASIC)
+ win.title_set("Hoversel")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("Labels")
+ bt.item_add("Item 1")
+ bt.item_add("Item 2")
+ bt.item_add("Item 3")
+ bt.item_add("Item 4 - Long Label Here")
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("Some Icons")
+ bt.item_add("Item 1")
+ bt.item_add("Item 2")
+ bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("All Icons")
+ bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("All Icons")
+ bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 2", "images/logo_small.png", elementary.ELM_ICON_FILE)
+ bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("Disabled Hoversel")
+ bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 2", "close", elementary.ELM_ICON_STANDARD)
+ bt.disabled_set(True)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Hoversel(win)
+ bt.hover_parent_set(win)
+ bt.text_set("Icon + Label")
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/sky_03.jpg")
+ bt.content_set(ic)
+ ic.show()
+
+ bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
+ bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
+ bt.size_hint_weight_set(0.0, 0.0)
+ bt.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(bt)
+ bt.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ hoversel_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_icon.py b/examples/elementary/test_icon.py
new file mode 100644
index 0000000..b09f781
--- /dev/null
+++ b/examples/elementary/test_icon.py
@@ -0,0 +1,179 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def aspect_fixed_cb(obj, ic):
+ ic.aspect_fixed_set(obj.state_get())
+
+def fill_outside_cb(obj, ic):
+ ic.fill_outside_set(obj.state_get())
+
+def smooth_cb(obj, ic):
+ ic.smooth_set(obj.state_get())
+
+def bt_clicked(obj):
+ win = elementary.Window("preload-prescale", elementary.ELM_WIN_BASIC)
+ win.title_set("Preload & Prescale")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bg)
+ bg.show()
+
+ ic = elementary.Icon(win)
+ win.resize_object_add(ic)
+ ic.file_set("images/insanely_huge_test_image.jpg")
+
+ ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ ic.resizable_set(True, True)
+ ic.aspect_fixed_set(True)
+ ic.preload_disabled_set(True)
+ ic.prescale_set(True)
+ ic.show()
+
+ win.resize(350, 350)
+ win.show()
+
+
+def icon_clicked(obj, item=None):
+ win = elementary.Window("icon test", elementary.ELM_WIN_BASIC)
+ win.title_set("Icon Test")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bg)
+ bg.show()
+
+ box = elementary.Box(win)
+ win.resize_object_add(box)
+ box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ box.show()
+
+ content_box = elementary.Box(win)
+ win.resize_object_add(content_box)
+ content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ content_box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box.pack_end(content_box)
+ content_box.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set("images/logo.png")
+ ic.resizable_set(True, True)
+ ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+ content_box.pack_end(ic)
+ ic.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal_set(True)
+ content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ box.pack_end(hbox)
+ hbox.show()
+
+ # Test Aspect Fixed
+ tg = elementary.Check(win)
+ tg.text_set("Aspect Fixed")
+ tg.state_set(True)
+ tg.callback_changed_add(aspect_fixed_cb, ic)
+ hbox.pack_end(tg)
+ tg.show()
+
+ # Test Fill Outside
+ tg = elementary.Check(win)
+ tg.text_set("Fill Outside")
+ tg.callback_changed_add(fill_outside_cb, ic)
+ hbox.pack_end(tg)
+ tg.show()
+
+ # Test Smooth
+ tg = elementary.Check(win)
+ tg.text_set("Smooth")
+ tg.state_set(True)
+ tg.callback_changed_add(smooth_cb, ic)
+ hbox.pack_end(tg)
+ tg.show()
+
+ # Test Preload, Prescale
+ bt = elementary.Button(win)
+ bt.text_set("Preload & Prescale")
+ bt.callback_clicked_add(bt_clicked)
+ hbox.pack_end(bt)
+ bt.show()
+
+ win.resize(400, 400)
+ win.show()
+
+
+def icon_transparent_clicked(obj, item=None):
+ win = elementary.Window("icon-transparent", elementary.ELM_WIN_BASIC)
+ win.title_set("Icon Transparent")
+ win.autodel_set(True)
+ win.alpha_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ icon = elementary.Icon(win)
+ icon.file_set("images/logo.png")
+ icon.resizable_set(0, 0)
+ win.resize_object_add(icon)
+ icon.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("Icon", icon_clicked),
+ ("Icon transparent", icon_transparent_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_index.py b/examples/elementary/test_index.py
new file mode 100644
index 0000000..4bb5ff5
--- /dev/null
+++ b/examples/elementary/test_index.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def gl_text_get(gl, part, data):
+ return str(data)
+
+def cb_idx_item(idx, item, gl_item):
+ print(("Current Index: %s" % (item.letter)))
+ gl_item.bring_in()
+
+def cb_idx_changed(idx, item):
+ print(("changed event on: %s" % (item.letter)))
+
+def cb_idx_delay_changed(idx, item):
+ print(("delay_changed event on: %s" % (item.letter)))
+ # BROKEN (see below)
+ # gl_item = item.data["gl_item"]
+ # gl_item.bring_in()
+
+def cb_idx_selected(idx, item):
+ print(("selected event on: %s" % (item.letter)))
+
+
+def index_clicked(obj):
+ win = elementary.Window("index", elementary.ELM_WIN_BASIC)
+ win.title_set("Index test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbox = elementary.Box(win)
+ vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ # index
+ idx = elementary.Index(win)
+ idx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ idx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ idx.callback_delay_changed_add(cb_idx_delay_changed)
+ idx.callback_changed_add(cb_idx_changed)
+ idx.callback_selected_add(cb_idx_selected)
+ win.resize_object_add(idx)
+ idx.show()
+
+ # genlist
+ itc = elementary.GenlistItemClass(item_style="default",
+ text_get_func=gl_text_get)
+ # content_get_func=gl_content_get,
+ # state_get_func=gl_state_get)
+ gl = elementary.Genlist(win)
+ gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(gl)
+ gl.show()
+
+
+ for i in 'ABCDEFGHILMNOPQRSTUVZ':
+ for j in 'acegikmo':
+ gl_item = gl.item_append(itc, i + j)
+ if j == 'a':
+ idx_item = idx.item_append(i, cb_idx_item, gl_item)
+
+ # TODO This is broken (data assignment to ItemObject)
+ # ...for now just bringin on select
+ # idx_item.data["gl_item"] = gl_item
+
+
+ idx.level_go(0)
+
+ sep = elementary.Separator(win)
+ sep.horizontal = True
+ vbox.pack_end(sep)
+ sep.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text = "autohide_disabled"
+ ck.callback_changed_add(lambda ck: idx.autohide_disabled_set(ck.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text = "indicator_disabled"
+ ck.callback_changed_add(lambda ck: idx.indicator_disabled_set(ck.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text = "horizontal"
+ ck.callback_changed_add(lambda ck: idx.horizontal_set(ck.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ win.resize(320, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ index_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_inwin.py b/examples/elementary/test_inwin.py
new file mode 100644
index 0000000..b3aa810
--- /dev/null
+++ b/examples/elementary/test_inwin.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def inner_window_clicked(obj):
+ win = elementary.Window("inner-window", elementary.ELM_WIN_BASIC)
+ win.title_set("InnerWindow test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ 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)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ inner_window_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_label.py b/examples/elementary/test_label.py
new file mode 100644
index 0000000..adbba0a
--- /dev/null
+++ b/examples/elementary/test_label.py
@@ -0,0 +1,169 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_slide_radio(radio, lb):
+ lb.style = radio.text
+
+def cb_slider_duration(slider, lb):
+ lb.slide = False
+ lb.slide_duration = slider.value
+ lb.slide = True
+
+def label_clicked(obj):
+ win = elementary.Window("label", elementary.ELM_WIN_BASIC)
+ win.title = "Label test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ lb = elementary.Label(win)
+ lb.text = "<b>This is a small label</b>"
+ lb.size_hint_align = (0.0, 0.5)
+ vbox.pack_end(lb)
+ lb.show()
+
+ lb = elementary.Label(win)
+ lb.text = "This is a larger label with newlines<br/>" \
+ "to make it bigger, bit it won't expand or wrap<br/>" \
+ "just be a block of text that can't change its<br/>" \
+ "formatting as it's fixed based on text<br/>"
+ lb.size_hint_align = (0.0, 0.5)
+ vbox.pack_end(lb)
+ lb.show()
+
+ lb = elementary.Label(win)
+ lb.line_wrap_set(elementary.ELM_WRAP_CHAR)
+ lb.text = "<b>This is more text designed to line-wrap here as " \
+ "This object is resized horizontally. As it is " \
+ "resized vertically though, nothing should change. " \
+ "The amount of space allocated vertically should " \
+ "change as horizontal size changes.</b>"
+ lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.pack_end(lb)
+ lb.show()
+
+ lb = elementary.Label(win)
+ lb.text = "This small label set to wrap"
+ lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.pack_end(lb)
+ lb.show()
+
+ sp = elementary.Separator(win)
+ sp.horizontal = True
+ vbox.pack_end(sp)
+ sp.show()
+
+ gd = elementary.Grid(win)
+ gd.size = (100, 100)
+ gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ gd.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ vbox.pack_end(gd)
+ gd.show()
+
+ lb = elementary.Label(win)
+ lb.text = "Test Label Ellipsis:"
+ lb.size_hint_align = (0.0, 0.5)
+ gd.pack(lb, 5, 5, 90, 15)
+ lb.show()
+
+ rect = evas.Rectangle(win.evas)
+ rect.color = (255, 125, 125, 255)
+ gd.pack(rect, 5, 15, 90, 15)
+ rect.show()
+
+ lb = elementary.Label(win)
+ lb.text = "This is a label set to ellipsis. " \
+ "If set ellipsis to true and the text doesn't fit " \
+ "in the label an ellipsis(\"...\") will be shown " \
+ "at the end of the widget."
+ lb.ellipsis = True
+ lb.size_hint_align = (0.0, 0.5)
+ gd.pack(lb, 5, 15, 90, 15)
+ lb.show()
+
+ lb = elementary.Label(win)
+ lb.text = "Test Label Slide:"
+ lb.size_hint_align = (0.0, 0.5)
+ gd.pack(lb, 5, 40, 90, 15)
+ lb.show()
+
+ rect = evas.Rectangle(win.evas)
+ rect.color = (255, 125, 125, 255)
+ gd.pack(rect, 5, 50, 90, 15)
+ rect.show()
+
+ lb = elementary.Label(win)
+ lb.text = "This is a label set to slide. " \
+ "If set slide to true the text of the label " \
+ "will slide/scroll through the length of label." \
+ "This only works with the themes \"slide_short\", " \
+ "\"slide_long\" and \"slide_bounce\"."
+ lb.slide = True
+ lb.style = ("slide_short")
+ lb.size_hint_align = (0.0, 0.5)
+ gd.pack(lb, 5, 50, 90, 15)
+ lb.show()
+
+ rd = elementary.Radio(win)
+ rd.state_value = 1
+ rd.text = "slide_short"
+ gd.pack(rd, 5, 65, 30, 15)
+ rd.callback_changed_add(cb_slide_radio, lb)
+ rd.show()
+ rdg = rd
+
+ rd = elementary.Radio(win)
+ rd.group_add(rdg)
+ rd.state_value = 2
+ rd.text = "slide_long"
+ gd.pack(rd, 35, 65, 30, 15)
+ rd.callback_changed_add(cb_slide_radio, lb)
+ rd.show()
+
+ rd = elementary.Radio(win)
+ rd.group_add(rdg)
+ rd.state_value = 3
+ rd.text = "slide_bounce"
+ gd.pack(rd, 65, 65, 30, 15)
+ rd.callback_changed_add(cb_slide_radio, lb)
+ rd.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Slide Duration"
+ sl.unit_format = "%1.1f units"
+ sl.min_max = (1, 20)
+ sl.value = 10
+ sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ sl.callback_changed_add(cb_slider_duration, lb)
+ gd.pack(sl, 5, 80, 90, 15)
+ sl.show()
+
+ win.resize(280, 400)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ label_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_layout.py b/examples/elementary/test_layout.py
new file mode 100644
index 0000000..799f2f3
--- /dev/null
+++ b/examples/elementary/test_layout.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def _event(*args, **kargs):
+ print((args, kargs))
+
+def layout_clicked(obj):
+ win = elementary.Window("layout", elementary.ELM_WIN_BASIC)
+ win.title_set("Layout")
+ win.elm_event_callback_add(_event)
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ ly = elementary.Layout(win)
+ ly.file_set("test.edj", "layout")
+ ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(ly)
+ ly.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 1")
+ ly.part_content_set("element1", bt)
+ bt.elm_event_callback_add(_event)
+ bt.elm_event_callback_del(_event)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 2")
+ ly.part_content_set("element2", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 3")
+ ly.part_content_set("element3", bt)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ layout_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_list.py b/examples/elementary/test_list.py
new file mode 100644
index 0000000..44b58e6
--- /dev/null
+++ b/examples/elementary/test_list.py
@@ -0,0 +1,381 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_list_show_it(obj, it):
+ it.show()
+
+def list_clicked(obj, item=None):
+ win = elementary.Window("list", elementary.ELM_WIN_BASIC)
+ win.title_set("List")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ li = elementary.List(win)
+ win.resize_object_add(li)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(1, 1)
+ it1 = li.item_append("Hello", ic)
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ li.item_append("Hello", ic)
+ ic = elementary.Icon(win)
+ ic.standard_set("edit")
+ ic.resizable_set(0, 0)
+ ic2 = elementary.Icon(win)
+ ic2.standard_set("clock")
+ ic2.resizable_set(0, 0)
+ li.item_append(".", ic, ic2)
+
+ ic = elementary.Icon(win)
+ ic.standard_set("delete")
+ ic.resizable_set(0, 0)
+ ic2 = elementary.Icon(win)
+ ic2.standard_set("clock")
+ ic2.resizable_set(0, 0)
+ it2 = li.item_append("How", ic, ic2)
+
+ bx = elementary.Box(win)
+ bx.horizontal_set(True)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.0)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(ic)
+ ic.show()
+ li.item_append("are")
+
+ li.item_append("you")
+ it3 = li.item_append("doing")
+ li.item_append("out")
+ li.item_append("there")
+ li.item_append("today")
+ li.item_append("?")
+ it4 = li.item_append("Here")
+ li.item_append("are")
+ li.item_append("some")
+ li.item_append("more")
+ li.item_append("items")
+ li.item_append("Is this label long enough?")
+ it5 = li.item_append("Maybe this one is even longer so we can test long long items.")
+
+ li.go()
+
+ li.show()
+
+ tb2 = elementary.Table(win)
+ tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb2)
+
+ bt = elementary.Button(win)
+ bt.text_set("Hello")
+ bt.callback_clicked_add(my_list_show_it, it1)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.5)
+ tb2.pack(bt, 0, 0, 1, 1);
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("How")
+ bt.callback_clicked_add(my_list_show_it, it2)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.5)
+ tb2.pack(bt, 0, 1, 1, 1);
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("doing")
+ bt.callback_clicked_add(my_list_show_it, it3)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.5)
+ tb2.pack(bt, 0, 2, 1, 1);
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Here")
+ bt.callback_clicked_add(my_list_show_it, it4)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.5)
+ tb2.pack(bt, 0, 3, 1, 1);
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Maybe this...")
+ bt.callback_clicked_add(my_list_show_it, it5)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.5)
+ tb2.pack(bt, 0, 4, 1, 1);
+ bt.show()
+
+ tb2.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+def my_list2_clear(bt, li):
+ li.clear()
+
+def my_list2_sel(obj, it):
+ it = obj.selected_item_get()
+ if it is not None:
+ it.selected_set(False)
+
+def list2_clicked(obj, item=None):
+ win = elementary.Window("list-2", elementary.ELM_WIN_BASIC)
+ win.title_set("List 2")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ bg.file_set('images/plant_01.jpg')
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ li = elementary.List(win)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.mode_set(elementary.ELM_LIST_LIMIT)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ it = li.item_append("Hello", ic, callback=my_list2_sel)
+ it.selected_set(True)
+ ic = elementary.Icon(win)
+ ic.resizable_set(0, 0)
+ ic.file_set('images/logo_small.png')
+ li.item_append("world", ic)
+ ic = elementary.Icon(win)
+ ic.standard_set("edit")
+ ic.resizable_set(0, 0)
+ li.item_append(".", ic)
+
+ ic = elementary.Icon(win)
+ ic.standard_set("delete")
+ ic.resizable_set(0, 0)
+ ic2 = elementary.Icon(win)
+ ic2.standard_set("clock")
+ ic2.resizable_set(0, 0)
+ it2 = li.item_append("How", ic, ic2)
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx2.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.0)
+ bx2.pack_end(ic)
+ ic.show()
+
+ li.item_append("are", bx2)
+
+ li.item_append("you")
+ li.item_append("doing")
+ li.item_append("out")
+ li.item_append("there")
+ li.item_append("today")
+ li.item_append("?")
+ li.item_append("Here")
+ li.item_append("are")
+ li.item_append("some")
+ li.item_append("more")
+ li.item_append("items")
+ li.item_append("Longer label.")
+
+ li.go()
+
+ bx.pack_end(li)
+ li.show()
+
+ bx2 = elementary.Box(win)
+ bx2.horizontal_set(True)
+ bx2.homogeneous_set(True)
+ bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+ bt = elementary.Button(win)
+ bt.text_set("Clear")
+ bt.callback_clicked_add(my_list2_clear, li)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ bx2.pack_end(bt)
+ bt.show()
+
+ bx.pack_end(bx2)
+ bx2.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+def list3_clicked(obj, item=None):
+ win = elementary.Window("list-3", elementary.ELM_WIN_BASIC)
+ win.title_set("List 3")
+ win.autodel_set(True)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ li = elementary.List(win)
+ win.resize_object_add(li)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.mode_set(elementary.ELM_LIST_COMPRESS)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ li.item_append("Hello", ic)
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ li.item_append("world", ic)
+ ic = elementary.Icon(win)
+ ic.standard_set("edit")
+ ic.resizable_set(0, 0)
+ li.item_append(".", ic)
+
+ ic = elementary.Icon(win)
+ ic.standard_set("delete")
+ ic.resizable_set(0, 0)
+ ic2 = elementary.Icon(win)
+ ic2.standard_set("clock")
+ ic2.resizable_set(0, 0)
+ it2 = li.item_append("How", ic, ic2)
+
+ bx = elementary.Box(win)
+ bx.horizontal_set(True)
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.5)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.5, 0.0)
+ bx.pack_end(ic)
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(ic)
+ ic.show()
+
+ li.item_append("are", bx)
+ li.item_append("you")
+ li.item_append("doing")
+ li.item_append("out")
+ li.item_append("there")
+ li.item_append("today")
+ li.item_append("?")
+ li.item_append("Here")
+ li.item_append("are")
+ li.item_append("some")
+ li.item_append("more")
+ li.item_append("items")
+ li.item_append("Is this label long enough?")
+ it5 = li.item_append("Maybe this one is even longer so we can test long long items.")
+
+ li.go()
+
+ li.show()
+
+ win.resize(320, 300)
+ win.show()
+
+
+if __name__ == "__main__":
+ def destroy(obj):
+ elementary.exit()
+
+ elementary.init()
+ win = elementary.Window("test", elementary.ELM_WIN_BASIC)
+ win.title_set("python-elementary test application")
+ win.callback_delete_request_add(destroy)
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ box0 = elementary.Box(win)
+ box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(box0)
+ box0.show()
+
+ fr = elementary.Frame(win)
+ fr.text_set("Information")
+ box0.pack_end(fr)
+ fr.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Please select a test from the list below<br>"
+ "by clicking the test button to show the<br>"
+ "test window.")
+ fr.content_set(lb)
+ lb.show()
+
+ items = [("List", list_clicked),
+ ("List 2", list2_clicked),
+ ("List 3", list3_clicked)]
+
+ li = elementary.List(win)
+ li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ box0.pack_end(li)
+ li.show()
+
+ for item in items:
+ li.item_append(item[0], callback=item[1])
+
+ li.go()
+
+ win.resize(320,520)
+ win.show()
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_map.py b/examples/elementary/test_map.py
new file mode 100644
index 0000000..1419da2
--- /dev/null
+++ b/examples/elementary/test_map.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def print_map_info(Map):
+ print("---Map info---")
+ # print("user_agent: %s" % (Map.user_agent))
+ print("zoom:%d (min:%d max:%d mode:%d)" %
+ (Map.zoom, Map.zoom_min, Map.zoom_max, Map.zoom_mode))
+ print("region:%f %f" % Map.region)
+
+ (x, y) = Map.center
+ print("map_center:%d %d" % (x, y))
+ (lon, lat) = Map.canvas_to_region_convert(x, y)
+ print("canvas_to_region:%f %f" % (lon, lat))
+ (x2, y2) = Map.region_to_canvas_convert(lon, lat)
+ print("region_to_canvas:%d %d (should be equal to %d %d)" % (x2, y2, x, y))
+
+def cb_btn_zoom(bt, Map, zoom):
+ Map.zoom += zoom
+ print_map_info(Map)
+
+def cb_btn_show(bt, Map, lon, lat):
+ Map.region_show(lon, lat)
+ print_map_info(Map)
+
+def cb_btn_bringin(bt, Map, lon, lat):
+ Map.region_bring_in(lon, lat)
+ print_map_info(Map)
+
+def cb_slider_rot(sl, Map):
+ (cx, cy) = Map.center
+ Map.rotate_set(sl.value, cx, cy)
+ print("New rotate: %f %d %d" % Map.rotate)
+
+def cb_hovsel_selected(hov, item, Map, type):
+ Map.source_set(type, item.text)
+ hov.text = "Tiles: %s" % (item.text)
+
+def map_clicked(obj):
+ win = elementary.Window("map", elementary.ELM_WIN_BASIC)
+ win.title = "Map test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ Map = elementary.Map(win)
+ Map.zoom = 2
+ Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ # Map.callback_clicked_add(cb_map_clicked)
+ vbox.pack_end(Map)
+ Map.show()
+
+ # view
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Zoom +"
+ bt.callback_clicked_add(cb_btn_zoom, Map, 1)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Zoom -"
+ bt.callback_clicked_add(cb_btn_zoom, Map, -1)
+ hbox.pack_end(bt)
+ bt.show()
+
+ sl = elementary.Slider(win)
+ sl.text = "Rotation:"
+ sl.min_max = (0, 360)
+ sl.value = 0
+ sl.indicator_format = "%3.0f"
+ sl.callback_changed_add(cb_slider_rot, Map)
+ hbox.pack_end(sl)
+ sl.show()
+
+ ho = elementary.Hoversel(win)
+ ho.hover_parent_set(win)
+ type = elementary.ELM_MAP_SOURCE_TYPE_TILE
+ ho.text_set("Tiles: %s" % (Map.source_get(type)))
+ for src in Map.sources_get(type):
+ ho.item_add(src)
+ ho.callback_selected_add(cb_hovsel_selected, Map, type)
+ hbox.pack_end(ho)
+ ho.show()
+
+ # show / bring in
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Show Sydney"
+ bt.callback_clicked_add(cb_btn_show, Map, 151.175274, -33.859126)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Show Paris"
+ bt.callback_clicked_add(cb_btn_show, Map, 2.342913, 48.853701)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "BringIn Sydney"
+ bt.callback_clicked_add(cb_btn_bringin, Map, 151.175274, -33.859126)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "BringIn Paris"
+ bt.callback_clicked_add(cb_btn_bringin, Map, 2.342913, 48.853701)
+ hbox.pack_end(bt)
+ bt.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ # options
+ ck = elementary.Check(win)
+ ck.text = "wheel_disabled"
+ ck.callback_changed_add(lambda bt: Map.wheel_disabled_set(bt.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text = "paused"
+ ck.callback_changed_add(lambda bt: Map.paused_set(bt.state))
+ hbox.pack_end(ck)
+ ck.show()
+
+ print_map_info(Map)
+
+ win.resize(600, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ map_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_map2.py b/examples/elementary/test_map2.py
new file mode 100644
index 0000000..61fe274
--- /dev/null
+++ b/examples/elementary/test_map2.py
@@ -0,0 +1,216 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_btn_clear_overlays(bt, Map):
+ for ov in Map.overlays:
+ print ov, ov.type
+ if (ov.type != elementary.ELM_MAP_OVERLAY_TYPE_CLASS):
+ ov.delete()
+
+def cb_btn_ungroup_overlays(bt, Map):
+ for ov in Map.overlays:
+ if isinstance(ov, elementary.MapOverlayClass):
+ print ov
+ # TODO ungroup instead
+ for ov2 in ov.members:
+ ov.delete()
+
+def cb_btn_show_overlays(bt, Map):
+ Map.overlays_show(Map.overlays)
+
+def cb_chk_overlays_hidden(ck, Map):
+ for ov in Map.overlays:
+ ov.hide = ck.state
+
+def cb_chk_overlays_paused(ck, Map):
+ for ov in Map.overlays:
+ ov.paused = ck.state
+
+def cb_overlay_clicked(Map, ov):
+ ov.delete()
+
+def cb_ctx_overlay_add(li, item, Map, lon, lat, min_zoom = 0, icon = None):
+ item.widget_get().dismiss()
+ ov = Map.overlay_add(lon, lat)
+ if min_zoom > 0:
+ ov.displayed_zoom_min = min_zoom
+ if icon:
+ ov.icon = icon
+
+ ov.callback_clicked_set(cb_overlay_clicked)
+
+def cb_ctx_overlay_add_custom(li, item, Map, lon, lat):
+ item.widget_get().dismiss()
+ cont = elementary.Icon(Map)
+ cont.file_set("images/sky_01.jpg")
+ cont.size_hint_min = (50, 50)
+ cont.show()
+ ov = Map.overlay_add(lon, lat)
+ ov.content = cont
+
+def cb_ctx_overlay_add_random_color(li, item, Map, lon, lat):
+ item.widget_get().dismiss()
+ ov = Map.overlay_add(lon, lat)
+ ov.color = (random.randint(0, 255), random.randint(0, 255),
+ random.randint(0, 255), 200)
+
+def cb_ctx_overlay_grouped(li, item, Map, lon, lat, sx, sy):
+ item.widget_get().dismiss()
+ cls = Map.overlay_class_add()
+ for x in range(4):
+ for y in range(4):
+ (lon, lat) = Map.canvas_to_region_convert(sx + x * 10, sy + y * 10)
+ ov = Map.overlay_add(lon, lat)
+ cls.append(ov)
+
+def cb_ctx_overlay_bubble(li, item, Map, lon, lat):
+ item.widget_get().dismiss()
+
+ ov = Map.overlay_add(lon, lat)
+ bub = Map.overlay_bubble_add()
+ bub.follow(ov)
+
+ lb = elementary.Label(Map)
+ lb.text = "You can push contents here"
+ bub.content_append(lb)
+ lb.show()
+
+ ic = elementary.Icon(Map)
+ ic.file_set("images/sky_01.jpg")
+ ic.size_hint_min = (50, 50)
+ bub.content_append(ic)
+ ic.show()
+
+ bt = elementary.Button(Map)
+ bt.text = "clear me"
+ bt.callback_clicked_add(lambda bt:bub.content_clear())
+ bub.content_append(bt)
+ bt.show()
+
+def cb_ctx_overlay_line(li, item, Map, lon, lat):
+ item.widget_get().dismiss()
+ line = Map.overlay_line_add(lon, lat, lon + 1, lat + 1)
+
+def cb_ctx_overlay_polygon(li, item, Map, lon, lat):
+ item.widget_get().dismiss()
+ poly = Map.overlay_polygon_add()
+ poly.region_add(lon, lat)
+ poly.region_add(lon + 1, lat + 1)
+ poly.region_add(lon + 1, lat - 1)
+ poly.region_add(lon - 1, lat)
+
+def cb_ctx_overlay_circle(li, item, Map, lon, lat, radius):
+ item.widget_get().dismiss()
+ Map.overlay_circle_add(lon, lat, radius)
+
+def cb_ctx_overlay_scale(li, item, Map, x, y):
+ item.widget_get().dismiss()
+ Map.overlay_scale_add(x, y)
+
+def test(li, item, Map, lon, lat):
+ print li
+ print item
+ print Map
+ # ctx.dismiss()
+ ov = Map.overlay_add(lon, lat)
+
+def cb_map_clicked(Map):
+ (x, y) = Map.evas.pointer_canvas_xy_get()
+ (lon, lat) = Map.canvas_to_region_convert(x, y)
+ cp = elementary.Ctxpopup(Map)
+ cp.item_append("%f %f" % (lon, lat), None, None).disabled = True
+ cp.item_append("Add Overlay here", None, cb_ctx_overlay_add, Map, lon, lat)
+ ic = elementary.Icon(Map)
+ ic.file_set("images/logo.png")
+ cp.item_append("Add Overlay with icon", None, cb_ctx_overlay_add, Map, lon, lat, 0, ic)
+ cp.item_append("Add Overlay custom content", None, cb_ctx_overlay_add_custom, Map, lon, lat)
+ cp.item_append("Add Overlay random color", None, cb_ctx_overlay_add_random_color, Map, lon, lat)
+ cp.item_append("Add Overlay (min zoom 4)", None, cb_ctx_overlay_add, Map, lon, lat, 4)
+ cp.item_append("Add 16 Grouped Overlays", None, cb_ctx_overlay_grouped, Map, lon, lat, x, y)
+ cp.item_append("Add one with a bubble attached", None, cb_ctx_overlay_bubble, Map, lon, lat)
+ cp.item_append("Add an Overlay Line", None, cb_ctx_overlay_line, Map, lon, lat)
+ cp.item_append("Add an Overlay Polygon", None, cb_ctx_overlay_polygon, Map, lon, lat)
+ cp.item_append("Add an Overlay Circle", None, cb_ctx_overlay_circle, Map, lon, lat, 10)
+ cp.item_append("Add an Overlay Scale", None, cb_ctx_overlay_scale, Map, x, y)
+ cp.move(x, y)
+ cp.show()
+
+def map_overlays_clicked(obj):
+ win = elementary.Window("map2", elementary.ELM_WIN_BASIC)
+ win.title = "Map Overlay test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ Map = elementary.Map(win)
+ Map.zoom = 2
+ Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ Map.callback_clicked_add(cb_map_clicked)
+ vbox.pack_end(Map)
+ Map.show()
+
+ # overlays
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text = "overlays hidden"
+ ck.callback_changed_add(cb_chk_overlays_hidden, Map)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.text = "overlays paused"
+ ck.callback_changed_add(cb_chk_overlays_paused, Map)
+ hbox.pack_end(ck)
+ ck.show()
+
+ bt = elementary.Button(win)
+ bt.text = "clear overlays"
+ bt.callback_clicked_add(cb_btn_clear_overlays, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "ungroup (BROKEN)"
+ bt.callback_clicked_add(cb_btn_ungroup_overlays, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "overlays_show()"
+ bt.callback_clicked_add(cb_btn_show_overlays, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ win.resize(600, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ map_overlays_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_map3.py b/examples/elementary/test_map3.py
new file mode 100644
index 0000000..0c76361
--- /dev/null
+++ b/examples/elementary/test_map3.py
@@ -0,0 +1,260 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+_from = None
+_to = None
+
+
+def cb_btn_goto(bt, Map):
+ Map.zoom = 12
+ Map.region_show(9.204, 45.446)
+
+def cb_ctx_set_from(ctx, item, Map, lon, lat):
+ global _from
+
+ ctx.dismiss()
+ if _from is None:
+ _from = Map.overlay_add(lon, lat)
+ _from.color = (150, 0, 0, 150)
+ else:
+ _from.region = (lon, lat)
+
+def cb_ctx_set_to(ctx, item, Map, lon, lat):
+ global _to
+
+ ctx.dismiss()
+ if _to is None:
+ _to = Map.overlay_add(lon, lat)
+ _to.color = (0, 0, 150, 150)
+ else:
+ _to.region = (lon, lat)
+
+def cb_btn_calc_route(bt, Map):
+ if not (_from and _to):
+ return
+
+ (flon, flat) = _from.region
+ (tlon, tlat) = _to.region
+ Map.route_add(elementary.ELM_MAP_ROUTE_TYPE_MOTOCAR,
+ elementary.ELM_MAP_ROUTE_METHOD_FASTEST,
+ flon, flat, tlon, tlat, cb_route)
+
+ lb = Map.data["lb_distance"]
+ lb.text = "requesting route..."
+
+def cb_btn_search_name(bt, Map, en):
+ Map.name_add(en.text, 0, 0, cb_search_name, en)
+ en.text = "searching..."
+
+def cb_search_name(Map, name, en):
+ global _from
+
+ en.text = name.address
+ (lon, lat) = name.region
+ Map.zoom = 12
+ Map.region_show(lon, lat)
+
+ if _from is None:
+ _from = Map.overlay_add(lon, lat)
+ _from.color = (150, 0, 0, 150)
+ else:
+ _from.region = (lon, lat)
+
+def cb_btn_search_region(bt, Map, en):
+ if _from is None:
+ return
+ (lon, lat) = _from.region
+ Map.name_add(None, lon, lat, cb_search_region, en)
+ en.text = "searching..."
+
+def cb_search_region(Map, name, en):
+ global _name
+
+ en.text = name.address
+
+def cb_route(Map, route):
+ nodes = route.node.count('\n')
+ lb = Map.data["lb_distance"]
+ lb.text = "distance: %.2f Km nodes:%d" % (route.distance, nodes)
+
+ ov = Map.overlay_route_add(route)
+
+ print("Node: %s" % (route.node))
+ print("Waypoint %s" % (route.waypoint))
+
+def cb_btn_clear_overlays(btn, Map):
+ for ov in Map.overlays:
+ if ov != _from and ov != _to:
+ ov.delete()
+
+def cb_map_clicked(Map):
+ (x, y) = Map.evas.pointer_canvas_xy_get()
+ (lon, lat) = Map.canvas_to_region_convert(x, y)
+ cp = elementary.Ctxpopup(Map)
+ cp.item_append("%f %f" % (lon, lat)).disabled = True
+ cp.item_append("Set start point", None, cb_ctx_set_from, Map, lon, lat)
+ cp.item_append("Set end point", None, cb_ctx_set_to, Map, lon, lat)
+ cp.move(x, y)
+ cp.show()
+
+def cb_map_load(Map):
+ lb = Map.data["lb_load_status"]
+ lb.text = "tile_load_status: %d / %d" % Map.tile_load_status_get()
+
+def cb_hovsel_selected(hov, item, Map, type, name):
+ Map.source_set(type, item.text)
+ hov.text = "%s: %s" % (name, item.text)
+
+def map_route_clicked(obj):
+ win = elementary.Window("maproute", elementary.ELM_WIN_BASIC)
+ win.title = "Map Route test"
+ win.autodel = True
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ Map = elementary.Map(win)
+ Map.zoom = 2
+ Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ Map.callback_clicked_add(cb_map_clicked)
+ Map.callback_tile_load_add(cb_map_load)
+ Map.callback_tile_loaded_add(cb_map_load)
+ vbox.pack_end(Map)
+ Map.show()
+
+ lb = elementary.Label(win)
+ lb.text = "load_status: 0 / 0"
+ vbox.pack_end(lb)
+ lb.show()
+ Map.data["lb_load_status"] = lb
+
+ lb = elementary.Label(win)
+ lb.text = "First set Start and End point and then click 'Calc Route !'"
+ vbox.pack_end(lb)
+ lb.show()
+ Map.data["lb_distance"] = lb
+
+ # info
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ # route
+ ho = elementary.Hoversel(win)
+ ho.hover_parent_set(win)
+ type = elementary.ELM_MAP_SOURCE_TYPE_ROUTE
+ ho.text_set("Routes: %s" % (Map.source_get(type)))
+ for src in Map.sources_get(type):
+ ho.item_add(src)
+ ho.callback_selected_add(cb_hovsel_selected, Map, type, "Routes")
+ hbox.pack_end(ho)
+ ho.show()
+
+ sep = elementary.Separator(win)
+ sep.show()
+ hbox.pack_end(sep)
+
+ bt = elementary.Button(win)
+ bt.text = "GOTO"
+ bt.callback_clicked_add(cb_btn_goto, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Calc Route !"
+ bt.callback_clicked_add(cb_btn_calc_route, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "clear route overlays"
+ bt.callback_clicked_add(cb_btn_clear_overlays, Map)
+ hbox.pack_end(bt)
+ bt.show()
+
+ # names
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ ho = elementary.Hoversel(win)
+ ho.hover_parent_set(win)
+ type = elementary.ELM_MAP_SOURCE_TYPE_NAME
+ ho.text_set("Names: %s" % (Map.source_get(type)))
+ for src in Map.sources_get(type):
+ ho.item_add(src)
+ ho.callback_selected_add(cb_hovsel_selected, Map, type, "Names")
+ hbox.pack_end(ho)
+ ho.show()
+
+ en = elementary.Entry(win)
+ en.scrollable = True
+ # en.single_line = True
+ en.text = "type an address here"
+ en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ hbox.pack_end(en)
+ en.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Search Address !"
+ bt.callback_clicked_add(cb_btn_search_name, Map, en)
+ hbox.pack_end(bt)
+ bt.show()
+
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ en = elementary.Entry(win)
+ en.scrollable = True
+ # en.single_line = True
+ en.disabled = True
+ en.text = "place the start point and press the button"
+ en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ hbox.pack_end(en)
+ en.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Search start point Region"
+ bt.callback_clicked_add(cb_btn_search_region, Map, en)
+ hbox.pack_start(bt)
+ bt.show()
+
+
+ win.resize(600, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ map_route_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_mapbuf.py b/examples/elementary/test_mapbuf.py
new file mode 100644
index 0000000..39db81a
--- /dev/null
+++ b/examples/elementary/test_mapbuf.py
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk",
+ "Smell", "Of", "Sky", "Gold", "Hole", "Pig", "And", "Calm"]
+
+mb_list = []
+
+def cb_btn_close(btn, win):
+ win.delete()
+ elementary.exit()
+
+def cb_ck_map(ck):
+ for mb in mb_list:
+ mb.enabled = ck.state
+
+def cb_ck_alpha(ck):
+ for mb in mb_list:
+ mb.alpha = ck.state
+
+def cb_ck_smooth(ck):
+ for mb in mb_list:
+ mb.smooth = ck.state
+
+def cb_ck_fs(ck, win):
+ win.fullscreen = ck.state
+
+def mapbuf_clicked(obj, item=None):
+ global mb_list
+
+ win = elementary.Window("mapbuf", elementary.ELM_WIN_BASIC)
+ win.title_set("Mapbuf test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ bg.file = "images/sky_04.jpg"
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ # launcher
+ sc = elementary.Scroller(win);
+ sc.bounce = (True, False)
+ sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_OFF)
+ sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sc)
+
+ bx = elementary.Box(win)
+ bx.horizontal = True
+ bx.homogeneous = True
+ bx.show()
+
+ for k in range(8):
+ tb = elementary.Table(win)
+ tb.size_hint_align = (0.5, 0.5)
+ tb.size_hint_weight = (0.0, 0.0)
+ tb.show()
+
+ pad = evas.Rectangle(win.evas)
+ pad.color = (255, 255, 0, 255)
+ pad.size_hint_min = (464, 4)
+ pad.size_hint_weight = (0.0, 0.0)
+ pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ pad.show()
+ tb.pack(pad, 1, 0, 5, 1)
+
+ pad = evas.Rectangle(win.evas)
+ pad.color = (255, 255, 0, 255)
+ pad.size_hint_min = (464, 4)
+ pad.size_hint_weight = (0.0, 0.0)
+ pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ pad.show()
+ tb.pack(pad, 1, 11, 5, 1)
+
+ pad = evas.Rectangle(win.evas)
+ pad.color = (255, 255, 0, 255)
+ pad.size_hint_min = (4, 4)
+ pad.size_hint_weight = (0.0, 0.0)
+ pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ pad.show()
+ tb.pack(pad, 0, 1, 1, 10)
+
+ pad = evas.Rectangle(win.evas)
+ pad.color = (255, 255, 0, 255)
+ pad.size_hint_min = (4, 4)
+ pad.size_hint_weight = (0.0, 0.0)
+ pad.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ pad.show()
+ tb.pack(pad, 6, 1, 1, 10)
+
+ mb = elementary.Mapbuf(win)
+ mb_list.append(mb)
+ mb.content = tb
+ bx.pack_end(mb)
+ mb.show()
+
+ n = m = 0
+ for j in range(5):
+ for i in range(5):
+ ic = elementary.Icon(win)
+ ic.scale_set(0.5)
+ ic.file_set("images/icon_%02d.png" % (n));
+ ic.resizable_set(0, 0)
+ ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ic.size_hint_align_set(0.5, 0.5)
+ tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
+ ic.show()
+
+ lb = elementary.Label(win)
+ lb.style = "marker"
+ lb.text = names[m]
+ tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
+ lb.show()
+
+ n = n + 1 if n < 23 else 0
+ m = m + 1 if m < 15 else 0
+
+ sc.content = bx
+ sc.page_relative_set(1.0, 1.0)
+ sc.show()
+
+ # controls
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.homogeneous = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ vbox.pack_start(hbox)
+ hbox.show()
+
+ ck = elementary.Check(win)
+ ck.text = "Map"
+ ck.state = False
+ ck.callback_changed_add(cb_ck_map)
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.callback_changed_add(cb_ck_alpha)
+ ck.text = "Alpha"
+ ck.state = True
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.callback_changed_add(cb_ck_smooth)
+ ck.text = "Smooth"
+ ck.state = True
+ hbox.pack_end(ck)
+ ck.show()
+
+ ck = elementary.Check(win)
+ ck.callback_changed_add(cb_ck_fs, win)
+ ck.text = "FS"
+ ck.state = False
+ hbox.pack_end(ck)
+ ck.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_btn_close, win)
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox.pack_end(bt)
+ bt.show()
+
+ win.resize(480, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ mapbuf_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_menu.py b/examples/elementary/test_menu.py
new file mode 100644
index 0000000..e4b0953
--- /dev/null
+++ b/examples/elementary/test_menu.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def menu_show(rect, evtinfo, menu):
+ (x,y) = evtinfo.position.canvas
+ menu.move(x, y)
+ menu.show()
+
+def menu_populate_4(menu, item):
+ menu.item_add(item, "menu 2", "clock")
+
+ item2 = menu.item_add(item, "menu 3", "folder-new")
+
+ menu.item_separator_add(item)
+
+ item3 = menu.item_add(item, "Disabled item", "document-print");
+ item3.disabled = True
+
+ item3 = menu.item_add(item, "Disabled item", "mail-send");
+ item3.disabled = True
+
+ item3 = menu.item_add(item, "Disabled item", "refresh");
+ item3.disabled = True
+
+def menu_populate_3(menu, item):
+ menu.item_add(item, "menu 2", "refresh")
+
+ item2 = menu.item_add(item, "menu 3", "mail-send")
+
+ menu.item_separator_add(item)
+
+ item3 = menu.item_add(item, "Disabled item", "clock");
+ item3.disabled = True
+
+def menu_populate_2(menu, item):
+ menu.item_add(item, "menu 2", "document-print")
+
+ item2 = menu.item_add(item, "menu 3", "folder-new")
+
+ menu_populate_3(menu, item2)
+
+ menu.item_separator_add(item)
+
+ item2 = menu.item_add(item, "menu 2", "refresh");
+
+ menu.item_separator_add(item)
+
+ item3 = menu.item_add(item, "Disabled item", "mail-send");
+ item3.disabled = True
+
+ menu_populate_4(menu, item2)
+
+def menu_populate_1(menu, item):
+ item2 = menu.item_add(item, "menu 1", "refresh")
+
+ menu_populate_2(menu, item2)
+
+def menu_clicked(obj):
+ win = elementary.Window("menu", elementary.ELM_WIN_BASIC)
+ win.title_set("Menu test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ rect = evas.Rectangle(win.evas_get())
+ win.resize_object_add(rect)
+ rect.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ rect.color_set(0, 0, 0, 0)
+ rect.show()
+
+ menu = elementary.Menu(win)
+ item = menu.item_add(None, "first item", "clock")
+
+ item = menu.item_add(None, "second item", "mail-send")
+ menu_populate_1(menu, item)
+
+ menu.item_add(item, "sub menu", "refresh")
+
+ rect.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu)
+
+ win.resize(350, 200)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ menu_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_multibuttonentry.py b/examples/elementary/test_multibuttonentry.py
new file mode 100644
index 0000000..9113f0f
--- /dev/null
+++ b/examples/elementary/test_multibuttonentry.py
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+counter = 0
+
+def cb_item_selected(mbe, item):
+ print "cb!!!!!!!!!!!" # TODO this is never called
+ print mbe
+ print item
+
+def cb_btn_item_prepend(btn, mbe):
+ global counter
+
+ counter += 1
+ item = mbe.item_prepend("item #%d" % (counter), cb_item_selected, "PippO")
+
+def cb_btn_item_append(btn, mbe):
+ global counter
+
+ counter += 1
+ item = mbe.item_append("item #%d" % (counter), cb_item_selected, "PippO")
+
+def cb_btn_item_insert_after(btn, mbe):
+ global counter
+
+ counter += 1
+ after = mbe.selected_item
+ item = mbe.item_insert_after(after, "item #%d" % (counter), cb_item_selected)
+
+def cb_btn_item_insert_before(btn, mbe):
+ global counter
+
+ counter += 1
+ before = mbe.selected_item
+ item = mbe.item_insert_before(before, "item #%d" % (counter), cb_item_selected)
+
+def cb_btn_clear2(btn, mbe):
+ for item in mbe.items:
+ item.delete()
+
+def cb_filter1(mbe, text):
+ return True
+
+def multibuttonentry_clicked(obj, item=None):
+ win = elementary.Window("multibuttonentry", elementary.ELM_WIN_BASIC)
+ win.title_set("MultiButtonEntry test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(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()
+
+ sc = elementary.Scroller(win)
+ sc.bounce = (False, True)
+ sc.policy = (elementary.ELM_SCROLLER_POLICY_OFF, elementary.ELM_SCROLLER_POLICY_AUTO)
+ sc.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox.pack_end(sc)
+ sc.show()
+
+ mbe = elementary.MultiButtonEntry(win)
+ mbe.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ mbe.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ mbe.text = "To: "
+ mbe.part_text_set("guide", "Tap to add recipient")
+ mbe.filter_append(cb_filter1)
+ sc.content = mbe
+ mbe.show()
+
+ print mbe.entry
+
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = elementary.Button(win)
+ bt.text = "item_append"
+ 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_btn_item_append, mbe)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "item_prepend"
+ 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_btn_item_prepend, mbe)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "item_insert_after"
+ 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_btn_item_insert_after, mbe)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "item_insert_before"
+ 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_btn_item_insert_before, mbe)
+ hbox.pack_end(bt)
+ bt.show()
+
+
+ hbox = elementary.Box(win)
+ hbox.horizontal = True
+ hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ vbox.pack_end(hbox)
+ hbox.show()
+
+ bt = elementary.Button(win)
+ bt.text = "delete selected item"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda btn: mbe.selected_item.delete())
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "clear"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda bt: mbe.clear())
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "clear2"
+ 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_btn_clear2, mbe)
+ hbox.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "toggle expand"
+ bt.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
+ bt.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ bt.callback_clicked_add(lambda btn: mbe.expanded_set(not mbe.expanded_get()))
+ hbox.pack_end(bt)
+ bt.show()
+
+ mbe.focus = True
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ multibuttonentry_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_naviframe.py b/examples/elementary/test_naviframe.py
new file mode 100644
index 0000000..44839db
--- /dev/null
+++ b/examples/elementary/test_naviframe.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def content_new(parent, img):
+ photo = elementary.Photo(parent)
+ photo.file_set(img)
+ photo.fill_inside_set(True)
+ photo.style_set("shadow")
+ return photo
+
+def navi_pop(bt, nf):
+ nf.item_pop()
+
+def navi_promote(bt, nf, item):
+ item.item_promote()
+
+def title_visible(obj, item):
+ item.title_visible = not item.title_visible
+
+def page2(bt, nf):
+ ic = elementary.Icon(nf)
+ ic.file_set("images/icon_right_arrow.png")
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(page3, nf)
+ bt.content_set(ic)
+
+ content = content_new(nf, "images/plant_01.jpg");
+ item = nf.item_push("Page 2", None, bt, content, "basic")
+ item.part_text_set("subtitle", "Here is sub-title part!")
+
+def page3(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Prev")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page4, nf)
+ bt2.text_set("Next")
+
+ content = content_new(nf, "images/rock_01.jpg");
+ item = nf.item_push("Page 3", bt, bt2, content, "basic")
+ ic = elementary.Icon(nf)
+ ic.file_set("images/logo_small.png")
+ item.part_content_set("icon", ic)
+
+def page4(bt, nf):
+ ic = elementary.Icon(nf)
+ ic.file_set("images/icon_right_arrow.png")
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(page5, nf)
+ bt.content_set(ic)
+
+ content = content_new(nf, "images/rock_02.jpg");
+ item = nf.item_push("Page 4", None, bt, content, "basic")
+ ic = elementary.Icon(nf)
+ ic.file_set("images/logo_small.png")
+ item.part_content_set("icon", ic)
+ item.part_text_set("subtitle", "Title area visibility test")
+ item.title_visible_set(False)
+ content.callback_clicked_add(title_visible, item)
+
+def page5(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 4")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page6, nf)
+ bt2.text_set("Page 6")
+
+ content = content_new(nf, "images/sky_01.jpg");
+ item = nf.item_insert_after(nf.top_item_get(), "Page 5", bt, bt2, content, "basic")
+ item.part_text_set("subtitle", "This page is inserted without transition (TODO)")
+
+def page6(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 5")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(page7, nf)
+ bt2.text_set("Page 7")
+
+ content = content_new(nf, "images/sky_03.jpg");
+ item = nf.item_push("Page 6", bt, bt2, content, "overlap")
+ item.part_text_set("subtitle", "Overlap style!")
+
+def page7(bt, nf):
+ bt = elementary.Button(nf)
+ bt.callback_clicked_add(navi_pop, nf)
+ bt.text_set("Page 6")
+
+ bt2 = elementary.Button(nf)
+ bt2.callback_clicked_add(navi_promote, nf, nf.data["page1"])
+ bt2.text_set("Page 1")
+
+ content = content_new(nf, "images/sky_02.jpg");
+ item = nf.item_push("Page 7", bt, bt2, content, "overlap")
+ item.part_text_set("subtitle", "Overlap style!")
+
+
+def naviframe_clicked(obj):
+ win = elementary.Window("naviframe", elementary.ELM_WIN_BASIC)
+ win.title_set("Naviframe test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(bg)
+ bg.show()
+
+ nf = elementary.Naviframe(win)
+ nf.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ nf.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(nf)
+ nf.show()
+
+ bt = elementary.Button(win)
+ bt.callback_clicked_add(page2, nf)
+ bt.text_set("Next")
+
+ content = content_new(nf, "images/logo.png")
+ item = nf.item_push("Page 1", None, bt, content, "basic")
+ nf.data["page1"] = item
+
+ win.resize(400, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ naviframe_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_notify.py b/examples/elementary/test_notify.py
new file mode 100644
index 0000000..28f2c24
--- /dev/null
+++ b/examples/elementary/test_notify.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def notify_close(bt, notify):
+ notify.hide()
+
+def notify_show(bt, win, orient):
+ notify = elementary.Notify(win)
+ notify.repeat_events_set(False)
+ notify.timeout_set(5)
+ notify.orient_set(orient)
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.horizontal_set(True)
+ notify.content_set(bx)
+ bx.show()
+
+ lb = elementary.Label(win)
+ lb.text_set("Text notification")
+ bx.pack_end(lb)
+ lb.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Close")
+ bt.callback_clicked_add(notify_close, notify)
+ bx.pack_end(bt)
+ bt.show()
+ notify.show()
+
+def notify_clicked(obj):
+ win = elementary.Window("notify", elementary.ELM_WIN_BASIC)
+ win.title_set("Notify test")
+ win.autodel_set(True)
+ win.size_hint_min_set(160, 160)
+ win.size_hint_max_set(320, 320)
+ win.resize(320, 320)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb)
+ tb.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP)
+ tb.pack(bt, 1, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Center")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER)
+ tb.pack(bt, 1, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM)
+ tb.pack(bt, 1, 2, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_LEFT)
+ tb.pack(bt, 0, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_LEFT)
+ tb.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom Left")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
+ tb.pack(bt, 0, 2, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_RIGHT)
+ tb.pack(bt, 2, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Top Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_RIGHT)
+ tb.pack(bt, 2, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Bottom Right")
+ bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
+ tb.pack(bt, 2, 2, 1, 1)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ notify_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_panel.py b/examples/elementary/test_panel.py
new file mode 100644
index 0000000..cc03a41
--- /dev/null
+++ b/examples/elementary/test_panel.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def panel_clicked(obj):
+ win = elementary.Window("panel", elementary.ELM_WIN_BASIC)
+ win.title_set("Panel test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ panel = elementary.Panel(win)
+ panel.orient = elementary.ELM_PANEL_ORIENT_LEFT
+ panel.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND);
+ panel.size_hint_align_set(0.0, evas.EVAS_HINT_FILL);
+
+ bt = elementary.Button(win)
+ bt.text_set("HIDE ME :)")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND);
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL);
+ bt.show()
+
+ panel.content_set(bt)
+
+ bx.pack_end(panel)
+ panel.show()
+
+ win.resize(300, 300)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ panel_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+
diff --git a/examples/elementary/test_panes.py b/examples/elementary/test_panes.py
new file mode 100644
index 0000000..9b33140
--- /dev/null
+++ b/examples/elementary/test_panes.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_panes(panes, event):
+ print(("Event: %s" % (event)))
+
+def panes_clicked(obj):
+ win = elementary.Window("panes", elementary.ELM_WIN_BASIC)
+ win.title_set("Panes test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ panes = elementary.Panes(win)
+ win.resize_object_add(panes)
+ panes.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ panes.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ panes.callback_clicked_add(cb_panes, "clicked")
+ panes.callback_clicked_double_add(cb_panes, "clicked,double")
+ panes.callback_press_add(cb_panes, "press")
+ panes.callback_unpress_add(cb_panes, "unpress")
+ panes.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Left"
+ panes.part_content_set("left", bt)
+ bt.show()
+
+ panes_h = elementary.Panes(win)
+ panes_h.horizontal = True
+ panes_h.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ panes_h.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ panes.part_content_set("right", panes_h)
+ panes_h.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Up"
+ panes_h.part_content_set("left", bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Down"
+ panes_h.part_content_set("right", bt)
+ bt.show()
+
+
+ win.resize(320, 480)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ panes_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_photo.py b/examples/elementary/test_photo.py
new file mode 100644
index 0000000..da56685
--- /dev/null
+++ b/examples/elementary/test_photo.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+images = ["panel_01.jpg",
+ "mystrale.jpg",
+ "mystrale_2.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_02.jpg",
+ "sky_03.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg"]
+
+def photo_clicked(obj):
+ win = elementary.Window("photo", elementary.ELM_WIN_BASIC)
+ win.title_set("Photo test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ sc = elementary.Scroller(win)
+ sc.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(sc)
+ sc.show()
+
+ elementary.need_ethumb()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.content = tb
+ tb.show()
+
+ n = 0
+ for j in range(12):
+ for i in range(12):
+ ph = elementary.Photo(win)
+ name = "images/%s" % (images[n])
+ n += 1
+ if n >= 9: n = 0
+ ph.aspect_fixed = False
+ ph.size = 80
+ if n == 8:
+ ph.thumb = name
+ else:
+ ph.file = name
+ ph.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ ph.editable = True
+ if n in [2, 3]:
+ ph.fill_inside = True
+ ph.style = "shadow"
+
+ tb.pack(ph, i, j, 1, 1)
+ ph.show()
+
+ win.resize(300, 300)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ photo_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_popup.py b/examples/elementary/test_popup.py
new file mode 100644
index 0000000..dca315b
--- /dev/null
+++ b/examples/elementary/test_popup.py
@@ -0,0 +1,239 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_bnt_close(btn, popup):
+ if "im" in popup.data:
+ popup.data["im"].delete()
+ popup.delete()
+
+def cb_btn_restack(btn, popup):
+ im = evas.FilledImage(popup.evas);
+ im.file = "images/mystrale_2.jpg"
+ im.move(40, 40)
+ im.resize(500, 320)
+ im.show()
+
+ popup.data["im"] = im
+ popup.raise_()
+
+def cb_popup_center_text(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "This Popup has content area and timeout value is 3 seconds"
+ popup.timeout = 3.0
+ popup.show()
+
+def cb_popup_center_title_text_1button(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "This Popup has content area and " \
+ "action area set, action area has one button Close"
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button1", bt)
+ popup.show()
+
+def cb_popup_center_title_text_1button(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "This Popup has title area, content area and " \
+ "action area set, action area has one button Close"
+ popup.part_text_set("title,text", "Title")
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button1", bt)
+ popup.show()
+
+def cb_popup_center_title_text_block_clicked_event(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "This Popup has title area and content area. " \
+ "When clicked on blocked event region, popup gets deleted"
+ popup.part_text_set("title,text", "Title")
+ popup.callback_block_clicked_add(cb_bnt_close, popup)
+ popup.show()
+
+def cb_popup_bottom_title_text_3button(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "This Popup has title area, content area and " \
+ "action area set with content being character wrapped. " \
+ "action area has three buttons OK, Cancel and Close"
+ popup.content_text_wrap_type = elementary.ELM_WRAP_CHAR
+ popup.part_text_set("title,text", "Title")
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ popup.part_content_set("title,icon", ic)
+
+ bt = elementary.Button(win)
+ bt.text = "OK"
+ popup.part_content_set("button1", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Cancel"
+ popup.part_content_set("button2", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button3", bt)
+
+ popup.show()
+
+def cb_popup_center_title_content_3button(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.part_text_set("title,text", "Title")
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ bt = elementary.Button(win)
+ bt.text = "Content"
+ bt.content = ic
+ popup.content = bt
+
+ bt = elementary.Button(win)
+ bt.text = "OK"
+ popup.part_content_set("button1", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Cancel"
+ popup.part_content_set("button2", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button3", bt)
+
+ popup.show()
+
+def cb_popup_center_title_item_3button(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.part_text_set("title,text", "Title")
+
+ for i in range(1, 11):
+ if i in [3, 5, 6]:
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ popup.item_append("item"+str(i), ic)
+ else:
+ popup.item_append("item"+str(i))
+
+ bt = elementary.Button(win)
+ bt.text = "OK"
+ popup.part_content_set("button1", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Cancel"
+ popup.part_content_set("button2", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button3", bt)
+
+ popup.show()
+
+def cb_popup_center_title_text_2button_restack(li, item, win):
+ popup = elementary.Popup(win)
+ popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup.text = "When you click the 'Restack' button, " \
+ "an image will be located under this popup"
+ popup.part_text_set("title,text", "Title")
+
+ bt = elementary.Button(win)
+ bt.text = "Restack"
+ bt.callback_clicked_add(cb_btn_restack, popup)
+ popup.part_content_set("button1", bt)
+
+ bt = elementary.Button(win)
+ bt.text = "Close"
+ bt.callback_clicked_add(cb_bnt_close, popup)
+ popup.part_content_set("button3", bt)
+
+ popup.show()
+
+times = 0
+g_popup = None
+def cb_popup_center_text_1button_hide_show(li, item, win):
+ global times
+ global g_popup
+
+ times += 1
+
+ if g_popup is not None:
+ g_popup.text = "You have checked this popup %d times." % times
+ g_popup.show()
+ return
+
+ g_popup = elementary.Popup(win)
+ g_popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ g_popup.text = "Hide this popup by using the button." \
+ "When you click list item again, you will see this popup again."
+
+ bt = elementary.Button(win)
+ bt.text = "Hide"
+ bt.callback_clicked_add(lambda b: g_popup.hide())
+ g_popup.part_content_set("button1", bt)
+
+ g_popup.show()
+
+
+def popup_clicked(obj):
+ win = elementary.Window("popup", elementary.ELM_WIN_BASIC)
+ win.title_set("Popup test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ li = elementary.List(win)
+ li.mode = elementary.ELM_LIST_LIMIT
+ li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li.callback_selected_add(lambda li, it: it.selected_set(False))
+ win.resize_object_add(li)
+ li.show()
+
+ li.item_append("popup-center-text", None, None,
+ cb_popup_center_text, win)
+ li.item_append("popup-center-text + 1 button", None, None,
+ cb_popup_center_title_text_1button, win)
+ li.item_append("popup-center-title + text + 1 button", None, None,
+ cb_popup_center_title_text_1button, win)
+ li.item_append("popup-center-title + text (block,clicked handling)", None, None,
+ cb_popup_center_title_text_block_clicked_event, win)
+ li.item_append("popup-bottom-title + text + 3 buttons", None, None,
+ cb_popup_bottom_title_text_3button, win)
+ li.item_append("popup-center-title + content + 3 buttons", None, None,
+ cb_popup_center_title_content_3button, win)
+ li.item_append("popup-center-title + items + 3 buttons", None, None,
+ cb_popup_center_title_item_3button, win)
+ li.item_append("popup-center-title + text + 2 buttons (check restacking)", None, None,
+ cb_popup_center_title_text_2button_restack, win)
+ li.item_append("popup-center-text + 1 button (check hide, show)", None, None,
+ cb_popup_center_text_1button_hide_show, win)
+
+ li.go()
+ win.resize(480, 800)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ popup_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_progressbar.py b/examples/elementary/test_progressbar.py
new file mode 100644
index 0000000..c17628d
--- /dev/null
+++ b/examples/elementary/test_progressbar.py
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import ecore
+from efl import evas
+
+
+my_progressbar_run = False
+my_progressbar_timer = None
+
+def my_progressbar_value_set(pb1, pb2, pb3, pb4, pb5, pb6, pb7):
+ progress = pb1.value_get()
+ if progress < 1.0:
+ progress += 0.0123
+ else:
+ progress = 0.0
+ pb1.value_set(progress)
+ pb4.value_set(progress)
+ pb3.value_set(progress)
+ pb6.value_set(progress)
+ if progress < 1.0:
+ return ecore.ECORE_CALLBACK_RENEW
+ global my_progressbar_run
+ my_progressbar_run = False
+ return ecore.ECORE_CALLBACK_CANCEL
+
+def my_progressbar_test_start(obj, *args, **kwargs):
+ (pb1, pb2, pb3, pb4, pb5, pb6, pb7) = args
+ pb2.pulse(True)
+ pb5.pulse(True)
+ pb7.pulse(True)
+ global my_progressbar_run
+ global my_progressbar_timer
+ if not my_progressbar_run:
+ my_progressbar_timer = ecore.timer_add(0.1, my_progressbar_value_set,
+ *args)
+ my_progressbar_run = True
+
+def my_progressbar_test_stop(obj, pb1, pb2, pb3, pb4, pb5, pb6, pb7):
+ pb2.pulse(False)
+ pb5.pulse(False)
+ pb7.pulse(False)
+ global my_progressbar_run
+ global my_progressbar_timer
+ if my_progressbar_run:
+ my_progressbar_timer.delete()
+ my_progressbar_run = False
+
+def my_progressbar_destroy(obj, *args):
+ my_progressbar_test_stop(None, *args)
+ obj.delete()
+
+def progressbar_clicked(obj):
+ win = elementary.Window("progressbar", elementary.ELM_WIN_BASIC)
+ win.title_set("Progressbar test")
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ pb1 = elementary.Progressbar(win)
+ pb1.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ pb1.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ bx.pack_end(pb1)
+ pb1.show()
+
+ pb2 = elementary.Progressbar(win)
+ pb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ pb2.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ pb2.text_set("Infinite bounce")
+ pb2.pulse_set(True)
+ bx.pack_end(pb2)
+ pb2.show()
+
+ ic1 = elementary.Icon(win)
+ ic1.file_set('images/logo_small.png')
+ ic1.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+
+ pb3 = elementary.Progressbar(win)
+ pb3.text_set("Label")
+ pb3.content_set(ic1)
+ pb3.inverted_set(True)
+ pb3.unit_format_set("%1.1f units")
+ pb3.span_size_set(200)
+ pb3.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ pb3.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(pb3)
+ ic1.show()
+ pb3.show()
+
+ hbx = elementary.Box(win)
+ hbx.horizontal_set(True)
+ hbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ hbx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bx.pack_end(hbx)
+ hbx.show()
+
+ pb4 = elementary.Progressbar(win)
+ pb4.horizontal_set(False)
+ pb4.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ pb4.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ hbx.pack_end(pb4)
+ pb4.span_size_set(60)
+ pb4.text_set("percent")
+ pb4.show()
+
+ pb5 = elementary.Progressbar(win)
+ pb5.horizontal_set(False)
+ pb5.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ pb5.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ pb5.span_size_set(80)
+ pb5.pulse_set(True)
+ pb5.unit_format_set(None)
+ pb5.text_set("Infinite bounce")
+ hbx.pack_end(pb5)
+ pb5.show()
+
+ ic2 = elementary.Icon(win)
+ ic2.file_set('images/logo_small.png')
+ ic2.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1)
+
+ pb6 = elementary.Progressbar(win)
+ pb6.horizontal_set(False)
+ pb6.text_set("Label")
+ pb6.content_set(ic2)
+ pb6.inverted_set(True)
+ pb6.unit_format_set("%1.2f%%")
+ pb6.span_size_set(200)
+ pb6.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ pb6.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ hbx.pack_end(pb6)
+ ic2.show()
+ pb6.show()
+
+ pb7 = elementary.Progressbar(win)
+ pb7.style_set("wheel")
+ pb7.text_set("Style: wheel")
+ pb7.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ pb7.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(pb7)
+ pb7.show()
+
+ bt_bx = elementary.Box(win)
+ bt_bx.horizontal_set(True)
+ bt_bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(bt_bx)
+ bt_bx.show()
+
+ pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7)
+
+ bt = elementary.Button(win)
+ bt.text_set("Start")
+ bt.callback_clicked_add(my_progressbar_test_start, *pbt)
+ bt_bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Stop")
+ bt.callback_clicked_add(my_progressbar_test_stop, *pbt)
+ bt_bx.pack_end(bt)
+ bt.show()
+
+ win.callback_delete_request_add(my_progressbar_destroy, *pbt)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ progressbar_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_radio.py b/examples/elementary/test_radio.py
new file mode 100644
index 0000000..e611560
--- /dev/null
+++ b/examples/elementary/test_radio.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def radio_clicked(obj):
+ win = elementary.Window("radio", elementary.ELM_WIN_BASIC)
+ win.title_set("Radio test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
+ rd = elementary.Radio(win)
+ rd.state_value_set(0)
+ rd.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ rd.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ rd.text_set("Icon sized to radio")
+ rd.content_set(ic)
+ bx.pack_end(rd)
+ rd.show()
+ ic.show()
+ rdg = rd
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ rd = elementary.Radio(win)
+ rd.state_value_set(1)
+ rd.group_add(rdg)
+ rd.text_set("Icon no scale")
+ rd.content_set(ic)
+ bx.pack_end(rd)
+ rd.show()
+ ic.show()
+
+ rd = elementary.Radio(win)
+ rd.state_value_set(2)
+ rd.group_add(rdg)
+ rd.text_set("Label Only")
+ bx.pack_end(rd)
+ rd.show()
+
+ rd = elementary.Radio(win)
+ rd.state_value_set(3)
+ rd.group_add(rdg)
+ rd.text_set("Disabled")
+ rd.disabled_set(True)
+ bx.pack_end(rd)
+ rd.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ rd = elementary.Radio(win)
+ rd.state_value_set(4)
+ rd.group_add(rdg)
+ rd.content_set(ic)
+ bx.pack_end(rd)
+ rd.show()
+ ic.show()
+
+ ic = elementary.Icon(win)
+ ic.file_set('images/logo_small.png')
+ ic.resizable_set(0, 0)
+ rd = elementary.Radio(win)
+ rd.state_value_set(5)
+ rd.group_add(rdg)
+ rd.content_set(ic)
+ rd.disabled_set(True)
+ bx.pack_end(rd)
+ rd.show()
+ ic.show()
+
+ rdg.value_set(2)
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ radio_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_scroller.py b/examples/elementary/test_scroller.py
new file mode 100644
index 0000000..6e2b0fa
--- /dev/null
+++ b/examples/elementary/test_scroller.py
@@ -0,0 +1,135 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_scroller_go_300_300(bt, sc):
+ sc.region_bring_in(300, 300, 318, 318)
+
+def my_scroller_go_900_300(bt, sc):
+ sc.region_bring_in(900, 300, 318, 318)
+
+def my_scroller_go_300_900(bt, sc):
+ sc.region_bring_in(300, 900, 318, 318)
+
+def my_scroller_go_900_900(obj, sc):
+ sc.region_bring_in(900, 900, 318, 318)
+
+def cb_edges(obj, border):
+ print(("Border callback:", border))
+
+def cb_drags(obj, action):
+ print(("Drag callback:", action))
+
+def cb_anims(obj, action):
+ print(("Anim callback:", action))
+
+def scroller_clicked(obj):
+ win = elementary.Window("scroller", elementary.ELM_WIN_BASIC)
+ win.title_set("Scroller")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+
+ img = ["images/panel_01.jpg",
+ "images/plant_01.jpg",
+ "images/rock_01.jpg",
+ "images/rock_02.jpg",
+ "images/sky_01.jpg",
+ "images/sky_02.jpg",
+ "images/sky_03.jpg",
+ "images/sky_04.jpg",
+ "images/wood_01.jpg"]
+
+ n = 0
+ for j in range(12):
+ for i in range(12):
+ bg2 = elementary.Background(win)
+ bg2.file_set(img[n])
+
+ n = n + 1
+ if n >= 9:
+ n = 0
+ bg2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ bg2.size_hint_min_set(318, 318)
+ tb.pack(bg2, i, j, 1, 1)
+ bg2.show()
+
+ sc = elementary.Scroller(win)
+ sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc.callback_edge_top_add(cb_edges, "top")
+ sc.callback_edge_bottom_add(cb_edges, "bottom")
+ sc.callback_edge_left_add(cb_edges, "left")
+ sc.callback_edge_right_add(cb_edges, "right")
+ sc.callback_scroll_drag_start_add(cb_drags, "start")
+ sc.callback_scroll_drag_stop_add(cb_drags, "stop")
+ sc.callback_scroll_anim_start_add(cb_anims, "start")
+ sc.callback_scroll_anim_stop_add(cb_anims, "stop")
+ win.resize_object_add(sc)
+
+ sc.content_set(tb)
+ tb.show()
+
+ sc.page_relative_set(1.0, 1.0)
+ sc.show()
+
+ tb2 = elementary.Table(win)
+ tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb2)
+
+ bt = elementary.Button(win)
+ bt.text_set("to 300 300")
+ bt.callback_clicked_add(my_scroller_go_300_300, sc)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.1, 0.1)
+ tb2.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("to 900 300")
+ bt.callback_clicked_add(my_scroller_go_900_300, sc)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.1)
+ tb2.pack(bt, 1, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("to 300 900")
+ bt.callback_clicked_add(my_scroller_go_300_900, sc)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.1, 0.9)
+ tb2.pack(bt, 0, 1, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("to 900 900")
+ bt.callback_clicked_add(my_scroller_go_900_900, sc)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.9, 0.9)
+ tb2.pack(bt, 1, 1, 1, 1)
+ bt.show()
+
+ tb2.show()
+
+ win.resize(320, 320)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ scroller_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_segment_control.py b/examples/elementary/test_segment_control.py
new file mode 100644
index 0000000..7bd1b1d
--- /dev/null
+++ b/examples/elementary/test_segment_control.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def cb_seg_changed(seg, item):
+ print seg
+ print item
+
+def segment_control_clicked(obj):
+ win = elementary.Window("segment-control", elementary.ELM_WIN_BASIC)
+ win.title_set("Segment Control test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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)
+ vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ win.resize_object_add(vbox)
+ vbox.show()
+
+ # segment 1
+ seg = elementary.SegmentControl(win)
+ seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ seg.size_hint_align = (evas.EVAS_HINT_FILL,0.5)
+ seg.item_add(None, "Only Text")
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ it = seg.item_add(ic)
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ seg.item_add(ic, "Text + Icon")
+ seg.item_add(None, "Seg4")
+ seg.item_add(None, "Seg5")
+
+ seg.callback_changed_add(cb_seg_changed)
+ # it.selected_set(True)
+ vbox.pack_end(seg)
+ seg.show()
+
+ # segment 2
+ seg = elementary.SegmentControl(win)
+ seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+ seg.item_add(None, "SegmentItem")
+ it = seg.item_add(None, "SegmentItem")
+ seg.item_add(None, "SegmentItem")
+ seg.item_add(None, "SegmentItem")
+
+ print it
+ # it.selected_set(True)
+ vbox.pack_end(seg)
+ seg.show()
+
+ # segment 3
+ seg = elementary.SegmentControl(win)
+ seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ seg.size_hint_align = (0.5, 0.5)
+
+ for i in range(3):
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ if i == 1:
+ it = seg.item_add(ic)
+ else:
+ seg.item_add(ic)
+
+ # it.selected_set(True)
+ vbox.pack_end(seg)
+ seg.show()
+
+ # segment 4
+ seg = elementary.SegmentControl(win)
+
+ seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ seg.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
+
+ seg.item_add(None, "Disabled")
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ seg.item_add(ic, "Disabled")
+
+ ic = elementary.Icon(win)
+ ic.file = "images/logo_small.png"
+ seg.item_add(ic)
+
+ seg.disabled = True
+ # it.selected_set(True)
+ vbox.pack_end(seg)
+ seg.show()
+
+
+ win.resize(320, 280)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ segment_control_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_separator.py b/examples/elementary/test_separator.py
new file mode 100644
index 0000000..c11531a
--- /dev/null
+++ b/examples/elementary/test_separator.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def separator_clicked(obj):
+ win = elementary.Window("separators", elementary.ELM_WIN_BASIC)
+ win.title_set("Separators")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx0 = elementary.Box(win)
+ bx0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx0.horizontal_set(True)
+ win.resize_object_add(bx0)
+ bx0.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx0.pack_end(bx)
+ bx.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left upper corner")
+ bx.pack_end(bt)
+ bt.show()
+
+ sp = elementary.Separator(win)
+ sp.horizontal_set(True)
+ bx.pack_end(sp)
+ sp.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Left lower corner")
+ bt.disabled_set(True)
+ bx.pack_end(bt)
+ bt.show()
+
+ sp = elementary.Separator(win)
+ bx0.pack_end(sp)
+ sp.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx0.pack_end(bx)
+ bx.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right upper corner")
+ bt.disabled_set(True)
+ bx.pack_end(bt)
+ bt.show()
+
+ sp = elementary.Separator(win)
+ sp.horizontal_set(True)
+ bx.pack_end(sp)
+ sp.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Right lower corner")
+ bx.pack_end(bt)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ separator_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_slideshow.py b/examples/elementary/test_slideshow.py
new file mode 100644
index 0000000..5c25bed
--- /dev/null
+++ b/examples/elementary/test_slideshow.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+img1 = "images/logo.png"
+img2 = "images/plant_01.jpg"
+img3 = "images/rock_01.jpg"
+img4 = "images/rock_02.jpg"
+img5 = "images/sky_01.jpg"
+img6 = "images/sky_04.jpg"
+img7 = "images/wood_01.jpg"
+img8 = "images/mystrale.jpg"
+img9 = "images/mystrale_2.jpg"
+
+def notify_show(no, event, *args, **kwargs):
+ no = args[0]
+ no.show()
+
+def next(bt, ss):
+ ss.next()
+
+def previous(bt, ss):
+ ss.previous()
+
+def mouse_in(bx, event, *args, **kwargs):
+ no = args[0]
+ no.timeout = 0.0
+ no.show()
+
+def mouse_out(bx, event, *args, **kwargs):
+ no = args[0]
+ no.timeout = 3.0
+
+def hv_select(hv, hvit, ss, transition):
+ ss.transition = transition
+ hv.text = transition
+
+def layout_select(hv, hvit, ss, layout):
+ ss.layout = layout
+ hv.text = layout
+
+def start(bt, ss, sp, bt_start, bt_stop):
+ ss.timeout = sp.value
+ bt_start.disabled = True
+ bt_stop.disabled = False
+
+def stop(bt, ss, sp, bt_start, bt_stop):
+ ss.timeout = 0.0
+ bt_start.disabled = False
+ bt_stop.disabled = True
+
+def spin(sp, ss):
+ if (ss.timeout > 0):
+ ss.timeout = sp.value
+
+def slide_transition(ss, slide_it, slide_last_it):
+ if (slide_last_it == slide_it):
+ print("Reaches to End of slides\n")
+
+class ssClass(elementary.SlideshowItemClass):
+ def get(self, obj, *args, **kwargs):
+ photo = elementary.Photo(obj)
+ photo.file = args[0]
+ photo.fill_inside = True
+ photo.style = "shadow"
+
+ return photo
+
+def slideshow_clicked(obj):
+ win = elementary.StandardWindow("slideshow", "Slideshow")
+ win.autodel = True
+
+ ss = elementary.Slideshow(win)
+ ss.loop = True
+ win.resize_object_add(ss)
+ ss.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ss.show()
+
+ ssc = ssClass()
+ ss.item_add(ssc, img1)
+ ss.item_add(ssc, img2)
+ ss.item_add(ssc, img3)
+ ss.item_add(ssc, img4)
+ ss.item_add(ssc, img9)
+ ss.item_add(ssc, img5)
+ ss.item_add(ssc, img6)
+ ss.item_add(ssc, img7)
+ slide_last_it = ss.item_add(ssc, img8)
+ ss.callback_transition_end_add(slide_transition, slide_last_it)
+
+ no = elementary.Notify(win)
+ no.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
+ no.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(no)
+ no.timeout = 3.0
+
+ bx = elementary.Box(win)
+ bx.horizontal = True
+ no.content = bx
+ bx.show()
+
+ bx.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, mouse_in, no)
+ bx.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, mouse_out, no)
+
+ bt = elementary.Button(win)
+ bt.text = "Previous"
+ bt.callback_clicked_add(previous, ss)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text = "Next"
+ bt.callback_clicked_add(next, ss)
+ bx.pack_end(bt)
+ bt.show()
+
+ hv = elementary.Hoversel(win)
+ bx.pack_end(hv)
+ hv.hover_parent = win
+ for transition in ss.transitions:
+ hv.item_add(transition, None, 0, hv_select, ss, transition)
+ hv.item_add("None", None, 0, hv_select, ss, None)
+ hv.text_set(ss.transitions[0])
+ hv.show()
+
+ hv = elementary.Hoversel(win)
+ bx.pack_end(hv)
+ hv.hover_parent = win
+ for layout in ss.layouts:
+ hv.item_add(layout, None, 0, layout_select, ss, layout)
+ hv.text = ss.layout
+ hv.show()
+
+ sp = elementary.Spinner(win)
+ sp.label_format = "%2.0f secs."
+ sp.callback_changed_add(spin, ss)
+ sp.step = 1
+ sp.min_max = (1, 30)
+ sp.value = 3
+ bx.pack_end(sp)
+ sp.show()
+
+ bt_start = elementary.Button(win)
+ bt_stop = elementary.Button(win)
+
+ bt = bt_start
+ bt.text = "Start"
+ bt.callback_clicked_add(start, ss, sp, bt_start, bt_stop)
+ bx.pack_end(bt)
+ bt.show()
+
+ bt = bt_stop
+ bt.text = "Stop"
+ bt.callback_clicked_add(stop, ss, sp, bt_start, bt_stop)
+ bx.pack_end(bt)
+ bt.disabled = True
+ bt.show()
+
+ ss.event_callback_add(evas.EVAS_CALLBACK_MOUSE_UP, notify_show, no)
+ ss.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, notify_show, no)
+
+ win.resize(500, 400)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ slideshow_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_spinner.py b/examples/elementary/test_spinner.py
new file mode 100644
index 0000000..169fc6f
--- /dev/null
+++ b/examples/elementary/test_spinner.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def spinner_clicked(obj):
+ win = elementary.Window("spinner", elementary.ELM_WIN_BASIC)
+ win.title_set("Spinner test")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bx)
+ bx.show()
+
+ sp = elementary.Spinner(win)
+ sp.label_format_set("%1.1f units")
+ sp.step_set(1.3)
+ sp.wrap_set(1)
+ sp.min_max_set(-50.0, 250.0)
+ sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(sp)
+ sp.show()
+
+ sp = elementary.Spinner(win)
+ sp.label_format_set("%1.1f units")
+ sp.step_set(1.3)
+ sp.wrap_set(1)
+ sp.style_set("vertical");
+ sp.min_max_set(-50.0, 250.0)
+ sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(sp)
+ sp.show()
+
+ sp = elementary.Spinner(win)
+ sp.label_format_set("Disabled %.0f")
+ sp.disabled_set(1)
+ sp.min_max_set(-50.0, 250.0)
+ sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.pack_end(sp)
+ sp.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ spinner_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_table.py b/examples/elementary/test_table.py
new file mode 100644
index 0000000..9319c75
--- /dev/null
+++ b/examples/elementary/test_table.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def table_clicked(obj):
+ win = elementary.Window("table", elementary.ELM_WIN_BASIC)
+ win.title_set("Table")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ tb = elementary.Table(win)
+ win.resize_object_add(tb)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 1")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 2")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 1, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 3")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 2, 0, 1, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 4")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 0, 1, 2, 1)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 5")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 2, 1, 1, 3)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Button 6")
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(bt, 0, 2, 2, 2)
+ bt.show()
+
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ table_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_thumb.py b/examples/elementary/test_thumb.py
new file mode 100644
index 0000000..87f198d
--- /dev/null
+++ b/examples/elementary/test_thumb.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def thumb_clicked(obj):
+ if not elementary.need_ethumb():
+ print("Ethumb not available!")
+ return
+
+ images = (
+ "panel_01.jpg",
+ "plant_01.jpg",
+ "rock_01.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_02.jpg",
+ "sky_03.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg",
+ "mystrale.jpg",
+ "mystrale_2.jpg"
+ )
+
+ win = elementary.StandardWindow("thumb", "Thumb")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+
+ n = 0
+ for j in range(12):
+ for i in range(12):
+ th = elementary.Thumb(win)
+ n = (n + 1) % 11
+ th.file = "images/%s" % (images[n])
+ th.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ th.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ tb.pack(th, i, j, 1, 1)
+ th.editable = True
+ th.show()
+
+ sc = elementary.Scroller(win)
+ sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(sc)
+
+ sc.content_set(tb)
+ tb.show()
+ sc.show()
+
+ win.resize(600, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ thumb_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_toolbar.py b/examples/elementary/test_toolbar.py
new file mode 100644
index 0000000..01256b8
--- /dev/null
+++ b/examples/elementary/test_toolbar.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def tb_1(obj, it, ph):
+ ph.file_set("images/panel_01.jpg")
+
+def tb_2(obj, it, ph):
+ ph.file_set("images/rock_01.jpg")
+
+def tb_3(obj, it, ph):
+ ph.file_set("images/wood_01.jpg")
+
+def tb_4(obj, it, ph):
+ ph.file_set("images/sky_03.jpg")
+
+def tb_5(obj, it, ph):
+ ph.file_set(None)
+
+def toolbar_clicked(obj):
+ win = elementary.Window("toolbar", elementary.ELM_WIN_BASIC)
+ win.title_set("Toolbar")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ tb = elementary.Toolbar(win)
+ tb.homogeneous = False
+ tb.size_hint_weight_set(0.0, 0.0)
+ tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+
+ ph1 = elementary.Photo(win)
+ ph2 = elementary.Photo(win)
+ ph3 = elementary.Photo(win)
+ ph4 = elementary.Photo(win)
+
+ item = tb.item_append("document-print", "Hello", tb_1)
+ item.disabled = True
+
+ item = tb.item_append("clock", "World,", tb_2, ph2)
+ item.selected_set(True)
+
+ tb.item_append("folder-new", "here", tb_3, ph4)
+
+ tb.item_append("clock", "comes", tb_4, ph4)
+
+ tb.item_append("folder-new", "python-elementary!", tb_5, ph4)
+
+ item = tb.item_append("clock", "Menu", tb_5, ph4)
+ item.menu_set(True)
+ tb.menu_parent_set(win)
+ menu = item.menu_get()
+
+ menu.item_add(None, "Here", "clock", tb_3, ph4)
+
+ menu_item = menu.item_add(None, "Comes", "refresh", tb_4, ph4)
+
+ menu.item_add(menu_item, "hey ho", "folder-new", tb_4, ph4)
+
+ menu.item_add(None, "python-elementary", "document-print", tb_5, ph4)
+
+ bx.pack_end(tb)
+ tb.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(0.0, evas.EVAS_HINT_EXPAND)
+ tb.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+
+ ph1.size_set(40)
+ ph1.file_set("images/plant_01.jpg")
+ ph1.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph1.size_hint_align_set(0.5, 0.5)
+ tb.pack(ph1, 0, 0, 1, 1)
+ ph1.show()
+
+ ph2.size_set(80)
+ ph2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph2.size_hint_align_set(0.5, 0.5)
+ tb.pack(ph2, 1, 0, 1, 1)
+ ph2.show()
+
+ ph3.size_set(40)
+ ph3.file_set("images/sky_01.jpg")
+ ph3.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph3.size_hint_align_set(0.5, 0.5)
+ tb.pack(ph3, 0, 1, 1, 1)
+ ph3.show()
+
+ ph4.size_set(60)
+ ph4.file_set("images/sky_02.jpg")
+ ph4.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ph4.size_hint_align_set(0.5, 0.5)
+ tb.pack(ph4, 1, 1, 1, 1)
+ ph4.show()
+
+ bx.pack_end(tb)
+ tb.show()
+
+ win.resize(320, 300)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ toolbar_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_tooltip.py b/examples/elementary/test_tooltip.py
new file mode 100644
index 0000000..f7e4451
--- /dev/null
+++ b/examples/elementary/test_tooltip.py
@@ -0,0 +1,230 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def _tt_icon(obj, *args, **kargs):
+ ic = elementary.Icon(obj)
+ ic.file_set("images/logo_small.png")
+ ic.resizable_set(0, 0)
+ ic.resize(64, 64)
+ return ic
+
+def _tt_item_icon(obj, item, *args, **kargs):
+ return _tt_icon(obj,item, *args, **kargs)
+
+def _tt_icon2(obj, *args, **kargs):
+ ic = elementary.Icon(obj)
+ ic.file_set("images/icon_00.png")
+ ic.resizable_set(0, 0)
+ ic.resize(64, 64)
+ return ic
+
+def _tt_timer_del(obj, data, *args):
+ timer = data.get("timer")
+ if timer:
+ timer.delete()
+ del data["timer"]
+
+
+def tooltip_clicked(obj):
+ win = elementary.Window("tooltips", elementary.ELM_WIN_BASIC)
+ win.title_set("Tooltips")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ bx = elementary.Box(win)
+ win.resize_object_add(bx)
+ bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx.show()
+
+ tb = elementary.Toolbar(win)
+ tb.homogeneous_set(False)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ tb.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ bx.pack_end(tb)
+ tb.show()
+
+ ti = tb.item_append("folder-new", "Open", None, None)
+ ti.tooltip_text_set("Opens a file")
+
+ ti = tb.item_append("clock", "Icon", None, None)
+ ti.tooltip_content_cb_set(_tt_item_icon, None)
+ ti.tooltip_style_set("transparent")
+
+ bt = elementary.Button(win)
+ bt.text_set("Simple text tooltip");
+ bt.tooltip_text_set("Simple text tooltip")
+ bx.pack_end(bt)
+ bt.show()
+
+ def _tt_text_replace(obj, data):
+ value = data.get("value")
+ if not value:
+ value = 1
+ obj.tooltip_text_set("count=%d" % value)
+ value += 1
+ data["value"] = value
+
+ bt = elementary.Button(win)
+ bt.text_set("Simple text tooltip, click to change");
+ bt.tooltip_text_set("Initial")
+ data = dict()
+ bt.callback_clicked_add(_tt_text_replace, data)
+ bx.pack_end(bt)
+ bt.show()
+
+ def _tt_text_replace_timer_cb(obj, data):
+ _tt_text_replace(obj, data)
+ return True
+
+ def _tt_text_replace_timed(obj, data, *args, **kargs):
+ timer = data.get("timer")
+ if timer:
+ timer.delete()
+ del data["timer"]
+ obj.text_set("Simple text tooltip, click to start changed timed")
+ return
+ data["timer"] = ecore.timer_add(1.5, _tt_text_replace_timer_cb, obj,
+ data)
+ obj.text_set("Simple text tooltip, click to stop changed timed")
+
+ bt = elementary.Button(win)
+ bt.text_set("Simple text tooltip, click to start changed timed");
+ bt.tooltip_text_set("Initial")
+ data = dict()
+ bt.callback_clicked_add(_tt_text_replace_timed, data)
+ bx.pack_end(bt)
+ bt.show()
+ bt.on_del_add(_tt_timer_del, data)
+
+ bt = elementary.Button(win)
+ bt.text_set("Icon tooltip");
+ bt.tooltip_content_cb_set(_tt_icon, None)
+ bx.pack_end(bt)
+ bt.show()
+
+ def _tt_icon_replace_timer_cb(obj, data):
+ value = data.get("value")
+ data["value"] = not value
+ if value:
+ obj.tooltip_content_cb_set(_tt_icon)
+ else:
+ obj.tooltip_content_cb_set(_tt_icon2)
+ return True
+
+ def _tt_icon_replace_timed(obj, data, *args, **kargs):
+ timer = data.get("timer")
+ if timer:
+ timer.delete()
+ del data["timer"]
+ obj.text_set("Icon tooltip, click to start changed timed")
+ return
+ data["timer"] = ecore.timer_add(1.5, _tt_icon_replace_timer_cb, obj,
+ data)
+ obj.text_set("Icon tooltip, click to stop changed timed")
+
+ bt = elementary.Button(win)
+ bt.text_set("Icon tooltip, click to start changed timed");
+ bt.tooltip_content_cb_set(_tt_icon)
+ data = dict()
+ bt.callback_clicked_add(_tt_icon_replace_timed, data)
+ bx.pack_end(bt)
+ bt.show()
+ bt.on_del_add(_tt_timer_del, data)
+
+ bt = elementary.Button(win)
+ bt.text_set("Transparent Icon tooltip");
+ bt.tooltip_content_cb_set(_tt_icon, None)
+ bt.tooltip_style_set("transparent")
+ bx.pack_end(bt)
+ bt.show()
+
+ def _tt_style_replace_timer_cb(obj, data):
+ value = data.get("value")
+ data["value"] = not value
+ if value:
+ obj.tooltip_style_set()
+ else:
+ obj.tooltip_style_set("transparent")
+ return True
+
+ def _tt_style_replace_timed(obj, data, *args, **kargs):
+ timer = data.get("timer")
+ if timer:
+ timer.delete()
+ del data["timer"]
+ obj.text_set("Icon tooltip style, click to start changed timed")
+ return
+ data["timer"] = ecore.timer_add(1.5, _tt_style_replace_timer_cb, obj,
+ data)
+ obj.text_set("Icon tooltip, click to stop changed timed")
+
+ bt = elementary.Button(win)
+ bt.text_set("Icon tooltip style, click to start changed timed");
+ bt.tooltip_content_cb_set(_tt_icon, None)
+ data = dict()
+ bt.callback_clicked_add(_tt_style_replace_timed, data)
+ bx.pack_end(bt)
+ bt.show()
+ bt.on_del_add(_tt_timer_del, data)
+
+ def _tt_visible_lock_toggle(obj, data, *args, **kargs):
+ value = data.get("value")
+ data["value"] = not value
+ if value:
+ obj.text_set("Unlocked tooltip visibility");
+ obj.tooltip_hide()
+ else:
+ obj.text_set("Locked tooltip visibility");
+ obj.tooltip_show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Unlocked tooltip visibility");
+ bt.tooltip_text_set("This tooltip is unlocked visible,<br> clock the button to lock!")
+ data = dict()
+ bt.callback_clicked_add(_tt_visible_lock_toggle, data)
+ bx.pack_end(bt)
+ bt.show()
+
+ en = elementary.Entry(win)
+ en.scrollable_set(True)
+ en.single_line_set(True)
+ en.entry_set("Hello, some scrolled entry here!")
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
+ en.tooltip_text_set("Type something here!")
+ bx.pack_end(en)
+ en.show()
+
+ lst = elementary.List(win)
+ li = lst.item_append("Hello")
+ li.tooltip_text_set("Something useful here?")
+ li = lst.item_append("Icon Tooltip")
+ li.tooltip_content_cb_set(_tt_item_icon, None)
+ lst.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ lst.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ lst.size_hint_min_set(100, 100)
+ bx.pack_end(lst)
+ lst.go()
+ lst.show()
+
+ win.show()
+ win.resize(400, 500)
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ tooltip_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_video.py b/examples/elementary/test_video.py
new file mode 100644
index 0000000..8519eae
--- /dev/null
+++ b/examples/elementary/test_video.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def my_bt_open(bt, file, video):
+ if (file and video):
+ video.file_set(file)
+ video.play()
+
+def notify_show(video, event, no):
+ no.show()
+
+def notify_block(video, event, no):
+ no.timeout = 0.0
+ no.show()
+
+def notify_unblock(video, event, no):
+ no.timeout = 3.0
+ no.show()
+
+def video_clicked(obj):
+ win = elementary.Window("video", elementary.ELM_WIN_BASIC)
+ win.title = "video"
+ win.autodel = True
+ win.alpha = True # Needed to turn video fast path on
+
+ bg = elementary.Background(win)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(bg)
+ bg.show()
+
+ video = elementary.Video(win)
+ video.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(video)
+ video.show()
+
+ notify = elementary.Notify(win)
+ notify.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
+ notify.timeout = 3.0
+
+ player = elementary.Player(win)
+ player.content = video
+ notify.content = player
+ player.show()
+
+ tb = elementary.Table(win)
+ tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ win.resize_object_add(tb)
+
+ bt = elementary.FileselectorButton(win)
+ bt.text = "Select Video"
+ bt.callback_file_chosen_add(my_bt_open, video)
+ bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bt.size_hint_align_set(0.5, 0.1)
+ tb.pack(bt, 0, 0, 1, 1)
+ bt.show()
+
+ tb.show()
+
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
+ video.event_callback_add(evas.EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)
+
+ win.resize(800, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ video_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_web.py b/examples/elementary/test_web.py
new file mode 100644
index 0000000..ec8e007
--- /dev/null
+++ b/examples/elementary/test_web.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+def web_clicked(obj):
+ if not elementary.need_web():
+ print("EFL-webkit not available!")
+ return
+
+ win = elementary.Window("web", elementary.ELM_WIN_BASIC)
+ win.title_set("Web")
+ win.autodel_set(True)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ bg = elementary.Background(win)
+ win.resize_object_add(bg)
+ bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bg.show()
+
+ vbx = elementary.Box(win)
+ win.resize_object_add(vbx)
+ vbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbx.show()
+
+ web = elementary.Web(win)
+ web.uri_set("http://enlightenment.org/")
+ web.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ web.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ web.size_hint_min_set(100, 100)
+ vbx.pack_end(web)
+ web.show()
+
+ # Debug:
+ def dbg(*args):
+ print(("DEBUG: %s" % args[-1], " ".join(repr(x) for x in args[1:-1])))
+ web.callback_link_hover_in_add(dbg, "link in")
+ web.callback_link_hover_out_add(dbg, "link out")
+
+ web.callback_uri_changed_add(dbg, "uri")
+ web.callback_title_changed_add(dbg, "title")
+ web.callback_load_finished_add(dbg, "load finished")
+ web.callback_load_finished_add(dbg, "load error")
+ web.callback_load_progress_add(dbg, "load progress")
+ web.callback_load_provisional_add(dbg, "load provisional")
+ web.callback_load_started_add(dbg, "load started")
+
+ # JS debug to console:
+ def console_msg(obj, msg, line, src):
+ print(("CONSOLE: %s:%d %r" % (src, line, msg)))
+ web.console_message_hook_set(console_msg)
+
+ # navigation bar:
+ hbx = elementary.Box(win)
+ hbx.horizontal_set(True)
+ hbx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ hbx.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
+ vbx.pack_start(hbx)
+ hbx.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Back")
+ bt.callback_clicked_add(lambda x: web.back())
+ hbx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Forward")
+ bt.callback_clicked_add(lambda x: web.forward())
+ hbx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Reload")
+ bt.callback_clicked_add(lambda x: web.reload())
+ hbx.pack_end(bt)
+ bt.show()
+
+ bt = elementary.Button(win)
+ bt.text_set("Stop")
+ bt.callback_clicked_add(lambda x: web.stop())
+ hbx.pack_end(bt)
+ bt.show()
+
+ en = elementary.Entry(win)
+ en.scrollable_set(True)
+ en.editable_set(True)
+ en.single_line_set(True)
+ en.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
+ en.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ hbx.pack_end(en)
+ en.show()
+
+ # Sync navigation entry and current URI
+ def do_change_uri(en):
+ web.uri = en.entry
+
+ def did_change_uri(web, uri, en):
+ en.entry = uri
+
+ en.callback_activated_add(do_change_uri)
+ web.callback_uri_changed_add(did_change_uri, en)
+
+ # Sync title
+ def did_change_title(web, title, win):
+ win.title_set("Web - %s" % title)
+ web.callback_title_changed_add(did_change_title, win)
+
+ win.resize(800, 600)
+ win.show()
+
+
+if __name__ == "__main__":
+ elementary.init()
+ elementary.policy_set(elementary.ELM_POLICY_QUIT,
+ elementary.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
+
+ web_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
diff --git a/examples/elementary/test_win.py b/examples/elementary/test_win.py
new file mode 100644
index 0000000..1f44aef
--- /dev/null
+++ b/examples/elementary/test_win.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from efl import elementary
+from efl import evas
+
+
+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)
+ if obj is None:
+ win.callback_delete_request_add(lambda o: elementary.exit())
+
+ 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()
+
+
+if __name__ == "__main__":
+ elementary.init()
+
+ window_states_clicked(None)
+
+ elementary.run()
+ elementary.shutdown()
+