aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-03 10:42:50 +0200
commitcf1f98bbf611ad14662254988a48529cfedcf49c (patch)
tree870be59a45571058abf7d380dbf6ecc359ad5748 /examples/elementary
parentElementary.progressbar: Style "recording" -> "double" (diff)
downloadpython-efl-cf1f98bbf611ad14662254988a48529cfedcf49c.tar.gz
Elementary: Improve the rest of the examples.
Summary of changes: - Make use of constructor keyword args - Most scripts are now working directory agnostic - Enabled evas textgrid example - Printed messages are slightly better formatted
Diffstat (limited to 'examples/elementary')
-rw-r--r--examples/elementary/test_bg.py1
-rw-r--r--examples/elementary/test_config.py11
-rw-r--r--examples/elementary/test_cursor.py2
-rw-r--r--examples/elementary/test_floating.py10
-rw-r--r--examples/elementary/test_map.py106
-rw-r--r--examples/elementary/test_map2.py198
-rw-r--r--examples/elementary/test_map3.py188
-rw-r--r--examples/elementary/test_mapbuf.py123
-rw-r--r--examples/elementary/test_menu.py24
-rw-r--r--examples/elementary/test_multibuttonentry.py110
-rw-r--r--examples/elementary/test_naviframe.py109
-rw-r--r--examples/elementary/test_notify.py91
-rw-r--r--examples/elementary/test_panel.py38
-rw-r--r--examples/elementary/test_panes.py36
-rw-r--r--examples/elementary/test_photo.py49
-rw-r--r--examples/elementary/test_photocam.py64
-rw-r--r--examples/elementary/test_popup.py125
-rw-r--r--examples/elementary/test_progressbar.py128
-rw-r--r--examples/elementary/test_radio.py79
-rw-r--r--examples/elementary/test_scroller.py91
-rw-r--r--examples/elementary/test_segment_control.py78
-rw-r--r--examples/elementary/test_separator.py82
-rw-r--r--examples/elementary/test_slideshow.py133
-rw-r--r--examples/elementary/test_spinner.py87
-rw-r--r--examples/elementary/test_table.py54
-rw-r--r--examples/elementary/test_thumb.py29
-rw-r--r--examples/elementary/test_toolbar.py195
-rw-r--r--examples/elementary/test_tooltip.py92
-rw-r--r--examples/elementary/test_transit.py192
-rw-r--r--examples/elementary/test_video.py54
-rw-r--r--examples/elementary/test_win.py75
31 files changed, 1043 insertions, 1611 deletions
diff --git a/examples/elementary/test_bg.py b/examples/elementary/test_bg.py
index 8e1d66a..3167726 100644
--- a/examples/elementary/test_bg.py
+++ b/examples/elementary/test_bg.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
+import os
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
diff --git a/examples/elementary/test_config.py b/examples/elementary/test_config.py
index 19f8265..d6030e2 100644
--- a/examples/elementary/test_config.py
+++ b/examples/elementary/test_config.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
# encoding: utf-8
+import os
+
from efl import elementary
from efl.elementary.window import StandardWindow, Window, ELM_WIN_INLINED_IMAGE, \
ELM_WIN_SOCKET_IMAGE
@@ -25,6 +27,9 @@ EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
FILL_HORIZ = EVAS_HINT_FILL, 0.5
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
class Prof_Data(object):
rdg = None
cks = []
@@ -229,7 +234,8 @@ def plug_add(win, bx, name):
plug = Plug(win, size_hint_weight=EXPAND_BOTH)
if plug.connect(name, 0, False):
- ly = Layout(win, file=("test.edj", "win_config"),
+ ly = Layout(win,
+ file=(os.path.join(script_path, "test.edj"), "win_config"),
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
ly.show()
@@ -338,7 +344,7 @@ def config_clicked(obj, data=None):
if data:
if data.available_profiles:
- win.available_profiles = data.available_profiles,
+ win.available_profiles = data.available_profiles
if data.profile:
win.profile = data.profile
@@ -349,7 +355,6 @@ def config_clicked(obj, data=None):
win.show()
-
if __name__ == "__main__":
elementary.init()
diff --git a/examples/elementary/test_cursor.py b/examples/elementary/test_cursor.py
index c3c51e6..b6d8058 100644
--- a/examples/elementary/test_cursor.py
+++ b/examples/elementary/test_cursor.py
@@ -48,7 +48,7 @@ def cursor_clicked(obj, item=None):
lst.go()
lst.show()
- en = Entry(win, scrollable=True, single_line=True, entry="Xterm cursor"
+ en = Entry(win, scrollable=True, single_line=True, entry="Xterm cursor",
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ,
cursor="xterm")
bx.pack_end(en)
diff --git a/examples/elementary/test_floating.py b/examples/elementary/test_floating.py
index 61182d5..5072bdb 100644
--- a/examples/elementary/test_floating.py
+++ b/examples/elementary/test_floating.py
@@ -12,15 +12,17 @@ from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
class ItemClass(GenlistItemClass):
def text_get(self, obj, part, *args, **kwargs):
return "Item #{0}".format(args[0])
def content_get(self, obj, part, *args, **kwargs):
- ic = Icon(obj)
- ic.file = "images/logo_small.png"
- ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
- return ic
+ ic = Icon(obj, file=os.path.join(img_path, "logo_small.png"),
+ size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
+ return ic
def gl_sel_cb(obj, event_info, data):
print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info))
diff --git a/examples/elementary/test_map.py b/examples/elementary/test_map.py
index 1ed3684..653a074 100644
--- a/examples/elementary/test_map.py
+++ b/examples/elementary/test_map.py
@@ -1,17 +1,20 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.check import Check
from efl.elementary.hoversel import Hoversel
-from efl.elementary.map import Map
+from efl.elementary.map import Map, ELM_MAP_SOURCE_TYPE_TILE
from efl.elementary.slider import Slider
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
def print_map_info(Map):
print("---Map info---")
@@ -44,130 +47,101 @@ def cb_slider_rot(sl, Map):
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)
+def cb_hovsel_selected(hov, item, Map, src_type):
+ Map.source_set(src_type, item.text)
hov.text = "Tiles: %s" % (item.text)
def map_clicked(obj):
- win = Window("map", elementary.ELM_WIN_BASIC)
- win.title = "Map test"
- win.autodel = True
+ win = StandardWindow("map", "Map test", autodel=True, size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- vbox = 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)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
vbox.show()
- map_obj = Map(win)
- map_obj.zoom = 2
- map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
# map_obj.callback_clicked_add(cb_map_clicked)
vbox.pack_end(map_obj)
map_obj.show()
# view
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
-
- bt = Button(win)
- bt.text = "Zoom +"
+
+ bt = Button(win, text="Zoom +")
bt.callback_clicked_add(cb_btn_zoom, map_obj, 1)
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "Zoom -"
+ bt = Button(win, text="Zoom -")
bt.callback_clicked_add(cb_btn_zoom, map_obj, -1)
hbox.pack_end(bt)
bt.show()
- sl = Slider(win)
- sl.text = "Rotation:"
- sl.min_max = (0, 360)
- sl.value = 0
- sl.indicator_format = "%3.0f"
+ sl = Slider(win, text="Rotation:", min_max=(0, 360), value=0,
+ indicator_format="%3.0f")
sl.callback_changed_add(cb_slider_rot, map_obj)
hbox.pack_end(sl)
sl.show()
- ho = Hoversel(win)
- ho.hover_parent_set(win)
- type = elementary.ELM_MAP_SOURCE_TYPE_TILE
- ho.text_set("Tiles: %s" % (map_obj.source_get(type)))
- for src in map_obj.sources_get(type):
+ src_type = ELM_MAP_SOURCE_TYPE_TILE
+
+ ho = Hoversel(win, hover_parent=win,
+ text="Tiles: %s" % (map_obj.source_get(src_type)))
+ for src in map_obj.sources_get(src_type):
ho.item_add(src)
- ho.callback_selected_add(cb_hovsel_selected, map_obj, type)
+ ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type)
hbox.pack_end(ho)
ho.show()
# show / bring in
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
-
- bt = Button(win)
- bt.text = "Show Sydney"
+
+ bt = Button(win, text="Show Sydney")
bt.callback_clicked_add(cb_btn_show, map_obj, 151.175274, -33.859126)
hbox.pack_end(bt)
bt.show()
-
- bt = Button(win)
- bt.text = "Show Paris"
+
+ bt = Button(win, text="Show Paris")
bt.callback_clicked_add(cb_btn_show, map_obj, 2.342913, 48.853701)
hbox.pack_end(bt)
bt.show()
-
- bt = Button(win)
- bt.text = "BringIn Sydney"
+
+ bt = Button(win, text="BringIn Sydney")
bt.callback_clicked_add(cb_btn_bringin, map_obj, 151.175274, -33.859126)
hbox.pack_end(bt)
bt.show()
-
- bt = Button(win)
- bt.text = "BringIn Paris"
+
+ bt = Button(win, text="BringIn Paris")
bt.callback_clicked_add(cb_btn_bringin, map_obj, 2.342913, 48.853701)
hbox.pack_end(bt)
bt.show()
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
# options
- ck = Check(win)
- ck.text = "wheel_disabled"
+ ck = Check(win, text="wheel_disabled")
ck.callback_changed_add(lambda bt: map_obj.wheel_disabled_set(bt.state))
hbox.pack_end(ck)
ck.show()
- ck = Check(win)
- ck.text = "paused"
+ ck = Check(win, text="paused")
ck.callback_changed_add(lambda bt: map_obj.paused_set(bt.state))
hbox.pack_end(ck)
ck.show()
print_map_info(map_obj)
- win.resize(600, 600)
win.show()
diff --git a/examples/elementary/test_map2.py b/examples/elementary/test_map2.py
index 32624ee..8a677d5 100644
--- a/examples/elementary/test_map2.py
+++ b/examples/elementary/test_map2.py
@@ -2,11 +2,11 @@
# encoding: utf-8
import random
+import os
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.check import Check
@@ -23,7 +23,7 @@ from efl.elementary.icon import Icon
# from efl.elementary.index import Index
# from efl.elementary.innerwindow import InnerWindow
# from efl.elementary.image import Image
-from efl.elementary.map import Map
+from efl.elementary.map import Map, MapOverlayClass, ELM_MAP_OVERLAY_TYPE_CLASS
# from efl.elementary.fileselector import Fileselector
# from efl.elementary.fileselector_button import FileselectorButton
# from efl.elementary.fileselector_entry import FileselectorEntry
@@ -36,38 +36,46 @@ from efl.elementary.map import Map
# from efl.elementary.table import Table
# from efl.elementary.flipselector import FlipSelector
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
-def cb_btn_clear_overlays(bt, Map):
- for ov in Map.overlays:
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
+def cb_btn_clear_overlays(bt, m):
+ for ov in m.overlays:
print(ov, ov.type)
- if (ov.type != elementary.ELM_MAP_OVERLAY_TYPE_CLASS):
+ if (ov.type != ELM_MAP_OVERLAY_TYPE_CLASS):
ov.delete()
-def cb_btn_ungroup_overlays(bt, Map):
- for ov in Map.overlays:
+def cb_btn_ungroup_overlays(bt, m):
+ for ov in m.overlays:
if isinstance(ov, MapOverlayClass):
print(ov)
# TODO ungroup instead
for ov2 in ov.members:
- ov.delete()
+ print("deleting ov")
+ ov2.delete()
-def cb_btn_show_overlays(bt, Map):
- Map.overlays_show(Map.overlays)
+def cb_btn_show_overlays(bt, m):
+ m.overlays_show(m.overlays)
-def cb_chk_overlays_hidden(ck, Map):
- for ov in Map.overlays:
+def cb_chk_overlays_hidden(ck, m):
+ for ov in m.overlays:
ov.hide = ck.state
-def cb_chk_overlays_paused(ck, Map):
- for ov in Map.overlays:
+def cb_chk_overlays_paused(ck, m):
+ for ov in m.overlays:
ov.paused = ck.state
-def cb_overlay_clicked(Map, ov):
+def cb_overlay_clicked(m, 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)
+def cb_ctx_overlay_add(li, item, m, lon, lat, min_zoom = 0, icon = None):
+ item.widget.dismiss()
+ ov = m.overlay_add(lon, lat)
if min_zoom > 0:
ov.displayed_zoom_min = min_zoom
if icon:
@@ -75,162 +83,140 @@ def cb_ctx_overlay_add(li, item, Map, lon, lat, min_zoom = 0, icon = None):
ov.callback_clicked_set(cb_overlay_clicked)
-def cb_ctx_overlay_add_custom(li, item, Map, lon, lat):
- item.widget_get().dismiss()
- cont = Icon(Map)
- cont.file_set("images/sky_01.jpg")
- cont.size_hint_min = (50, 50)
+def cb_ctx_overlay_add_custom(li, item, m, lon, lat):
+ item.widget.dismiss()
+ cont = Icon(m, file=os.path.join(img_path, "sky_01.jpg"),
+ size_hint_min=(50, 50))
cont.show()
- ov = Map.overlay_add(lon, lat)
+ ov = m.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)
+def cb_ctx_overlay_add_random_color(li, item, m, lon, lat):
+ item.widget.dismiss()
+ ov = m.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()
+def cb_ctx_overlay_grouped(li, item, m, lon, lat, sx, sy):
+ item.widget.dismiss()
+ cls = m.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)
+ (lon, lat) = m.canvas_to_region_convert(sx + x * 10, sy + y * 10)
+ ov = m.overlay_add(lon, lat)
cls.append(ov)
-def cb_ctx_overlay_bubble(li, item, Map, lon, lat):
- item.widget_get().dismiss()
+def cb_ctx_overlay_bubble(li, item, m, lon, lat):
+ item.widget.dismiss()
- ov = Map.overlay_add(lon, lat)
- bub = Map.overlay_bubble_add()
+ ov = m.overlay_add(lon, lat)
+ bub = m.overlay_bubble_add()
bub.follow(ov)
- lb = Label(Map)
- lb.text = "You can push contents here"
+ lb = Label(m, text="You can push contents here")
bub.content_append(lb)
lb.show()
- ic = Icon(Map)
- ic.file_set("images/sky_01.jpg")
- ic.size_hint_min = (50, 50)
+ ic = Icon(m, file=os.path.join(img_path, "sky_01.jpg"),
+ size_hint_min=(50, 50))
bub.content_append(ic)
ic.show()
- bt = Button(Map)
- bt.text = "clear me"
+ bt = Button(m, 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_line(li, item, m, lon, lat):
+ item.widget.dismiss()
+ line = m.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()
+def cb_ctx_overlay_polygon(li, item, m, lon, lat):
+ item.widget.dismiss()
+ poly = m.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_circle(li, item, m, lon, lat, radius):
+ item.widget.dismiss()
+ m.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 cb_ctx_overlay_scale(li, item, m, x, y):
+ item.widget.dismiss()
+ m.overlay_scale_add(x, y)
-def test(li, item, Map, lon, lat):
+def test(li, item, m, lon, lat):
print(li)
print(item)
- print(Map)
+ print(m)
# ctx.dismiss()
- ov = Map.overlay_add(lon, lat)
+ ov = m.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 = Ctxpopup(Map)
+def cb_map_clicked(m):
+ (x, y) = m.evas.pointer_canvas_xy_get()
+ (lon, lat) = m.canvas_to_region_convert(x, y)
+ cp = Ctxpopup(m)
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 = 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.item_append("Add Overlay here", None, cb_ctx_overlay_add, m, lon, lat)
+ ic = Icon(m, file=os.path.join(img_path, "logo.png"))
+ cp.item_append("Add Overlay with icon", None, cb_ctx_overlay_add, m, lon, lat, 0, ic)
+ cp.item_append("Add Overlay custom content", None, cb_ctx_overlay_add_custom, m, lon, lat)
+ cp.item_append("Add Overlay random color", None, cb_ctx_overlay_add_random_color, m, lon, lat)
+ cp.item_append("Add Overlay (min zoom 4)", None, cb_ctx_overlay_add, m, lon, lat, 4)
+ cp.item_append("Add 16 Grouped Overlays", None, cb_ctx_overlay_grouped, m, lon, lat, x, y)
+ cp.item_append("Add one with a bubble attached", None, cb_ctx_overlay_bubble, m, lon, lat)
+ cp.item_append("Add an Overlay Line", None, cb_ctx_overlay_line, m, lon, lat)
+ cp.item_append("Add an Overlay Polygon", None, cb_ctx_overlay_polygon, m, lon, lat)
+ cp.item_append("Add an Overlay Circle", None, cb_ctx_overlay_circle, m, lon, lat, 10)
+ cp.item_append("Add an Overlay Scale", None, cb_ctx_overlay_scale, m, x, y)
cp.move(x, y)
cp.show()
def map_overlays_clicked(obj):
- win = Window("map2", elementary.ELM_WIN_BASIC)
- win.title = "Map Overlay test"
- win.autodel = True
+ win = StandardWindow("map2", "Map Overlay test", autodel=True,
+ size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- vbox = 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)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
vbox.show()
- map_obj = Map(win)
- map_obj.zoom = 2
- map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
map_obj.callback_clicked_add(cb_map_clicked)
vbox.pack_end(map_obj)
map_obj.show()
# overlays
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
- ck = Check(win)
- ck.text = "overlays hidden"
+ ck = Check(win, text="overlays hidden")
ck.callback_changed_add(cb_chk_overlays_hidden, map_obj)
hbox.pack_end(ck)
ck.show()
- ck = Check(win)
- ck.text = "overlays paused"
+ ck = Check(win, text="overlays paused")
ck.callback_changed_add(cb_chk_overlays_paused, map_obj)
hbox.pack_end(ck)
ck.show()
- bt = Button(win)
- bt.text = "clear overlays"
+ bt = Button(win, text="clear overlays")
bt.callback_clicked_add(cb_btn_clear_overlays, map_obj)
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "ungroup (BROKEN)"
+ bt = Button(win, text="ungroup (BROKEN)")
bt.callback_clicked_add(cb_btn_ungroup_overlays, map_obj)
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "overlays_show()"
+ bt = Button(win, text="overlays_show()")
bt.callback_clicked_add(cb_btn_show_overlays, map_obj)
hbox.pack_end(bt)
bt.show()
diff --git a/examples/elementary/test_map3.py b/examples/elementary/test_map3.py
index f853b4c..1529510 100644
--- a/examples/elementary/test_map3.py
+++ b/examples/elementary/test_map3.py
@@ -1,154 +1,149 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.ctxpopup import Ctxpopup
from efl.elementary.entry import Entry
from efl.elementary.hoversel import Hoversel
from efl.elementary.label import Label
-from efl.elementary.map import Map
+from efl.elementary.map import Map, ELM_MAP_ROUTE_TYPE_MOTOCAR, \
+ ELM_MAP_ROUTE_METHOD_FASTEST, ELM_MAP_SOURCE_TYPE_ROUTE, \
+ ELM_MAP_SOURCE_TYPE_NAME
from efl.elementary.separator import Separator
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
_from = None
_to = None
-def cb_btn_goto(bt, Map):
- Map.zoom = 12
- Map.region_show(9.204, 45.446)
+def cb_btn_goto(bt, m):
+ m.zoom = 12
+ m.region_show(9.204, 45.446)
-def cb_ctx_set_from(ctx, item, Map, lon, lat):
+def cb_ctx_set_from(ctx, item, m, lon, lat):
global _from
ctx.dismiss()
if _from is None:
- _from = Map.overlay_add(lon, lat)
+ _from = m.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):
+def cb_ctx_set_to(ctx, item, m, lon, lat):
global _to
ctx.dismiss()
if _to is None:
- _to = Map.overlay_add(lon, lat)
+ _to = m.overlay_add(lon, lat)
_to.color = (0, 0, 150, 150)
else:
_to.region = (lon, lat)
-def cb_btn_calc_route(bt, Map):
+def cb_btn_calc_route(bt, m):
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)
+ m.route_add(ELM_MAP_ROUTE_TYPE_MOTOCAR,
+ ELM_MAP_ROUTE_METHOD_FASTEST,
+ flon, flat, tlon, tlat, cb_route)
- lb = Map.data["lb_distance"]
+ lb = m.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)
+def cb_btn_search_name(bt, m, en):
+ m.name_add(en.text, 0, 0, cb_search_name, en)
en.text = "searching..."
-def cb_search_name(Map, name, en):
+def cb_search_name(m, name, en):
global _from
en.text = name.address
(lon, lat) = name.region
- Map.zoom = 12
- Map.region_show(lon, lat)
+ m.zoom = 12
+ m.region_show(lon, lat)
if _from is None:
- _from = Map.overlay_add(lon, lat)
+ _from = m.overlay_add(lon, lat)
_from.color = (150, 0, 0, 150)
else:
_from.region = (lon, lat)
-def cb_btn_search_region(bt, Map, en):
+def cb_btn_search_region(bt, m, en):
if _from is None:
return
(lon, lat) = _from.region
- Map.name_add(None, lon, lat, cb_search_region, en)
+ m.name_add(None, lon, lat, cb_search_region, en)
en.text = "searching..."
-def cb_search_region(Map, name, en):
+def cb_search_region(m, name, en):
global _name
en.text = name.address
-def cb_route(Map, route):
+def cb_route(m, route):
nodes = route.node.count('\n')
- lb = Map.data["lb_distance"]
+ lb = m.data["lb_distance"]
lb.text = "distance: %.2f Km nodes:%d" % (route.distance, nodes)
- ov = Map.overlay_route_add(route)
+ ov = m.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:
+def cb_btn_clear_overlays(btn, m):
+ for ov in m.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 = Ctxpopup(Map)
+def cb_map_clicked(m):
+ (x, y) = m.evas.pointer_canvas_xy_get()
+ (lon, lat) = m.canvas_to_region_convert(x, y)
+ cp = Ctxpopup(m)
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.item_append("Set start point", None, cb_ctx_set_from, m, lon, lat)
+ cp.item_append("Set end point", None, cb_ctx_set_to, m, 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_map_load(m):
+ lb = m.data["lb_load_status"]
+ status = m.tile_load_status
+ lb.text = "tile_load_status: %d / %d" % (status[1], status[0])
-def cb_hovsel_selected(hov, item, Map, type, name):
- Map.source_set(type, item.text)
+def cb_hovsel_selected(hov, item, m, type, name):
+ m.source_set(type, item.text)
hov.text = "%s: %s" % (name, item.text)
def map_route_clicked(obj):
- win = Window("maproute", elementary.ELM_WIN_BASIC)
- win.title = "Map Route test"
- win.autodel = True
+ win = StandardWindow("maproute", "Map Route test", autodel=True,
+ size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- vbox = 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)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
vbox.show()
- map_obj = Map(win)
- map_obj.zoom = 2
- map_obj.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- map_obj.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
+ map_obj = Map(win, zoom=2, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
map_obj.callback_clicked_add(cb_map_clicked)
map_obj.callback_tile_load_add(cb_map_load)
map_obj.callback_tile_loaded_add(cb_map_load)
vbox.pack_end(map_obj)
map_obj.show()
- lb = Label(win)
- lb.text = "load_status: 0 / 0"
+ lb = Label(win, text="load_status: 0 / 0")
vbox.pack_end(lb)
lb.show()
map_obj.data["lb_load_status"] = lb
@@ -160,104 +155,85 @@ def map_route_clicked(obj):
map_obj.data["lb_distance"] = lb
# info
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
# route
- ho = Hoversel(win)
- ho.hover_parent_set(win)
- type = elementary.ELM_MAP_SOURCE_TYPE_ROUTE
- ho.text_set("Routes: %s" % (map_obj.source_get(type)))
- for src in map_obj.sources_get(type):
+ src_type = ELM_MAP_SOURCE_TYPE_ROUTE
+
+ ho = Hoversel(win, hover_parent=win,
+ text="Routes: %s" % (map_obj.source_get(src_type)))
+ for src in map_obj.sources_get(src_type):
ho.item_add(src)
- ho.callback_selected_add(cb_hovsel_selected, map_obj, type, "Routes")
+ ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Routes")
hbox.pack_end(ho)
ho.show()
sep = Separator(win)
sep.show()
hbox.pack_end(sep)
-
- bt = Button(win)
- bt.text = "GOTO"
+
+ bt = Button(win, text="GOTO")
bt.callback_clicked_add(cb_btn_goto, map_obj)
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "Calc Route !"
+ bt = Button(win, text="Calc Route !")
bt.callback_clicked_add(cb_btn_calc_route, map_obj)
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "clear route overlays"
+ bt = Button(win, text="clear route overlays")
bt.callback_clicked_add(cb_btn_clear_overlays, map_obj)
hbox.pack_end(bt)
bt.show()
# names
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
- ho = Hoversel(win)
- ho.hover_parent_set(win)
- type = elementary.ELM_MAP_SOURCE_TYPE_NAME
- ho.text_set("Names: %s" % (map_obj.source_get(type)))
- for src in map_obj.sources_get(type):
+ src_type = ELM_MAP_SOURCE_TYPE_NAME
+
+ ho = Hoversel(win, hover_parent=win,
+ text="Names: %s" % (map_obj.source_get(src_type)))
+ for src in map_obj.sources_get(src_type):
ho.item_add(src)
- ho.callback_selected_add(cb_hovsel_selected, map_obj, type, "Names")
+ ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Names")
hbox.pack_end(ho)
ho.show()
- en = Entry(win)
- en.scrollable = True
+ en = Entry(win, scrollable=True, text="type an address here",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
# 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 = Button(win)
- bt.text = "Search Address !"
+ bt = Button(win, text="Search Address !")
bt.callback_clicked_add(cb_btn_search_name, map_obj, en)
hbox.pack_end(bt)
bt.show()
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
vbox.pack_end(hbox)
hbox.show()
- en = Entry(win)
- en.scrollable = True
+ en = Entry(win, scrollable=True, disabled=True,
+ text="place the start point and press the button",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
# 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 = Button(win)
- bt.text = "Search start point Region"
+ bt = Button(win, text="Search start point Region")
bt.callback_clicked_add(cb_btn_search_region, map_obj, en)
hbox.pack_start(bt)
bt.show()
-
- win.resize(600, 600)
win.show()
diff --git a/examples/elementary/test_mapbuf.py b/examples/elementary/test_mapbuf.py
index 495796c..4577854 100644
--- a/examples/elementary/test_mapbuf.py
+++ b/examples/elementary/test_mapbuf.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, Rectangle
from efl import elementary
-from efl.elementary.window import Window
+from efl.elementary.window import Window, ELM_WIN_BASIC
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
@@ -11,9 +13,19 @@ from efl.elementary.check import Check
from efl.elementary.label import Label
from efl.elementary.icon import Icon
from efl.elementary.mapbuf import Mapbuf
-from efl.elementary.scroller import Scroller
+from efl.elementary.scroller import Scroller, ELM_SCROLLER_POLICY_OFF
from efl.elementary.table import Table
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+ALIGN_CENTER = 0.5, 0.5
+
+SCROLL_POLICY_OFF = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
names = [ "Hello", "World", "Spam", "Egg", "Ham", "Good", "Bad", "Milk",
"Smell", "Of", "Sky", "Gold", "Hole", "Pig", "And", "Calm"]
@@ -23,115 +35,96 @@ 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 = Window("mapbuf", elementary.ELM_WIN_BASIC)
- win.title_set("Mapbuf test")
- win.autodel_set(True)
+ win = Window("mapbuf", ELM_WIN_BASIC, title="Mapbuf test", autodel=True,
+ size=(480, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- bg.file = "images/sky_04.jpg"
+ bg = Background(win, file=os.path.join(img_path, "sky_04.jpg"),
+ size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
- vbox = 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)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
vbox.show()
# launcher
- sc = 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)
+ sc = Scroller(win, bounce=(True, False), policy=SCROLL_POLICY_OFF,
+ size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(sc)
- bx = Box(win)
- bx.horizontal = True
- bx.homogeneous = True
+ bx = Box(win, horizontal=True, homogeneous=True)
bx.show()
for k in range(8):
- tb = Table(win)
- tb.size_hint_align = (0.5, 0.5)
- tb.size_hint_weight = (0.0, 0.0)
+ tb = Table(win, size_hint_align=ALIGN_CENTER,
+ size_hint_weight=(0.0, 0.0))
tb.show()
- pad = evas.Rectangle(win.evas)
- pad.color = (255, 255, 0, 255)
+ pad = Rectangle(win.evas, 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.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
pad.show()
tb.pack(pad, 1, 0, 5, 1)
- pad = evas.Rectangle(win.evas)
- pad.color = (255, 255, 0, 255)
+ pad = Rectangle(win.evas, 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.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
pad.show()
tb.pack(pad, 1, 11, 5, 1)
- pad = evas.Rectangle(win.evas)
- pad.color = (255, 255, 0, 255)
+ pad = Rectangle(win.evas, 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.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
pad.show()
tb.pack(pad, 0, 1, 1, 10)
- pad = evas.Rectangle(win.evas)
- pad.color = (255, 255, 0, 255)
+ pad = Rectangle(win.evas, 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.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
pad.show()
tb.pack(pad, 6, 1, 1, 10)
- mb = Mapbuf(win)
+ mb = Mapbuf(win, content=tb)
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 = 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)
+ ic = Icon(win, scale=0.5,
+ file=os.path.join(img_path, "icon_%02d.png" % (n)),
+ resizable=(False, False), size_hint_weight=EXPAND_BOTH,
+ size_hint_align=ALIGN_CENTER)
tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
ic.show()
- lb = Label(win)
- lb.style = "marker"
- lb.text = names[m]
+ lb = Label(win, style="marker", text=names[m])
tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
lb.show()
@@ -143,51 +136,37 @@ def mapbuf_clicked(obj, item=None):
sc.show()
# controls
- hbox = 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)
+ hbox = Box(win, horizontal=True, homogeneous=True,
+ size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
vbox.pack_start(hbox)
hbox.show()
- ck = Check(win)
- ck.text = "Map"
- ck.state = False
+ ck = Check(win, text="Map", state=False)
ck.callback_changed_add(cb_ck_map)
hbox.pack_end(ck)
ck.show()
- ck = Check(win)
+ ck = Check(win, text="Alpha", state=True)
ck.callback_changed_add(cb_ck_alpha)
- ck.text = "Alpha"
- ck.state = True
hbox.pack_end(ck)
ck.show()
- ck = Check(win)
+ ck = Check(win, text="Smooth", state=True)
ck.callback_changed_add(cb_ck_smooth)
- ck.text = "Smooth"
- ck.state = True
hbox.pack_end(ck)
ck.show()
- ck = Check(win)
+ ck = Check(win, text="FS", state=False)
ck.callback_changed_add(cb_ck_fs, win)
- ck.text = "FS"
- ck.state = False
hbox.pack_end(ck)
ck.show()
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, text="Close", size_hint_align=FILL_BOTH,
+ size_hint_weight=EXPAND_HORIZ)
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()
diff --git a/examples/elementary/test_menu.py b/examples/elementary/test_menu.py
index b815973..38111c1 100644
--- a/examples/elementary/test_menu.py
+++ b/examples/elementary/test_menu.py
@@ -1,12 +1,12 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_CALLBACK_MOUSE_DOWN, Rectangle
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.menu import Menu
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
def menu_show(rect, evtinfo, menu):
(x,y) = evtinfo.position.canvas
@@ -63,34 +63,24 @@ def menu_populate_1(menu, item):
menu_populate_2(menu, item2)
def menu_clicked(obj):
- win = Window("menu", elementary.ELM_WIN_BASIC)
- win.title_set("Menu test")
- win.autodel_set(True)
+ win = StandardWindow("menu", "Menu test", autodel=True, size=(350, 200))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = 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())
+ rect = Rectangle(win.evas_get(), color=(0, 0, 0, 0))
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.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
rect.show()
menu = 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)
+ rect.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, menu_show, menu)
- win.resize(350, 200)
win.show()
diff --git a/examples/elementary/test_multibuttonentry.py b/examples/elementary/test_multibuttonentry.py
index 58a524e..ede1fdb 100644
--- a/examples/elementary/test_multibuttonentry.py
+++ b/examples/elementary/test_multibuttonentry.py
@@ -1,16 +1,21 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.entry import Entry
from efl.elementary.multibuttonentry import MultiButtonEntry
-from efl.elementary.scroller import Scroller
+from efl.elementary.scroller import Scroller, ELM_SCROLLER_POLICY_OFF, \
+ ELM_SCROLLER_POLICY_AUTO
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+SCROLL_POLICY_VERT = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO
counter = 0
@@ -57,129 +62,94 @@ def cb_print(btn, mbe):
print(i.text)
def multibuttonentry_clicked(obj, item=None):
- win = Window("multibuttonentry", elementary.ELM_WIN_BASIC)
- win.title_set("MultiButtonEntry test")
- win.autodel_set(True)
+ win = StandardWindow("multibuttonentry", "MultiButtonEntry test",
+ autodel=True, size=(320, 320))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- vbox = Box(win)
- vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.show()
- sc = 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 = MultiButtonEntry(win)
+ mbe = MultiButtonEntry(win, size_hint_align=FILL_BOTH,
+ size_hint_weight=EXPAND_BOTH, text="To: ")
mbe.callback_item_selected_add(cb_item_selected)
- 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()
+ sc = Scroller(win, bounce=(False, True), policy=SCROLL_POLICY_VERT,
+ size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH, content=mbe)
+ vbox.pack_end(sc)
+ sc.show()
+
print(mbe.entry)
- hbox = Box(win)
- hbox.horizontal = True
- hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
vbox.pack_end(hbox)
hbox.show()
- bt = 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 = Button(win, text="item_append", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_btn_item_append, mbe)
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="item_prepend", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_btn_item_prepend, mbe)
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="item_insert_after", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_btn_item_insert_after, mbe)
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="item_insert_before", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_btn_item_insert_before, mbe)
hbox.pack_end(bt)
bt.show()
- hbox = Box(win)
- hbox.horizontal = True
- hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
+ hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
vbox.pack_end(hbox)
hbox.show()
- bt = 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 = Button(win, text="delete selected item", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(lambda btn: mbe.selected_item.delete())
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="clear", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(lambda bt: mbe.clear())
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="clear2", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_btn_clear2, mbe)
hbox.pack_end(bt)
bt.show()
- bt = 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 = Button(win, text="toggle expand", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(lambda btn: mbe.expanded_set(not mbe.expanded_get()))
hbox.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "print"
- bt.size_hint_align = evas.EVAS_HINT_FILL, 0.0
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
+ bt = Button(win, text="print", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_print, mbe)
hbox.pack_end(bt)
bt.show()
mbe.focus = True
- win.resize(320, 320)
+
win.show()
diff --git a/examples/elementary/test_naviframe.py b/examples/elementary/test_naviframe.py
index 0d8b5b5..6a5d700 100644
--- a/examples/elementary/test_naviframe.py
+++ b/examples/elementary/test_naviframe.py
@@ -1,23 +1,22 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.icon import Icon
from efl.elementary.naviframe import Naviframe
from efl.elementary.photo import Photo
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
-def content_new(parent, img):
- photo = Photo(parent)
- photo.file_set(img)
- photo.fill_inside_set(True)
- photo.style_set("shadow")
- return photo
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def navi_pop(bt, nf):
nf.item_pop()
@@ -29,115 +28,107 @@ def title_visible(obj, item):
item.title_visible = not item.title_visible
def page2(bt, nf):
- ic = Icon(nf)
- ic.file_set("images/icon_right_arrow.png")
- bt = Button(nf)
+ ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))
+
+ bt = Button(nf, content=ic)
bt.callback_clicked_add(page3, nf)
- bt.content_set(ic)
- content = content_new(nf, "images/plant_01.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "plant_01.jpg"),
+ fill_inside=True, style="shadow")
+
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 = Button(nf)
+ bt = Button(nf, text="Prev")
bt.callback_clicked_add(navi_pop, nf)
- bt.text_set("Prev")
- bt2 = Button(nf)
+ bt2 = Button(nf, text="Next")
bt2.callback_clicked_add(page4, nf)
- bt2.text_set("Next")
- content = content_new(nf, "images/rock_01.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "rock_01.jpg"),
+ fill_inside=True, style="shadow")
+
item = nf.item_push("Page 3", bt, bt2, content, "basic")
- ic = Icon(nf)
- ic.file_set("images/logo_small.png")
+
+ ic = Icon(nf, file=os.path.join(img_path, "logo_small.png"))
item.part_content_set("icon", ic)
def page4(bt, nf):
- ic = Icon(nf)
- ic.file_set("images/icon_right_arrow.png")
- bt = Button(nf)
+ ic = Icon(nf, file=os.path.join(img_path, "icon_right_arrow.png"))
+ bt = Button(nf, content=ic)
bt.callback_clicked_add(page5, nf)
- bt.content_set(ic)
- content = content_new(nf, "images/rock_02.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "rock_02.jpg"),
+ fill_inside=True, style="shadow")
+
item = nf.item_push("Page 4", None, bt, content, "basic")
- ic = Icon(nf)
- ic.file_set("images/logo_small.png")
+ ic = Icon(nf, file=os.path.join(img_path, "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 = Button(nf)
+ bt = Button(nf, text="Page 4")
bt.callback_clicked_add(navi_pop, nf)
- bt.text_set("Page 4")
- bt2 = Button(nf)
+ bt2 = Button(nf, text="Page 6")
bt2.callback_clicked_add(page6, nf)
- bt2.text_set("Page 6")
- content = content_new(nf, "images/sky_01.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "sky_01.jpg"),
+ fill_inside=True, style="shadow")
+
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 = Button(nf)
+ bt = Button(nf, text="Page 5")
bt.callback_clicked_add(navi_pop, nf)
- bt.text_set("Page 5")
- bt2 = Button(nf)
+ bt2 = Button(nf, text="Page 7")
bt2.callback_clicked_add(page7, nf)
- bt2.text_set("Page 7")
- content = content_new(nf, "images/sky_03.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "sky_03.jpg"),
+ fill_inside=True, style="shadow")
+
item = nf.item_push("Page 6", bt, bt2, content, "overlap")
item.part_text_set("subtitle", "Overlap style!")
def page7(bt, nf):
- bt = Button(nf)
+ bt = Button(nf, text="Page 6")
bt.callback_clicked_add(navi_pop, nf)
- bt.text_set("Page 6")
- bt2 = Button(nf)
+ bt2 = Button(nf, text="Page 1")
bt2.callback_clicked_add(navi_promote, nf, nf.data["page1"])
- bt2.text_set("Page 1")
- content = content_new(nf, "images/sky_02.jpg");
+ content = Photo(nf, file=os.path.join(img_path, "sky_02.jpg"),
+ fill_inside=True, style="shadow")
+
item = nf.item_push("Page 7", bt, bt2, content, "overlap")
item.part_text_set("subtitle", "Overlap style!")
def naviframe_clicked(obj):
- win = Window("naviframe", elementary.ELM_WIN_BASIC)
- win.title_set("Naviframe test")
- win.autodel_set(True)
+ win = StandardWindow("naviframe", "Naviframe test", autodel=True,
+ size=(400, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = 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 = 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)
+ nf = Naviframe(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(nf)
nf.show()
- bt = Button(win)
+ bt = Button(win, text="Next")
bt.callback_clicked_add(page2, nf)
- bt.text_set("Next")
- content = content_new(nf, "images/logo.png")
+ content = Photo(nf, file=os.path.join(img_path, "logo.png"),
+ fill_inside=True, style="shadow")
+
item = nf.item_push("Page 1", None, bt, content, "basic")
nf.data["page1"] = item
- win.resize(400, 600)
win.show()
diff --git a/examples/elementary/test_notify.py b/examples/elementary/test_notify.py
index e7150e7..0ace966 100644
--- a/examples/elementary/test_notify.py
+++ b/examples/elementary/test_notify.py
@@ -1,115 +1,94 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.label import Label
-from efl.elementary.notify import Notify
+from efl.elementary.notify import Notify, ELM_NOTIFY_ORIENT_TOP, \
+ ELM_NOTIFY_ORIENT_CENTER, ELM_NOTIFY_ORIENT_BOTTOM, \
+ ELM_NOTIFY_ORIENT_LEFT, ELM_NOTIFY_ORIENT_RIGHT, \
+ ELM_NOTIFY_ORIENT_TOP_LEFT, ELM_NOTIFY_ORIENT_TOP_RIGHT, \
+ ELM_NOTIFY_ORIENT_BOTTOM_LEFT, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT
from efl.elementary.table import Table
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def notify_close(bt, notify):
notify.hide()
def notify_show(bt, win, orient):
- notify = Notify(win)
- notify.repeat_events_set(False)
- notify.timeout_set(5)
- notify.orient_set(orient)
-
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bx.horizontal_set(True)
+ notify = Notify(win, repeat_events=False, timeout=5, orient=orient)
+
+ bx = Box(win, size_hint_weight=EXPAND_BOTH, horizontal=True)
notify.content_set(bx)
bx.show()
- lb = Label(win)
- lb.text_set("Text notification")
+ lb = Label(win, text="Text notification")
bx.pack_end(lb)
lb.show()
- bt = Button(win)
- bt.text_set("Close")
+ bt = Button(win, text="Close")
bt.callback_clicked_add(notify_close, notify)
bx.pack_end(bt)
bt.show()
notify.show()
def notify_clicked(obj):
- win = 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)
+ win = StandardWindow("notify", "Notify test", autodel=True, size=(320, 320),
+ size_hint_min=(160, 160), size_hint_max=(320, 320))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- tb = Table(win)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
- bt = Button(win)
- bt.text_set("Top")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP)
+ bt = Button(win, text="Top")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP)
tb.pack(bt, 1, 0, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Center")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_CENTER)
+ bt = Button(win, text="Center")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_CENTER)
tb.pack(bt, 1, 1, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Bottom")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM)
+ bt = Button(win, text="Bottom")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM)
tb.pack(bt, 1, 2, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Left")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_LEFT)
+ bt = Button(win, text="Left")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_LEFT)
tb.pack(bt, 0, 1, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Top Left")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_LEFT)
+ bt = Button(win, text="Top Left")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP_LEFT)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Bottom Left")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
+ bt = Button(win, text="Bottom Left")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM_LEFT)
tb.pack(bt, 0, 2, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Right")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_RIGHT)
+ bt = Button(win, text="Right")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_RIGHT)
tb.pack(bt, 2, 1, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Top Right")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_TOP_RIGHT)
+ bt = Button(win, text="Top Right")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_TOP_RIGHT)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
- bt = Button(win)
- bt.text_set("Bottom Right")
- bt.callback_clicked_add(notify_show, win, elementary.ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
+ bt = Button(win, text="Bottom Right")
+ bt.callback_clicked_add(notify_show, win, ELM_NOTIFY_ORIENT_BOTTOM_RIGHT)
tb.pack(bt, 2, 2, 1, 1)
bt.show()
diff --git a/examples/elementary/test_panel.py b/examples/elementary/test_panel.py
index 970f725..1fa19b3 100644
--- a/examples/elementary/test_panel.py
+++ b/examples/elementary/test_panel.py
@@ -1,49 +1,37 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
-from efl.elementary.panel import Panel
+from efl.elementary.panel import Panel, ELM_PANEL_ORIENT_LEFT
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_VERT = 0.0, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_VERT_ALIGN_LEFT = 0.0, EVAS_HINT_FILL
def panel_clicked(obj):
- win = Window("panel", elementary.ELM_WIN_BASIC)
- win.title_set("Panel test")
- win.autodel_set(True)
+ win = StandardWindow("panel", "Panel test", autodel=True, size=(300, 300))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
bx.show()
- panel = 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 = 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 = Button(win, text="HIDE ME :)", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
bt.show()
- panel.content_set(bt)
+ panel = Panel(win, orient=ELM_PANEL_ORIENT_LEFT, content=bt,
+ size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT_ALIGN_LEFT)
bx.pack_end(panel)
panel.show()
- win.resize(300, 300)
win.show()
diff --git a/examples/elementary/test_panes.py b/examples/elementary/test_panes.py
index f3edb6c..accc3be 100644
--- a/examples/elementary/test_panes.py
+++ b/examples/elementary/test_panes.py
@@ -1,63 +1,49 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.button import Button
from efl.elementary.panes import Panes
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def cb_panes(panes, event):
print(("Event: %s" % (event)))
def panes_clicked(obj):
- win = Window("panes", elementary.ELM_WIN_BASIC)
- win.title_set("Panes test")
- win.autodel_set(True)
+ win = StandardWindow("panes", "Panes test", autodel=True, size=(320, 480))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- panes = Panes(win)
+ panes = Panes(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
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 = Button(win)
- bt.text = "Left"
+ bt = Button(win, text="Left")
panes.part_content_set("left", bt)
bt.show()
- panes_h = Panes(win)
+ panes_h = Panes(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
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 = Button(win)
- bt.text = "Up"
+ bt = Button(win, text="Up")
panes_h.part_content_set("left", bt)
bt.show()
- bt = Button(win)
- bt.text = "Down"
+ bt = Button(win, text="Down")
panes_h.part_content_set("right", bt)
bt.show()
-
- win.resize(320, 480)
win.show()
diff --git a/examples/elementary/test_photo.py b/examples/elementary/test_photo.py
index a5839bc..f1b2c1a 100644
--- a/examples/elementary/test_photo.py
+++ b/examples/elementary/test_photo.py
@@ -1,14 +1,22 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.photo import Photo
from efl.elementary.scroller import Scroller
from efl.elementary.table import Table
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
images = ["panel_01.jpg",
"mystrale.jpg",
@@ -21,53 +29,38 @@ images = ["panel_01.jpg",
"wood_01.jpg"]
def photo_clicked(obj):
- win = Window("photo", elementary.ELM_WIN_BASIC)
- win.title_set("Photo test")
- win.autodel_set(True)
+ win = StandardWindow("photo", "Photo test", autodel=True, size=(300, 300))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- sc = 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 = Table(win)
- tb.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- sc.content = tb
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
tb.show()
+ sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
+ win.resize_object_add(sc)
+ sc.show()
+
n = 0
for j in range(12):
for i in range(12):
- ph = Photo(win)
- name = "images/%s" % (images[n])
+ ph = Photo(win, aspect_fixed=False, size=80, editable=True,
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
+ name = os.path.join(img_path, 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()
diff --git a/examples/elementary/test_photocam.py b/examples/elementary/test_photocam.py
index f724009..0dc0f5f 100644
--- a/examples/elementary/test_photocam.py
+++ b/examples/elementary/test_photocam.py
@@ -1,30 +1,33 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
-from efl.elementary.photocam import Photocam
+from efl.elementary.photocam import Photocam, ELM_PHOTOCAM_ZOOM_MODE_MANUAL, \
+ ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL
from efl.elementary.progressbar import Progressbar
from efl.elementary.separator import Separator
from efl.elementary.table import Table
from efl.elementary.fileselector_button import FileselectorButton
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
remote_url = "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x10800.jpg"
def _cb_zoom_in(bt, pc):
- pc.zoom_mode = elementary.ELM_PHOTOCAM_ZOOM_MODE_MANUAL
+ pc.zoom_mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL
zoom = pc.zoom - 0.5
if zoom >= (1.0 / 32.0):
pc.zoom = zoom
def _cb_zoom_out(bt, pc):
- pc.zoom_mode = elementary.ELM_PHOTOCAM_ZOOM_MODE_MANUAL
+ pc.zoom_mode = ELM_PHOTOCAM_ZOOM_MODE_MANUAL
zoom = pc.zoom + 0.5
if zoom <= 256.0:
pc.zoom = zoom
@@ -51,71 +54,57 @@ def _cb_pc_download_error(im, info, pb):
def photocam_clicked(obj):
- win = StandardWindow("photocam", "Photocam test")
- win.autodel_set(True)
+ win = StandardWindow("photocam", "Photocam test", autodel=True,
+ size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
# Photocam widget
- pc = Photocam(win)
- pc.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ pc = Photocam(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(pc)
pc.show()
# table for buttons
- tb = Table(win);
- tb.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
# zoom out btn
- bt = Button(win)
- bt.text = "Z -"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.1, 0.1
+ bt = Button(win, text="Z -", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.1, 0.1))
bt.callback_clicked_add(_cb_zoom_out, pc)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
# select file btn
- bt = FileselectorButton(win)
- bt.text = "Select Photo File"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.5, 0.1
+ bt = FileselectorButton(win, text="Select Photo File",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
bt.callback_file_chosen_add(lambda fs, path: pc.file_set(path))
tb.pack(bt, 1, 0, 1, 1)
bt.show()
# zoom in btn
- bt = Button(win)
- bt.text = "Z +"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.9, 0.1
+ bt = Button(win, text="Z +", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.9, 0.1))
bt.callback_clicked_add(_cb_zoom_in, pc)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
# progressbar for remote loading
- pb = Progressbar(win)
- pb.unit_format = "loading %.2f %%"
- pb.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- pb.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
+ pb = Progressbar(win, unit_format="loading %.2f %%",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
tb.pack(pb, 1, 1, 1, 1)
# Fit btn
- bt = Button(win);
- bt.text = "Fit"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.1, 0.9
+ bt = Button(win, text="Fit", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.1, 0.9))
bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT))
tb.pack(bt, 0, 2, 1, 1)
bt.show()
# load remote url
- bt = Button(win)
- bt.text = "Load remote URL (27MB)"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.5, 0.9
+ bt = Button(win, text="Load remote URL (27MB)",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.9))
bt.callback_clicked_add(lambda b: pc.file_set(remote_url))
tb.pack(bt, 1, 2, 1, 1)
bt.show()
@@ -126,16 +115,13 @@ def photocam_clicked(obj):
pc.callback_download_error_add(_cb_pc_download_error, pb)
# Fill btn
- bt = Button(win);
- bt.text = "Fill"
- bt.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- bt.size_hint_align = 0.9, 0.9
+ bt = Button(win, text="Fill", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.9, 0.9))
bt.callback_clicked_add(lambda b: pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL))
tb.pack(bt, 2, 2, 1, 1)
bt.show()
# show the win
- win.resize(600, 600)
win.show()
diff --git a/examples/elementary/test_popup.py b/examples/elementary/test_popup.py
index dd5c69c..718f255 100644
--- a/examples/elementary/test_popup.py
+++ b/examples/elementary/test_popup.py
@@ -1,15 +1,21 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, FilledImage
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.button import Button
-from efl.elementary.list import List
+from efl.elementary.list import List, ELM_LIST_LIMIT
from efl.elementary.icon import Icon
-from efl.elementary.popup import Popup
+from efl.elementary.popup import Popup, ELM_WRAP_CHAR
+
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def cb_bnt_close(btn, popup):
if "im" in popup.data:
@@ -18,7 +24,7 @@ def cb_bnt_close(btn, popup):
def cb_btn_restack(btn, popup):
im = evas.FilledImage(popup.evas);
- im.file = "images/mystrale_2.jpg"
+ im.file = os.path.join(img_path, "mystrale_2.jpg")
im.move(40, 40)
im.resize(500, 320)
im.show()
@@ -27,38 +33,31 @@ def cb_btn_restack(btn, popup):
popup.raise_()
def cb_popup_center_text(li, item, win):
- popup = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH, timeout=3.0)
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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH)
popup.text = "This Popup has content area and " \
"action area set, action area has one button Close"
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, 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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH)
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 = Button(win)
- bt.text = "Close"
+ bt = Button(win, 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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH)
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")
@@ -66,102 +65,81 @@ def cb_popup_center_title_text_block_clicked_event(li, item, win):
popup.show()
def cb_popup_bottom_title_text_3button(li, item, win):
- popup = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH,
+ content_text_wrap_type=ELM_WRAP_CHAR)
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 = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
popup.part_content_set("title,icon", ic)
- bt = Button(win)
- bt.text = "OK"
+ bt = Button(win, text="OK")
popup.part_content_set("button1", bt)
- bt = Button(win)
- bt.text = "Cancel"
+ bt = Button(win, text="Cancel")
popup.part_content_set("button2", bt)
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, 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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
+ bt = Button(win, text="Content", content=ic)
+
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH, content=bt)
popup.part_text_set("title,text", "Title")
-
- ic = Icon(win)
- ic.file = "images/logo_small.png"
- bt = Button(win)
- bt.text = "Content"
- bt.content = ic
- popup.content = bt
-
- bt = Button(win)
- bt.text = "OK"
+
+ bt = Button(win, text="OK")
popup.part_content_set("button1", bt)
- bt = Button(win)
- bt.text = "Cancel"
+ bt = Button(win, text="Cancel")
popup.part_content_set("button2", bt)
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, 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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH)
popup.part_text_set("title,text", "Title")
for i in range(1, 11):
if i in [3, 5, 6]:
- ic = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
popup.item_append("item"+str(i), ic)
else:
- popup.item_append("item"+str(i))
+ popup.item_append("item"+str(i), None)
- bt = Button(win)
- bt.text = "OK"
+ bt = Button(win, text="OK")
popup.part_content_set("button1", bt)
- bt = Button(win)
- bt.text = "Cancel"
+ bt = Button(win, text="Cancel")
popup.part_content_set("button2", bt)
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, 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 = Popup(win)
- popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ popup = Popup(win, size_hint_weight=EXPAND_BOTH)
popup.text = "When you click the 'Restack' button, " \
"an image will be located under this popup"
popup.part_text_set("title,text", "Title")
- bt = Button(win)
- bt.text = "Restack"
+ bt = Button(win, text="Restack")
bt.callback_clicked_add(cb_btn_restack, popup)
popup.part_content_set("button1", bt)
- bt = Button(win)
- bt.text = "Close"
+ bt = Button(win, text="Close")
bt.callback_clicked_add(cb_bnt_close, popup)
popup.part_content_set("button3", bt)
@@ -180,13 +158,11 @@ def cb_popup_center_text_1button_hide_show(li, item, win):
g_popup.show()
return
- g_popup = Popup(win)
- g_popup.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ g_popup = Popup(win, size_hint_weight=EXPAND_BOTH)
g_popup.text = "Hide this popup by using the button." \
"When you click list item again, you will see this popup again."
- bt = Button(win)
- bt.text = "Hide"
+ bt = Button(win, text="Hide")
bt.callback_clicked_add(lambda b: g_popup.hide())
g_popup.part_content_set("button1", bt)
@@ -194,20 +170,11 @@ def cb_popup_center_text_1button_hide_show(li, item, win):
def popup_clicked(obj):
- win = Window("popup", elementary.ELM_WIN_BASIC)
- win.title_set("Popup test")
- win.autodel_set(True)
+ win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- li = List(win)
- li.mode = elementary.ELM_LIST_LIMIT
- li.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ li = List(win, mode=ELM_LIST_LIMIT, size_hint_weight=EXPAND_BOTH)
li.callback_selected_add(lambda li, it: it.selected_set(False))
win.resize_object_add(li)
li.show()
@@ -232,7 +199,7 @@ def popup_clicked(obj):
cb_popup_center_text_1button_hide_show, win)
li.go()
- win.resize(480, 800)
+
win.show()
diff --git a/examples/elementary/test_progressbar.py b/examples/elementary/test_progressbar.py
index d5f4028..50d0999 100644
--- a/examples/elementary/test_progressbar.py
+++ b/examples/elementary/test_progressbar.py
@@ -1,16 +1,25 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
-from efl import ecore
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EVAS_ASPECT_CONTROL_VERTICAL, EVAS_ASPECT_CONTROL_HORIZONTAL, FilledImage
+from efl.ecore import Timer, ECORE_CALLBACK_RENEW, ECORE_CALLBACK_CANCEL
from efl import elementary
from efl.elementary.window import StandardWindow
-from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.icon import Icon
from efl.elementary.progressbar import Progressbar
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
my_progressbar_run = False
my_progressbar_timer = None
@@ -25,13 +34,13 @@ def pb_timer_cb(pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8):
pb4.value_set(progress)
pb3.value_set(progress)
pb6.value_set(progress)
- pb8.part_value_set("elm.cur.progressbar", progress * 1.50)
- pb8.part_value_set("elm.cur.progressbar1", progress)
+ pb8.part_value_set("elm.cur.progressbar", progress)
+ pb8.part_value_set("elm.cur.progressbar1", progress * 1.50)
if progress < 1.0:
- return ecore.ECORE_CALLBACK_RENEW
+ return ECORE_CALLBACK_RENEW
global my_progressbar_run
my_progressbar_run = False
- return ecore.ECORE_CALLBACK_CANCEL
+ return ECORE_CALLBACK_CANCEL
def begin_test(obj, *args, **kwargs):
(pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8) = args
@@ -41,8 +50,7 @@ def begin_test(obj, *args, **kwargs):
global my_progressbar_run
global my_progressbar_timer
if not my_progressbar_run:
- my_progressbar_timer = ecore.timer_add(0.1, pb_timer_cb,
- *args)
+ my_progressbar_timer = Timer(0.1, pb_timer_cb, *args)
my_progressbar_run = True
def end_test(obj, pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8):
@@ -64,118 +72,78 @@ def progressbar_clicked(obj):
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bx = Box(win)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
- bx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
bx.show()
- pb1 = Progressbar(win)
- pb1.span_size = 300
- pb1.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- pb1.size_hint_align = evas.EVAS_HINT_FILL, 0.5
+ pb1 = Progressbar(win, span_size=300, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(pb1)
pb1.show()
- pb2 = Progressbar(win)
- pb2.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- pb2.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb2.text = "Infinite bounce"
- pb2.pulse_mode = True
+ pb2 = Progressbar(win, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ, text="Infinite bounce", pulse_mode=True)
bx.pack_end(pb2)
pb2.show()
- ic1 = Icon(win)
- ic1.file = 'images/logo_small.png'
- ic1.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
-
- pb3 = Progressbar(win)
- pb3.text = "Inverted"
- pb3.content = ic1
- pb3.inverted = True
- pb3.unit_format = "%1.1f units"
- pb3.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb3.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ ic1 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
+
+ pb3 = Progressbar(win, text="Inverted", content=ic1, inverted=True,
+ unit_format="%1.1f units", size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_BOTH)
bx.pack_end(pb3)
ic1.show()
pb3.show()
- pb8 = Progressbar(win)
- pb8.style = "recording"
- pb8.text = "Style: recording"
- pb8.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb8.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ pb8 = Progressbar(win, style="double", text="Style: double",
+ size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_BOTH)
bx.pack_end(pb8)
pb8.show()
- hbx = Box(win)
- hbx.horizontal = True
- hbx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- hbx.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
+ hbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
bx.pack_end(hbx)
hbx.show()
- pb4 = Progressbar(win)
- pb4.horizontal = False
- pb4.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
- pb4.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ pb4 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH, span_size=60, text="Vertical")
hbx.pack_end(pb4)
- pb4.span_size = 60
- pb4.text = "Vertical"
pb4.show()
- pb5 = Progressbar(win)
- pb5.horizontal = False
- pb5.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb5.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
- pb5.span_size = 120
- pb5.pulse_mode = True
- pb5.unit_format = None
- pb5.text = "Infinite bounce"
+ pb5 = Progressbar(win, horizontal=False, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ, span_size=120, pulse_mode=True,
+ unit_format=None, text="Infinite bounce")
hbx.pack_end(pb5)
pb5.show()
- ic2 = Icon(win)
- ic2.file = 'images/logo_small.png'
- ic2.size_hint_aspect = evas.EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1
-
- pb6 = Progressbar(win)
- pb6.horizontal = False
- pb6.text = "Inverted"
- pb6.content = ic2
- pb6.inverted = True
- pb6.unit_format = "%1.2f%%"
- pb6.span_size = 200
- pb6.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb6.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ ic2 = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ size_hint_aspect=(EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1))
+
+ pb6 = Progressbar(win, horizontal=False, text="Inverted", content=ic2,
+ inverted=True, unit_format="%1.2f%%", span_size=200,
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
hbx.pack_end(pb6)
ic2.show()
pb6.show()
- pb7 = Progressbar(win)
- pb7.style = "wheel"
- pb7.text = "Style: wheel"
- pb7.pulse_mode = True
- pb7.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- pb7.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ pb7 = Progressbar(win, style="wheel", text="Style: wheel", pulse_mode=True,
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
bx.pack_end(pb7)
pb7.show()
- bt_bx = Box(win)
- bt_bx.horizontal = True
- bt_bx.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ bt_bx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
bx.pack_end(bt_bx)
bt_bx.show()
pbt = (pb1, pb2, pb3, pb4, pb5, pb6, pb7, pb8)
- bt = Button(win)
- bt.text = "Start"
+ bt = Button(win, text="Start")
bt.callback_clicked_add(begin_test, *pbt)
bt_bx.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "Stop"
+ bt = Button(win, text="Stop")
bt.callback_clicked_add(end_test, *pbt)
bt_bx.pack_end(bt)
bt.show()
diff --git a/examples/elementary/test_radio.py b/examples/elementary/test_radio.py
index fd3d050..a396b45 100644
--- a/examples/elementary/test_radio.py
+++ b/examples/elementary/test_radio.py
@@ -1,97 +1,76 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EVAS_ASPECT_CONTROL_VERTICAL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.icon import Icon
from efl.elementary.radio import Radio
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def radio_clicked(obj):
- win = Window("radio", elementary.ELM_WIN_BASIC)
- win.title_set("Radio test")
- win.autodel_set(True)
+ win = StandardWindow("radio", "Radio test", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
bx.show()
- ic = Icon(win)
- ic.file_set('images/logo_small.png')
- ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
- rd = 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)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
+ rd = Radio(win, state_value=0, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ, text="Icon sized to radio", content=ic)
bx.pack_end(rd)
rd.show()
ic.show()
rdg = rd
- ic = Icon(win)
- ic.file_set('images/logo_small.png')
- ic.resizable_set(0, 0)
- rd = Radio(win)
- rd.state_value_set(1)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False))
+ rd = Radio(win, state_value=1, text="Icon no scale", content=ic)
rd.group_add(rdg)
- rd.text_set("Icon no scale")
- rd.content_set(ic)
bx.pack_end(rd)
rd.show()
ic.show()
- rd = Radio(win)
- rd.state_value_set(2)
+ rd = Radio(win, state_value=2, text="Label Only")
rd.group_add(rdg)
- rd.text_set("Label Only")
bx.pack_end(rd)
rd.show()
- rd = Radio(win)
- rd.state_value_set(3)
+ rd = Radio(win, state_value=3, text="Disabled", disabled=True)
rd.group_add(rdg)
- rd.text_set("Disabled")
- rd.disabled_set(True)
bx.pack_end(rd)
rd.show()
- ic = Icon(win)
- ic.file_set('images/logo_small.png')
- ic.resizable_set(0, 0)
- rd = Radio(win)
- rd.state_value_set(4)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False))
+ rd = Radio(win, state_value=4, content=ic)
rd.group_add(rdg)
- rd.content_set(ic)
bx.pack_end(rd)
rd.show()
ic.show()
- ic = Icon(win)
- ic.file_set('images/logo_small.png')
- ic.resizable_set(0, 0)
- rd = Radio(win)
- rd.state_value_set(5)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False))
+ rd = Radio(win, state_value=5, content=ic, disabled=True)
rd.group_add(rdg)
- rd.content_set(ic)
- rd.disabled_set(True)
bx.pack_end(rd)
rd.show()
ic.show()
- rdg.value_set(2)
+ rdg.value = 2
win.show()
diff --git a/examples/elementary/test_scroller.py b/examples/elementary/test_scroller.py
index 933b277..53c0bf6 100644
--- a/examples/elementary/test_scroller.py
+++ b/examples/elementary/test_scroller.py
@@ -1,14 +1,23 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
+from efl.elementary.window import StandardWindow
from efl.elementary.background import Background
from efl.elementary.button import Button
from efl.elementary.scroller import Scroller
from efl.elementary.table import Table
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def my_scroller_go_300_300(bt, sc):
sc.region_bring_in(300, 300, 318, 318)
@@ -23,56 +32,46 @@ 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))
+ print("Border callback: " + border)
def cb_drags(obj, action):
- print(("Drag callback:", action))
+ print("Drag callback: " + action)
def cb_anims(obj, action):
- print(("Anim callback:", action))
+ print("Anim callback: " + action)
def scroller_clicked(obj):
- win = Window("scroller", elementary.ELM_WIN_BASIC)
- win.title_set("Scroller")
- win.autodel_set(True)
+ win = StandardWindow("scroller", "Scroller", autodel=True, size=(320, 320))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- tb = Table(win)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
- 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"]
+ img = ["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"]
n = 0
for j in range(12):
for i in range(12):
- bg2 = Background(win)
- bg2.file_set(img[n])
+ bg2 = Background(win, file=os.path.join(img_path, img[n]),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
+ size_hint_min=(318, 318))
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 = Scroller(win)
- sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb,
+ page_relative=(1.0, 1.0))
sc.callback_edge_top_add(cb_edges, "top")
sc.callback_edge_bottom_add(cb_edges, "bottom")
sc.callback_edge_left_add(cb_edges, "left")
@@ -83,51 +82,39 @@ def scroller_clicked(obj):
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 = Table(win)
- tb2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb2 = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb2)
- bt = Button(win)
- bt.text_set("to 300 300")
+ bt = Button(win, text="to 300 300", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.1, 0.1))
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 = Button(win)
- bt.text_set("to 900 300")
+ bt = Button(win, text="to 900 300", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.9, 0.1))
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 = Button(win)
- bt.text_set("to 300 900")
+ bt = Button(win, text="to 300 900", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.1, 0.9))
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 = Button(win)
- bt.text_set("to 900 900")
+ bt = Button(win, text="to 900 900", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.9, 0.9))
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()
diff --git a/examples/elementary/test_segment_control.py b/examples/elementary/test_segment_control.py
index 51b247f..9fb109f 100644
--- a/examples/elementary/test_segment_control.py
+++ b/examples/elementary/test_segment_control.py
@@ -1,110 +1,98 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.icon import Icon
from efl.elementary.segment_control import SegmentControl
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def cb_seg_changed(seg, item):
print(seg)
print(item)
def segment_control_clicked(obj):
- win = Window("segment-control", elementary.ELM_WIN_BASIC)
- win.title_set("Segment Control test")
- win.autodel_set(True)
+ win = StandardWindow("segment-control", "Segment Control test",
+ autodel=True, size=(320, 280))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- vbox = 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)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
vbox.show()
# segment 1
- seg = 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 = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
seg.item_add(None, "Only Text")
- ic = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
it = seg.item_add(ic)
ic = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "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)
+ it.selected = True
vbox.pack_end(seg)
seg.show()
# segment 2
- seg = 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 = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
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)
+ it.selected = True
vbox.pack_end(seg)
seg.show()
# segment 3
- seg = SegmentControl(win)
- seg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- seg.size_hint_align = (0.5, 0.5)
+ seg = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=(0.5, 0.5))
for i in range(3):
- ic = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
if i == 1:
it = seg.item_add(ic)
else:
seg.item_add(ic)
- # it.selected_set(True)
+ it.selected = True
vbox.pack_end(seg)
seg.show()
# segment 4
- seg = 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 = SegmentControl(win, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ, disabled=True)
seg.item_add(None, "Disabled")
- ic = Icon(win)
- ic.file = "images/logo_small.png"
- seg.item_add(ic, "Disabled")
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
+ it = seg.item_add(ic, "Disabled")
- ic = Icon(win)
- ic.file = "images/logo_small.png"
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
seg.item_add(ic)
- seg.disabled = True
- # it.selected_set(True)
+ it.selected = True
+
vbox.pack_end(seg)
seg.show()
-
- win.resize(320, 280)
win.show()
diff --git a/examples/elementary/test_separator.py b/examples/elementary/test_separator.py
index f505868..ada3119 100644
--- a/examples/elementary/test_separator.py
+++ b/examples/elementary/test_separator.py
@@ -1,88 +1,37 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
-# from efl.elementary.check import Check
-# from efl.elementary.ctxpopup import Ctxpopup
-# from efl.elementary.entry import Entry
-# from efl.elementary.frame import Frame
-# from efl.elementary.flip import Flip
-# from efl.elementary.gengrid import Gengrid, GengridItemClass
-# from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass
-# from efl.elementary.grid import Grid
-# from efl.elementary.hover import Hover
-# from efl.elementary.hoversel import Hoversel
-# from efl.elementary.label import Label
-# from efl.elementary.layout import Layout
-# from efl.elementary.list import List
-# from efl.elementary.icon import Icon
-# from efl.elementary.index import Index
-# from efl.elementary.innerwindow import InnerWindow
-# from efl.elementary.image import Image
-# from efl.elementary.map import Map
-# from efl.elementary.mapbuf import Mapbuf
-# from efl.elementary.menu import Menu
-# from efl.elementary.multibuttonentry import MultiButtonEntry
-# from efl.elementary.naviframe import Naviframe
-# from efl.elementary.notify import Notify
-# from efl.elementary.fileselector import Fileselector
-# from efl.elementary.fileselector_button import FileselectorButton
-# from efl.elementary.fileselector_entry import FileselectorEntry
-# from efl.elementary.panel import Panel
-# from efl.elementary.panes import Panes
-# from efl.elementary.photo import Photo
-# from efl.elementary.popup import Popup
-# from efl.elementary.progressbar import Progressbar
-# from efl.elementary.radio import Radio
-# from efl.elementary.scroller import Scroller
-# from efl.elementary.segment_control import SegmentControl
from efl.elementary.separator import Separator
-# from efl.elementary.slider import Slider
-# from efl.elementary.table import Table
-# from efl.elementary.flipselector import FlipSelector
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
def separator_clicked(obj):
- win = Window("separators", elementary.ELM_WIN_BASIC)
- win.title_set("Separators")
- win.autodel_set(True)
+ win = StandardWindow("separators", "Separators", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- bx0 = Box(win)
- bx0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bx0.horizontal_set(True)
+ bx0 = Box(win, size_hint_weight=EXPAND_BOTH, horizontal=True)
win.resize_object_add(bx0)
bx0.show()
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
bx0.pack_end(bx)
bx.show()
- bt = Button(win)
- bt.text_set("Left upper corner")
+ bt = Button(win, text="Left upper corner")
bx.pack_end(bt)
bt.show()
- sp = Separator(win)
- sp.horizontal_set(True)
+ sp = Separator(win, horizontal=True)
bx.pack_end(sp)
sp.show()
- bt = Button(win)
- bt.text_set("Left lower corner")
- bt.disabled_set(True)
+ bt = Button(win, text="Left lower corner", disabled=True)
bx.pack_end(bt)
bt.show()
@@ -90,24 +39,19 @@ def separator_clicked(obj):
bx0.pack_end(sp)
sp.show()
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
bx0.pack_end(bx)
bx.show()
- bt = Button(win)
- bt.text_set("Right upper corner")
- bt.disabled_set(True)
+ bt = Button(win, text="Right upper corner", disabled=True)
bx.pack_end(bt)
bt.show()
- sp = Separator(win)
- sp.horizontal_set(True)
+ sp = Separator(win, horizontal=True)
bx.pack_end(sp)
sp.show()
- bt = Button(win)
- bt.text_set("Right lower corner")
+ bt = Button(win, text="Right lower corner")
bx.pack_end(bt)
bt.show()
diff --git a/examples/elementary/test_slideshow.py b/examples/elementary/test_slideshow.py
index 4c2a76d..6a4cdfa 100644
--- a/examples/elementary/test_slideshow.py
+++ b/examples/elementary/test_slideshow.py
@@ -1,28 +1,40 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_CALLBACK_MOUSE_IN, \
+ EVAS_CALLBACK_MOUSE_OUT, EVAS_CALLBACK_MOUSE_UP, EVAS_CALLBACK_MOUSE_MOVE
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.hoversel import Hoversel
-from efl.elementary.notify import Notify
+from efl.elementary.notify import Notify, ELM_NOTIFY_ORIENT_BOTTOM
from efl.elementary.photo import Photo
from efl.elementary.spinner import Spinner
from efl.elementary.slideshow import Slideshow, SlideshowItemClass
-
-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"
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
+
+images = [
+ "logo.png",
+ "plant_01.jpg",
+ "rock_01.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg",
+ "mystrale.jpg",
+ "mystrale_2.jpg"
+]
def notify_show(no, event, *args, **kwargs):
no = args[0]
@@ -71,107 +83,82 @@ def slide_transition(ss, slide_it, slide_last_it):
class ssClass(SlideshowItemClass):
def get(self, obj, *args, **kwargs):
- photo = Photo(obj)
- photo.file = args[0]
- photo.fill_inside = True
- photo.style = "shadow"
-
+ photo = Photo(obj, file=args[0], fill_inside=True, style="shadow")
return photo
def slideshow_clicked(obj):
- win = StandardWindow("slideshow", "Slideshow")
- win.autodel = True
+ win = StandardWindow("slideshow", "Slideshow", autodel=True,
+ size=(500, 400))
- ss = Slideshow(win)
- ss.loop = True
+ ss = Slideshow(win, loop=True, size_hint_weight=EXPAND_BOTH)
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.item_add(ssc, os.path.join(img_path, images[0]))
+ ss.item_add(ssc, os.path.join(img_path, images[1]))
+ ss.item_add(ssc, os.path.join(img_path, images[2]))
+ ss.item_add(ssc, os.path.join(img_path, images[3]))
+ ss.item_add(ssc, os.path.join(img_path, images[8]))
+ ss.item_add(ssc, os.path.join(img_path, images[4]))
+ ss.item_add(ssc, os.path.join(img_path, images[5]))
+ ss.item_add(ssc, os.path.join(img_path, images[6]))
+ slide_last_it = ss.item_add(ssc, os.path.join(img_path, images[7]))
ss.callback_transition_end_add(slide_transition, slide_last_it)
- no = 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 = Box(win)
- bx.horizontal = True
- no.content = bx
+ bx = Box(win, horizontal=True)
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)
+ no = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM,
+ size_hint_weight=EXPAND_BOTH, timeout=3.0, content=bx)
+ win.resize_object_add(no)
+
+ bx.event_callback_add(EVAS_CALLBACK_MOUSE_IN, mouse_in, no)
+ bx.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, mouse_out, no)
- bt = Button(win)
- bt.text = "Previous"
+ bt = Button(win, text="Previous")
bt.callback_clicked_add(previous, ss)
bx.pack_end(bt)
bt.show()
- bt = Button(win)
- bt.text = "Next"
+ bt = Button(win, text="Next")
bt.callback_clicked_add(next, ss)
bx.pack_end(bt)
bt.show()
- hv = Hoversel(win)
+ hv = Hoversel(win, hover_parent=win, text=ss.transitions[0])
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 = Hoversel(win)
+ hv = Hoversel(win, hover_parent=win, text=ss.layout)
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 = Spinner(win)
- sp.label_format = "%2.0f secs."
+ sp = Spinner(win, label_format="%2.0f secs.", step=1, min_max=(1, 30),
+ value=3)
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 = Button(win)
- bt_stop = Button(win)
+ bt_start = Button(win, text="Start")
+ bt_stop = Button(win, text="Stop", disabled=True)
- bt = bt_start
- bt.text = "Start"
- bt.callback_clicked_add(start, ss, sp, bt_start, bt_stop)
- bx.pack_end(bt)
- bt.show()
+ bt_start.callback_clicked_add(start, ss, sp, bt_start, bt_stop)
+ bx.pack_end(bt_start)
+ bt_start.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()
+ bt_stop.callback_clicked_add(stop, ss, sp, bt_start, bt_stop)
+ bx.pack_end(bt_stop)
+ bt_stop.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)
+ ss.event_callback_add(EVAS_CALLBACK_MOUSE_UP, notify_show, no)
+ ss.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, no)
- win.resize(500, 400)
win.show()
diff --git a/examples/elementary/test_spinner.py b/examples/elementary/test_spinner.py
index 323227d..0c88b84 100644
--- a/examples/elementary/test_spinner.py
+++ b/examples/elementary/test_spinner.py
@@ -1,88 +1,61 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.spinner import Spinner
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
def spinner_clicked(obj):
- win = Window("spinner", elementary.ELM_WIN_BASIC)
- win.title_set("Spinner test")
- win.autodel_set(True)
+ win = StandardWindow("spinner", "Spinner test", autodel=True,
+ size=(300, 300))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- bx = Box(win)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
bx.show()
- sp = Spinner(win)
- sp.editable = True
- sp.label_format = "%1.1f units"
- sp.step = 1.3
- sp.wrap = True
- sp.min_max = -50.0, 250.0
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ sp = Spinner(win, editable=True, label_format="%1.1f units", step=1.3,
+ wrap=True, min_max=(-50.0, 250.0), size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(sp)
sp.show()
- sp = Spinner(win)
- sp.label_format = "Base 5.5, Round 2 : %1.1f"
- sp.min_max = -100.0, 100.0
- sp.round = 2
- sp.base = 5.5
- sp.value = 5.5
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ sp = Spinner(win, label_format="Base 5.5, Round 2 : %1.1f",
+ min_max=(-100.0, 100.0), round=2, base=5.5, value=5.5,
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ)
bx.pack_end(sp)
sp.show()
- sp = Spinner(win)
- sp.label_format = "Percentage %%%1.2f something"
- sp.step = 5.0
- sp.min_max = 0.0, 100.0
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ sp = Spinner(win, label_format="Percentage %%%1.2f something",
+ step=5.0, min_max=(0.0, 100.0), size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(sp)
sp.show()
- sp = Spinner(win)
- sp.label_format = "%1.1f units"
- sp.step = 1.3
- sp.wrap = True
- sp.style = "vertical"
- sp.min_max = -50.0, 250.0
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ sp = Spinner(win, label_format="%1.1f units", step=1.3, wrap=True,
+ style="vertical", min_max=(-50.0, 250.0), size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(sp)
sp.show()
- sp = Spinner(win)
- sp.label_format = "Disabled %.0f"
- sp.disabled = True
- sp.min_max = -50.0, 250.0
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+ sp = Spinner(win, label_format="Disabled %.0f", disabled=True,
+ min_max=(-50.0, 250.0), size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(sp)
sp.show()
- sp = Spinner(win)
- sp.wrap = True
- sp.min_max = 1, 12
- sp.value = 1
- sp.label_format = "%.0f"
- sp.editable = False
+ sp = Spinner(win, wrap=True, min_max=(1, 12), value=1,
+ label_format="%.0f", editable=False, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_HORIZ)
+
sp.special_value_add(1, "January")
sp.special_value_add(2, "February")
sp.special_value_add(3, "March")
@@ -95,12 +68,10 @@ def spinner_clicked(obj):
sp.special_value_add(10, "October")
sp.special_value_add(11, "November")
sp.special_value_add(12, "December")
- sp.size_hint_align = evas.EVAS_HINT_FILL, 0.5
- sp.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
+
bx.pack_end(sp)
sp.show()
- win.resize(300, 300)
win.show()
if __name__ == "__main__":
diff --git a/examples/elementary/test_table.py b/examples/elementary/test_table.py
index f1cb9dd..353c3c7 100644
--- a/examples/elementary/test_table.py
+++ b/examples/elementary/test_table.py
@@ -1,70 +1,52 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
+from efl.elementary.window import StandardWindow
from efl.elementary.background import Background
from efl.elementary.button import Button
from efl.elementary.table import Table
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def table_clicked(obj):
- win = Window("table", elementary.ELM_WIN_BASIC)
- win.title_set("Table")
- win.autodel_set(True)
+ win = StandardWindow("table", "Table", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- tb = Table(win)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
tb.show()
- bt = 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)
+ bt = Button(win, text="Button 1", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
- bt = 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)
+ bt = Button(win, text="Button 2", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
bt.show()
- bt = 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)
+ bt = Button(win, text="Button 3", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
- bt = 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)
+ bt = Button(win, text="Button 4", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 2, 1)
bt.show()
- bt = 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)
+ bt = Button(win, text="Button 5", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 1, 1, 3)
bt.show()
- bt = 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)
+ bt = Button(win, text="Button 6", size_hint_weight=EXPAND_BOTH,
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 2, 2, 2)
bt.show()
diff --git a/examples/elementary/test_thumb.py b/examples/elementary/test_thumb.py
index d8422d4..6a02fa0 100644
--- a/examples/elementary/test_thumb.py
+++ b/examples/elementary/test_thumb.py
@@ -1,14 +1,20 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.window import StandardWindow
-from efl.elementary.background import Background
from efl.elementary.scroller import Scroller
from efl.elementary.table import Table
from efl.elementary.thumb import Thumb
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def thumb_clicked(obj):
if not elementary.need_ethumb():
@@ -29,35 +35,28 @@ def thumb_clicked(obj):
"mystrale_2.jpg"
)
- win = StandardWindow("thumb", "Thumb")
- win.autodel_set(True)
+ win = StandardWindow("thumb", "Thumb", autodel=True, size=(600, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- tb = Table(win)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
n = 0
for j in range(12):
for i in range(12):
- th = 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)
+ th = Thumb(win, file=os.path.join(img_path, images[n]),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
+ editable=True)
tb.pack(th, i, j, 1, 1)
- th.editable = True
th.show()
- sc = Scroller(win)
- sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
win.resize_object_add(sc)
- sc.content_set(tb)
tb.show()
sc.show()
- win.resize(600, 600)
win.show()
diff --git a/examples/elementary/test_toolbar.py b/examples/elementary/test_toolbar.py
index de7ab29..bd82038 100644
--- a/examples/elementary/test_toolbar.py
+++ b/examples/elementary/test_toolbar.py
@@ -1,6 +1,9 @@
#!/usr/bin/env python
# encoding: utf-8
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
@@ -12,17 +15,21 @@ from efl.elementary.frame import Frame
from efl.elementary.label import Label
from efl.elementary.list import List
-from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+ALIGN_CENTER = 0.5, 0.5
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def tb_1(obj, it, ph):
- ph.file = "images/panel_01.jpg"
+ ph.file = os.path.join(img_path, "panel_01.jpg")
def tb_2(obj, it, ph):
- ph.file = "images/rock_01.jpg"
+ ph.file = os.path.join(img_path, "rock_01.jpg")
def tb_3(obj, it, ph):
- ph.file = "images/wood_01.jpg"
+ ph.file = os.path.join(img_path, "wood_01.jpg")
def tb_3a(obj, it, ph):
tb_3(obj, it, ph)
@@ -33,7 +40,7 @@ def tb_3b(obj, it, ph):
del it.state
def tb_4(obj, it, ph):
- ph.file = "images/sky_03.jpg"
+ ph.file = os.path.join(img_path, "sky_03.jpg")
def tb_4a(obj, it, ph):
it.state = it.state_prev()
@@ -42,25 +49,39 @@ def tb_5(obj, it, ph):
ph.file = None
def toolbar_clicked(obj, item=None):
- win = StandardWindow("toolbar", "Toolbar")
- win.autodel = True
+ win = StandardWindow("toolbar", "Toolbar", autodel=True, size=(320, 300))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bx = Box(win)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
- bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
bx.show()
- tb = Toolbar(win)
- tb.homogeneous = False
- tb.size_hint_weight = 0.0, 0.0
- tb.size_hint_align = EVAS_HINT_FILL, 0.0
+ tbl = Table(win, size_hint_weight=(0.0, EVAS_HINT_EXPAND),
+ size_hint_align=FILL_BOTH)
+
+ tb = Toolbar(win, homogeneous=False, size_hint_weight=(0.0, 0.0),
+ size_hint_align=(EVAS_HINT_FILL, 0.0))
+
+ ph1 = Photo(win, size=40, file=os.path.join(img_path, "plant_01.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph1, 0, 0, 1, 1)
+ ph1.show()
+
+ ph2 = Photo(win, size=80, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph2, 1, 0, 1, 1)
+ ph2.show()
+
+ ph3 = Photo(win, size=40, file=os.path.join(img_path, "sky_01.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph3, 0, 1, 1, 1)
+ ph3.show()
- ph1 = Photo(win)
- ph2 = Photo(win)
- ph3 = Photo(win)
- ph4 = Photo(win)
+ ph4 = Photo(win, size=60, file=os.path.join(img_path, "sky_02.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph4, 1, 1, 1, 1)
+ ph4.show()
item = tb.item_append("document-print", "Hello", tb_1)
item.disabled = True
@@ -86,71 +107,54 @@ def toolbar_clicked(obj, item=None):
bx.pack_end(tb)
tb.show()
- tb = Table(win)
- tb.size_hint_weight = 0.0, EVAS_HINT_EXPAND
- tb.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
-
- ph1.size = 40
- ph1.file = "images/plant_01.jpg"
- ph1.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph1.size_hint_align = 0.5, 0.5
- tb.pack(ph1, 0, 0, 1, 1)
- ph1.show()
-
- ph2.size = 80
- ph2.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph2.size_hint_align = 0.5, 0.5
- tb.pack(ph2, 1, 0, 1, 1)
- ph2.show()
-
- ph3.size = 40
- ph3.file = "images/sky_01.jpg"
- ph3.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph3.size_hint_align = 0.5, 0.5
- tb.pack(ph3, 0, 1, 1, 1)
- ph3.show()
-
- ph4.size = 60
- ph4.file = "images/sky_02.jpg"
- ph4.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph4.size_hint_align = 0.5, 0.5
- tb.pack(ph4, 1, 1, 1, 1)
- ph4.show()
-
- bx.pack_end(tb)
- tb.show()
+ bx.pack_end(tbl)
+ tbl.show()
- win.resize(320, 300)
win.show()
# Toolbar with multiple state buttons
def toolbar5_clicked(obj, item=None):
- win = StandardWindow("toolbar5", "Toolbar 5")
+ win = StandardWindow("toolbar5", "Toolbar 5", autodel=True, size=(320, 300))
win.autodel = True
- bx = Box(win)
- bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
bx.show()
- tb = Toolbar(win)
- tb.homogeneous = 0
- tb.shrink_mode = ELM_TOOLBAR_SHRINK_MENU
- tb.size_hint_weight = 0.0, 0.0
- tb.size_hint_align = EVAS_HINT_FILL, 0.0
- tb.select_mode = ELM_OBJECT_SELECT_MODE_NONE
+ tbl = Table(win, size_hint_weight=(0.0, EVAS_HINT_EXPAND),
+ size_hint_align=FILL_BOTH)
+
+ tb = Toolbar(win, homogeneous=False, shrink_mode=ELM_TOOLBAR_SHRINK_MENU,
+ size_hint_weight=(0.0, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0),
+ select_mode=ELM_OBJECT_SELECT_MODE_NONE)
+
+ ph1 = Photo(win, size=40, file=os.path.join(img_path, "plant_01.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph1, 0, 0, 1, 1)
+ ph1.show()
+
+ ph2 = Photo(win, size=80, size_hint_weight=EXPAND_BOTH,
+ size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph2, 1, 0, 1, 1)
+ ph2.show()
+
+ ph3 = Photo(win, size=20, file=os.path.join(img_path, "sky_01.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph3, 0, 1, 1, 1)
+ ph3.show()
- ph1 = Photo(win)
- ph2 = Photo(win)
- ph3 = Photo(win)
- ph4 = Photo(win)
+ ph4 = Photo(win, size=60, file=os.path.join(img_path, "sky_02.jpg"),
+ size_hint_weight=EXPAND_BOTH, size_hint_align=ALIGN_CENTER)
+ tbl.pack(ph4, 1, 1, 1, 1)
+ ph4.show()
tb_it = tb.item_append("document-print", "Hello", tb_1, ph1)
tb_it.disabled = True
tb_it.priority = 100
- tb_it = tb.item_append("images/icon_04.png", "World", tb_2, ph1)
+ tb_it = tb.item_append(os.path.join(img_path, "icon_04.png"),
+ "World", tb_2, ph1)
tb_it.priority = -100
tb_it = tb.item_append("object-rotate-right", "H", tb_3a, ph4)
@@ -179,78 +183,38 @@ def toolbar5_clicked(obj, item=None):
bx.pack_end(tb)
tb.show()
- tb = Table(win)
- tb.size_hint_weight = 0.0, EVAS_HINT_EXPAND
- tb.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
-
- ph = ph1
- ph.size = 40
- ph.file = "images/plant_01.jpg"
- ph.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph.size_hint_align = 0.5, 0.5
- tb.pack(ph, 0, 0, 1, 1)
- ph.show()
-
- ph = ph2
- ph.size = 80
- ph.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph.size_hint_align = 0.5, 0.5
- tb.pack(ph, 1, 0, 1, 1)
- ph.show()
-
- ph = ph3
- ph.size = 20
- ph.file = "images/sky_01.jpg"
- ph.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph.size_hint_align = 0.5, 0.5
- tb.pack(ph, 0, 1, 1, 1)
- ph.show()
-
- ph = ph4
- ph.size = 60
- ph.file = "images/sky_02.jpg"
- ph.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- ph.size_hint_align = 0.5, 0.5
- tb.pack(ph, 1, 1, 1, 1)
- ph.show()
+ bx.pack_end(tbl)
+ tbl.show()
- bx.pack_end(tb)
- tb.show()
-
- win.size = 320, 300
win.show()
if __name__ == "__main__":
elementary.init()
- win = StandardWindow("test", "python-elementary test application")
+ win = StandardWindow("test", "python-elementary test application",
+ size=(320,520))
win.callback_delete_request_add(lambda o: elementary.exit())
- box0 = Box(win)
- box0.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+ box0 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box0)
box0.show()
- fr = Frame(win)
- fr.text_set("Information")
- box0.pack_end(fr)
- fr.show()
-
lb = 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()
+ fr = Frame(win, text="Information", content=lb)
+ box0.pack_end(fr)
+ fr.show()
+
items = [
("Toolbar", toolbar_clicked),
("Toolbar Item States", toolbar5_clicked),
]
- li = List(win)
- li.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
- li.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
+ li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@@ -259,7 +223,6 @@ if __name__ == "__main__":
li.go()
- win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()
diff --git a/examples/elementary/test_tooltip.py b/examples/elementary/test_tooltip.py
index c7e07a5..65f4c3b 100644
--- a/examples/elementary/test_tooltip.py
+++ b/examples/elementary/test_tooltip.py
@@ -1,11 +1,12 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
-from efl import ecore
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
+from efl.ecore import Timer
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.entry import Entry
@@ -13,22 +14,25 @@ from efl.elementary.list import List
from efl.elementary.toolbar import Toolbar
from efl.elementary.icon import Icon
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
+
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
def _tt_icon(obj, *args, **kargs):
- ic = Icon(obj)
- ic.file_set("images/logo_small.png")
- ic.resizable_set(0, 0)
- ic.resize(64, 64)
+ ic = Icon(obj, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False), size=(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 = Icon(obj)
- ic.file_set("images/icon_00.png")
- ic.resizable_set(0, 0)
- ic.resize(64, 64)
+ ic = Icon(obj, file=os.path.join(img_path, "icon_00.png"),
+ resizable=(False, False), size=(64, 64))
return ic
def _tt_timer_del(obj, data, *args):
@@ -39,26 +43,16 @@ def _tt_timer_del(obj, data, *args):
def tooltip_clicked(obj):
- win = Window("tooltips", elementary.ELM_WIN_BASIC)
- win.title_set("Tooltips")
- win.autodel_set(True)
+ win = StandardWindow("tooltips", "Tooltips", autodel=True, size=(400, 500))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
- bg = Background(win)
- win.resize_object_add(bg)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- bg.show()
-
- bx = Box(win)
+ bx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bx)
- bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bx.show()
- tb = 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)
+ tb = Toolbar(win, homogeneous=False, size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
bx.pack_end(tb)
tb.show()
@@ -69,8 +63,7 @@ def tooltip_clicked(obj):
ti.tooltip_content_cb_set(_tt_item_icon, None)
ti.tooltip_style_set("transparent")
- bt = Button(win)
- bt.text_set("Simple text tooltip");
+ bt = Button(win, text="Simple text tooltip")
bt.tooltip_text_set("Simple text tooltip")
bx.pack_end(bt)
bt.show()
@@ -83,8 +76,7 @@ def tooltip_clicked(obj):
value += 1
data["value"] = value
- bt = Button(win)
- bt.text_set("Simple text tooltip, click to change");
+ bt = Button(win, text="Simple text tooltip, click to change")
bt.tooltip_text_set("Initial")
data = dict()
bt.callback_clicked_add(_tt_text_replace, data)
@@ -102,12 +94,10 @@ def tooltip_clicked(obj):
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)
+ data["timer"] = Timer(1.5, _tt_text_replace_timer_cb, obj, data)
obj.text_set("Simple text tooltip, click to stop changed timed")
- bt = Button(win)
- bt.text_set("Simple text tooltip, click to start changed timed");
+ bt = Button(win, text="Simple text tooltip, click to start changed timed")
bt.tooltip_text_set("Initial")
data = dict()
bt.callback_clicked_add(_tt_text_replace_timed, data)
@@ -115,8 +105,7 @@ def tooltip_clicked(obj):
bt.show()
bt.on_del_add(_tt_timer_del, data)
- bt = Button(win)
- bt.text_set("Icon tooltip");
+ bt = Button(win, text="Icon tooltip")
bt.tooltip_content_cb_set(_tt_icon, None)
bx.pack_end(bt)
bt.show()
@@ -141,8 +130,7 @@ def tooltip_clicked(obj):
data)
obj.text_set("Icon tooltip, click to stop changed timed")
- bt = Button(win)
- bt.text_set("Icon tooltip, click to start changed timed");
+ bt = Button(win, text="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)
@@ -150,8 +138,7 @@ def tooltip_clicked(obj):
bt.show()
bt.on_del_add(_tt_timer_del, data)
- bt = Button(win)
- bt.text_set("Transparent Icon tooltip");
+ bt = Button(win, text="Transparent Icon tooltip")
bt.tooltip_content_cb_set(_tt_icon, None)
bt.tooltip_style_set("transparent")
bx.pack_end(bt)
@@ -177,8 +164,7 @@ def tooltip_clicked(obj):
data)
obj.text_set("Icon tooltip, click to stop changed timed")
- bt = Button(win)
- bt.text_set("Icon tooltip style, click to start changed timed");
+ bt = Button(win, text="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)
@@ -196,38 +182,32 @@ def tooltip_clicked(obj):
obj.text_set("Locked tooltip visibility");
obj.tooltip_show()
- bt = Button(win)
- bt.text_set("Unlocked tooltip visibility");
- bt.tooltip_text_set("This tooltip is unlocked visible,<br> clock the button to lock!")
+ bt = Button(win, text="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 = 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 = Entry(win, scrollable=True, single_line=True,
+ entry="Hello, some scrolled entry here!", size_hint_weight=EXPAND_HORIZ,
+ size_hint_align=FILL_HORIZ)
en.tooltip_text_set("Type something here!")
bx.pack_end(en)
en.show()
- lst = List(win)
+ lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
+ size_hint_min=(100, 100))
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__":
diff --git a/examples/elementary/test_transit.py b/examples/elementary/test_transit.py
index 5c3040e..3200cff 100644
--- a/examples/elementary/test_transit.py
+++ b/examples/elementary/test_transit.py
@@ -1,3 +1,10 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EVAS_ASPECT_CONTROL_VERTICAL
from efl import elementary
from efl.elementary.button import Button
from efl.elementary.window import StandardWindow
@@ -11,8 +18,11 @@ from efl.elementary.frame import Frame
from efl.elementary.label import Label
from efl.elementary.list import List
-from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_ASPECT_CONTROL_VERTICAL
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+script_path = os.path.dirname(os.path.abspath(__file__))
+img_path = os.path.join(script_path, "images")
class CustomEffect(TransitCustomEffect):
def __init__(self, from_w, from_h, to_w, to_h):
@@ -74,10 +84,10 @@ def transit_image_animation(obj, data):
ic = data
images = [
- "images/icon_19.png",
- "images/icon_00.png",
- "images/icon_11.png",
- "images/logo_small.png"
+ os.path.join(img_path, "icon_19.png"),
+ os.path.join(img_path, "icon_00.png"),
+ os.path.join(img_path, "icon_11.png"),
+ os.path.join(img_path, "logo_small.png")
]
trans = Transit()
@@ -166,26 +176,22 @@ def transit_clicked(obj, item=None):
bx.size_hint_min = 318, 318
bx.show()
- ic = Image(win)
- ic.file = "images/icon_11.png"
- ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
+ ic = Image(win, file=os.path.join(img_path, "icon_11.png"),
+ size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
- bt = Button(win)
- bt.text = "ImageAnimation Effect"
+ bt = Button(win, text="ImageAnimation Effect")
bt.part_content_set("icon", ic)
bx.pack_end(bt)
bt.show()
ic.show()
bt.callback_clicked_add(transit_image_animation, ic)
- bt = Button(win)
- bt.text = "Color, Rotation and Translation"
+ bt = Button(win, text="Color, Rotation and Translation")
bx.pack_end(bt)
bt.show()
bt.callback_clicked_add(transit_rotation_translation_color)
- bt = Button(win)
- bt.text = "Wipe Effect"
+ bt = Button(win, text="Wipe Effect")
bx.pack_end(bt)
bt.show()
bt.callback_clicked_add(transit_wipe)
@@ -194,36 +200,25 @@ def transit_clicked(obj, item=None):
# Resizing Effect
def transit2_clicked(obj, item=None):
- win = StandardWindow("transit2", "Transit 2")
- win.autodel = True
+ win = StandardWindow("transit2", "Transit 2", autodel=True, size=(400, 400))
- bt = Button(win)
- bt.text = "Resizing Effect"
+ bt = Button(win, text="Resizing Effect", pos=(50, 100), size=(100, 50))
bt.show()
- bt.move(50, 100)
- bt.resize(100, 50)
bt.callback_clicked_add(transit_resizing)
- win.resize(400, 400)
win.show()
# Flip Effect
def transit3_clicked(obj, item=None):
- win = StandardWindow("transit3", "Transit 3")
- win.autodel = True
+ win = StandardWindow("transit3", "Transit 3", autodel=True, size=(300, 300))
- bt = Button(win)
- bt.text = "Front Button - Flip Effect"
+ bt = Button(win, text="Front Button - Flip Effect", pos=(50, 50),
+ size=(200, 200))
bt.show()
- bt.move(50, 50)
- bt.resize(200, 200)
- bt2 = Button(win)
- bt2.text = "Back Button - Flip Effect"
- bt2.move(50, 50)
- bt2.resize(200, 200)
+ bt2 = Button(win, text="Back Button - Flip Effect", pos=(50, 50),
+ size=(200, 200))
- win.resize(300, 300)
win.show()
bt.callback_clicked_add(transit_flip, bt2)
@@ -231,47 +226,34 @@ def transit3_clicked(obj, item=None):
# Zoom Effect
def transit4_clicked(obj, item=None):
- win = StandardWindow("transit4", "Transit 4")
- win.autodel = True
+ win = StandardWindow("transit4", "Transit 4", autodel=True, size=(300, 300))
- bt = Button(win)
- bt.text = "Zoom Effect"
- bt.resize(100, 50)
- bt.move(100, 125)
+ bt = Button(win, text="Zoom Effect", size=(100, 50), pos=(100, 125))
bt.show()
bt.callback_clicked_add(transit_zoom)
- win.resize(300, 300)
win.show()
# Blend Effect
def transit5_clicked(obj, item=None):
- win = StandardWindow("transit5", "Transit 5")
- win.autodel = True
+ win = StandardWindow("transit5", "Transit 5", autodel=True, size=(300, 300))
- ic = Image(win)
- ic.file = "images/rock_01.jpg"
- ic.size_hint_max = 50, 50
+ ic = Image(win, file=os.path.join(img_path, "rock_01.jpg"),
+ size_hint_max=(50, 50))
- bt = Button(win)
+ bt = Button(win, text="Before Button - Blend Effect", pos=(25, 125),
+ size=(250, 50))
bt.part_content_set("icon", ic)
- bt.text = "Before Button - Blend Effect"
- bt.move(25, 125)
- bt.resize(250, 50)
bt.show()
- ic = Image(win)
- ic.file = "images/rock_02.jpg"
- ic.size_hint_max = 50, 50
+ ic = Image(win, file=os.path.join(img_path, "rock_02.jpg"),
+ size_hint_max=(50, 50))
- bt2 = Button(win)
+ bt2 = Button(win, text="After Button - Blend Effect", pos=(25, 125),
+ size=(250, 50))
bt2.part_content_set("icon", ic)
- bt2.text = "After Button - Blend Effect"
- bt2.move(25, 125)
- bt2.resize(250, 50)
- win.resize(300, 300)
win.show()
bt.callback_clicked_add(transit_blend, bt2)
@@ -279,31 +261,23 @@ def transit5_clicked(obj, item=None):
# Fade Effect */
def transit6_clicked(obj, item=None):
- win = StandardWindow("transit6","Transit 6")
- win.autodel = True
+ win = StandardWindow("transit6","Transit 6", autodel=True, size=(300, 300))
- ic = Image(win)
- ic.file = "images/rock_01.jpg"
- ic.size_hint_max = 50, 50
+ ic = Image(win, file=os.path.join(img_path, "rock_01.jpg"),
+ size_hint_max=(50, 50))
- bt = Button(win)
+ bt = Button(win, text="Before Button - Fade Effect", pos=(25, 125),
+ size=(250, 50))
bt.part_content_set("icon", ic)
- bt.text = "Before Button - Fade Effect"
- bt.move(25, 125)
- bt.resize(250, 50)
bt.show()
- ic = Image(win)
- ic.file = "images/rock_02.jpg"
- ic.size_hint_max = 50, 50
+ ic = Image(win, file=os.path.join(img_path, "rock_02.jpg"),
+ size_hint_max=(50, 50))
- bt2 = Button(win)
+ bt2 = Button(win, text="After Button - Fade Effect", pos=(25, 125),
+ size=(250, 50))
bt2.part_content_set("icon", ic)
- bt2.text = "After Button - Fade Effect"
- bt2.move(25, 125)
- bt2.resize(250, 50)
- win.resize(300, 300)
win.show()
bt.callback_clicked_add(transit_fade, bt2)
@@ -311,21 +285,15 @@ def transit6_clicked(obj, item=None):
# Resizable Flip Effect
def transit7_clicked(obj, item=None):
- win = StandardWindow("transit7", "Transit 7")
- win.autodel = True
+ win = StandardWindow("transit7", "Transit 7", autodel=True, size=(400, 400))
- bt = Button(win)
- bt.text = "Front Button - Resizable Flip Effect"
+ bt = Button(win, text="Front Button - Resizable Flip Effect", pos=(50, 100),
+ size=(250, 30))
bt.show()
- bt.move(50, 100)
- bt.resize(250, 30)
- bt2 = Button(win)
- bt2.text = "Back Button - Resizable Flip Effect"
- bt2.move(50, 100)
- bt2.resize(300, 200)
+ bt2 = Button(win, text="Back Button - Resizable Flip Effect", pos=(50, 100),
+ size=(300, 200))
- win.resize(400, 400)
win.show()
bt.callback_clicked_add(transit_resizable_flip, bt2)
@@ -333,14 +301,11 @@ def transit7_clicked(obj, item=None):
# Custom Effect
def transit8_clicked(obj, item=None):
- win = StandardWindow("transit8", "Transit 8")
- win.autodel = True
+ win = StandardWindow("transit8", "Transit 8", autodel=True, size=(400, 400))
- bt = Button(win)
- bt.text = "Button - Custom Effect"
+ bt = Button(win, text="Button - Custom Effect", pos=(50, 50),
+ size=(150, 150))
bt.show()
- bt.move(50, 50)
- bt.resize(150, 150)
# Adding Transit
trans = Transit()
@@ -352,36 +317,22 @@ def transit8_clicked(obj, item=None):
trans.repeat_times = -1
trans.go()
- win.resize(400, 400)
win.show()
# Chain Transit Effect
def transit9_clicked(obj, item=None):
- win = StandardWindow("transit9", "Transit 9")
- win.autodel = True
+ win = StandardWindow("transit9", "Transit 9", autodel=True, size=(400, 400))
- bt = Button(win)
- bt.text = "Chain 1"
- bt.resize(100, 100)
- bt.move(0, 0)
+ bt = Button(win, text="Chain 1", size=(100, 100), pos=(0, 0))
bt.show()
- bt2 = Button(win)
- bt2.text = "Chain 2"
- bt2.resize(100, 100)
- bt2.move(300, 0)
+ bt2 = Button(win, text="Chain 2", size=(100, 100), pos=(300, 0))
bt2.show()
- bt3 = Button(win)
- bt3.text = "Chain 3"
- bt3.resize(100, 100)
- bt3.move(300, 300)
+ bt3 = Button(win, text="Chain 3", size=(100, 100), pos=(300, 300))
bt3.show()
- bt4 = Button(win)
- bt4.text = "Chain 4"
- bt4.resize(100, 100)
- bt4.move(0, 300)
+ bt4 = Button(win, text="Chain 4", size=(100, 100), pos=(0, 300))
bt4.show()
trans = Transit()
@@ -416,31 +367,29 @@ def transit9_clicked(obj, item=None):
trans4.objects_final_state_keep = True
trans3.chain_transit_add(trans4)
- win.resize(400, 400)
win.show()
+
if __name__ == "__main__":
elementary.init()
- win = StandardWindow("test", "python-elementary test application")
+ win = StandardWindow("test", "python-elementary test application",
+ size=(320,520))
win.callback_delete_request_add(lambda o: elementary.exit())
- box0 = Box(win)
- box0.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+ box0 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box0)
box0.show()
- fr = Frame(win)
- fr.text = "Information"
- box0.pack_end(fr)
- fr.show()
-
lb = 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 = lb
lb.show()
+ fr = Frame(win, text="Information", content=lb)
+ box0.pack_end(fr)
+ fr.show()
+
items = [
("Transit", transit_clicked),
("Transit Resize", transit2_clicked),
@@ -453,9 +402,7 @@ if __name__ == "__main__":
("Transit Chain", transit9_clicked),
]
- li = List(win)
- li.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
- li.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+ li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@@ -464,7 +411,6 @@ if __name__ == "__main__":
li.go()
- win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()
diff --git a/examples/elementary/test_video.py b/examples/elementary/test_video.py
index 64d6a3b..a1bc51d 100644
--- a/examples/elementary/test_video.py
+++ b/examples/elementary/test_video.py
@@ -1,22 +1,23 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
-from efl import ecore
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
+ EVAS_CALLBACK_MOUSE_MOVE, EVAS_CALLBACK_MOUSE_IN, EVAS_CALLBACK_MOUSE_OUT
from efl import elementary
-from efl.elementary.window import Window
-from efl.elementary.background import Background
+from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.button import Button
-from efl.elementary.notify import Notify
+from efl.elementary.notify import Notify, ELM_NOTIFY_ORIENT_BOTTOM
from efl.elementary.fileselector_button import FileselectorButton
from efl.elementary.table import Table
from efl.elementary.video import Video, Player
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
-def my_bt_open(bt, file, video):
- if (file and video):
- video.file_set(file)
+def my_bt_open(bt, vfile, video):
+ if (vfile and video):
+ video.file_set(vfile)
video.play()
def notify_show(video, event, no):
@@ -31,49 +32,34 @@ def notify_unblock(video, event, no):
no.show()
def video_clicked(obj):
- win = Window("video", elementary.ELM_WIN_BASIC)
- win.title = "video"
- win.autodel = True
+ win = StandardWindow("video", "video", autodel=True, size=(800, 600))
win.alpha = True # Needed to turn video fast path on
- bg = Background(win)
- bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- win.resize_object_add(bg)
- bg.show()
-
- video = Video(win)
- video.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ video = Video(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(video)
video.show()
- notify = Notify(win)
- notify.orient = elementary.ELM_NOTIFY_ORIENT_BOTTOM
- notify.timeout = 3.0
+ player = Player(win, content=video)
+ player.show()
- player = Player(win)
- player.content = video
+ notify = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM, timeout=3.0)
notify.content = player
- player.show()
- tb = Table(win)
- tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
- bt = FileselectorButton(win)
- bt.text = "Select Video"
+ bt = FileselectorButton(win, text="Select Video",
+ size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
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)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
+ video.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)
- win.resize(800, 600)
win.show()
diff --git a/examples/elementary/test_win.py b/examples/elementary/test_win.py
index d1527af..366664d 100644
--- a/examples/elementary/test_win.py
+++ b/examples/elementary/test_win.py
@@ -1,25 +1,25 @@
#!/usr/bin/env python
# encoding: utf-8
-from efl import evas
-from efl import ecore
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
-from efl.elementary.window import Window
+from efl.elementary.window import Window, ELM_WIN_BASIC
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.check import Check
from efl.elementary.slider import Slider
-
+EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
+FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
+FILL_HORIZ = EVAS_HINT_FILL, 0.5
def cb_alpha(bt, win, bg, on):
win.alpha = on
print("alpha: %s" % win.alpha)
- if on:
- bg.hide()
- else:
- bg.show()
+
+ bg.hide() if on else bg.show()
def cb_fullscreen(bt, win, fs):
win.fullscreen = fs
@@ -32,87 +32,66 @@ def cb_rot(bt, win, ck, rot):
win.rotation = rot
def cb_win_moved(win):
- print(("MOVE - win geom:", win.geometry))
+ print("MOVE - win geom: x %d, y %d, w %d, h %d" % win.geometry)
def window_states_clicked(obj):
- win = Window("window-states", elementary.ELM_WIN_BASIC)
- win.title = "Window States test"
- win.autodel = True
+ win = Window("window-states", ELM_WIN_BASIC,
+ title="Window States test", autodel=True, size=(280, 400))
win.callback_moved_add(cb_win_moved)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
print(win.available_profiles)
- bg = Background(win)
+ bg = Background(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bg)
- bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
- vbox = Box(win)
- vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.show()
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
vbox.pack_end(hbox)
hbox.show()
for state in [True, False]:
- bt = 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 = Button(win, text="Alpha " + ("On" if state else "Off"),
+ size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_alpha, win, bg, state)
hbox.pack_end(bt)
bt.show()
for state in [True, False]:
- bt = Button(win)
- bt.text = "FS " + ("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 = Button(win, text="FS " + ("On" if state else "Off"),
+ size_hint_align=FILL_HORIZ, size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_fullscreen, win, state)
hbox.pack_end(bt)
bt.show()
- sl = 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)
+ sl = Slider(win, text="Visual test", indicator_format="%3.0f",
+ min_max=(50, 150), value=50, inverted=True,
+ size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, EVAS_HINT_FILL))
vbox.pack_end(sl)
sl.show()
- ck = Check(win)
- ck.text = "Resize on rotate"
- ck.size_hint_align = (0.0, 0.0)
+ ck = Check(win, text="Resize on rotate", size_hint_align=(0.0, 0.0))
vbox.pack_end(ck)
ck.show()
- hbox = 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)
+ hbox = Box(win, horizontal=True, size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
vbox.pack_end(hbox)
hbox.show()
for rot in [0, 90, 180, 270]:
- bt = 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 = Button(win, text="Rot " + str(rot), size_hint_align=FILL_HORIZ,
+ size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(cb_rot, win, ck, rot)
hbox.pack_end(bt)
bt.show()
- win.resize(280, 400)
win.show()