aboutsummaryrefslogtreecommitdiffstats
path: root/examples/elementary/test_frame.py
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:10:56 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2013-11-02 02:10:56 +0200
commita2364dba2c6cb275b3d3e592d128bfbc4a650dc0 (patch)
tree0e1fcddc0414c39075fa453116beed3efed708a1 /examples/elementary/test_frame.py
parentElementary.object_item: Change ObjectItem.data to hold a dict (like Eo). (diff)
downloadpython-efl-a2364dba2c6cb275b3d3e592d128bfbc4a650dc0.tar.gz
Elementary: Examples, part N.
"We're doing it, we're doing it! Stop being so testy." - Vincent Price as The Sinister Man, addressing Satan.
Diffstat (limited to 'examples/elementary/test_frame.py')
-rw-r--r--examples/elementary/test_frame.py68
1 files changed, 36 insertions, 32 deletions
diff --git a/examples/elementary/test_frame.py b/examples/elementary/test_frame.py
index 6c5cccf..9b1a779 100644
--- a/examples/elementary/test_frame.py
+++ b/examples/elementary/test_frame.py
@@ -1,60 +1,64 @@
#!/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.scroller import Scroller
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.frame import Frame
from efl.elementary.icon import Icon
+from efl.elementary.label import Label
+
+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 frame_clicked(obj):
- win = Window("frame", elementary.ELM_WIN_BASIC)
- win.title_set("Frame test")
- win.autodel_set(True)
+ win = StandardWindow("frame", "Frame 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_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
+ vbox = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.show()
- # frame 1
- ic = Icon(win)
- ic.file_set("images/logo_small.png")
-
- fr = Frame(win)
- fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
- fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- fr.text_set("Frame title")
- fr.content_set(ic)
+ # frame 1 (label)
+ lbl = Label(win, text="content")
+ fr = Frame(win, size_hint_align=FILL_BOTH,
+ text="Frame (label)", content=lbl)
vbox.pack_end(fr)
fr.show()
- # frame 2 (collapsable)
- ic = Icon(win)
- ic.file_set("images/logo_small.png")
+ # frame 1 (icon)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False))
+ fr = Frame(win, size_hint_align=FILL_BOTH,
+ text="Frame (icon)", content=ic)
+ vbox.pack_end(fr)
+ fr.show()
- fr = Frame(win)
- fr.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
- fr.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
- fr.autocollapse_set(True)
- fr.text_set("Frame collapsable (BROKEN)")
- fr.content_set(ic)
+ # frame 2 (collapsable label)
+ lbl = Label(win, text="content")
+ fr = Frame(win, size_hint_align=FILL_BOTH,
+ autocollapse=True, text="Frame (collapsable label)", content=lbl)
vbox.pack_end(fr)
fr.show()
- win.resize(320, 320)
- win.show()
+ # frame 3(collapsable icon)
+ ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
+ resizable=(False, False))
+ fr = Frame(win, size_hint_align=FILL_BOTH,
+ autocollapse=True, text="Frame (collapsable icon)", content=ic)
+ vbox.pack_end(fr)
+ fr.show()
+ win.show()
if __name__ == "__main__":
elementary.init()