Elementary: Examples, part N.

"We're doing it, we're doing it! Stop being so testy."

  - Vincent Price as The Sinister Man, addressing Satan.
This commit is contained in:
Kai Huuhko 2013-11-02 02:10:56 +02:00
parent fc69997a75
commit a2364dba2c
21 changed files with 808 additions and 1413 deletions

View File

@ -33,7 +33,7 @@ def buttons_clicked(obj):
bx.pack_end(bt)
bt.show()
ic = Icon(win, file=ic_file, resizable=(0, 0))
ic = Icon(win, file=ic_file, resizable=(False, False))
ic.show()
bt = Button(win, text="Icon no scale", content=ic)
bx.pack_end(bt)
@ -43,7 +43,7 @@ def buttons_clicked(obj):
bx.pack_end(bt)
bt.show()
ic = Icon(win, file=ic_file, resizable=(0, 0))
ic = Icon(win, file=ic_file, resizable=(False, False))
bt = Button(win, content=ic)
bx.pack_end(bt)
bt.show()

View File

@ -1,3 +1,6 @@
#!/usr/bin/env python
# encoding: utf-8
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.conformant import Conformant

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python
# encoding: utf-8
import os
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl.ecore import Timer
from efl import edje
@ -17,13 +19,18 @@ from efl.elementary.list import List
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 edje_external_button_clicked(obj, item=None):
win = StandardWindow("edje-external-button", "Edje External Button",
autodel=True, size=(320, 400))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
ly = Layout(win, file=("test_external.edj", "external/button"),
ly = Layout(win,file=(
os.path.join(script_path, "test_external.edj"),
"external/button"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()
@ -63,7 +70,9 @@ def edje_external_pbar_clicked(obj, item=None):
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
ly = Layout(win, file=("test_external.edj", "external/pbar"),
ly = Layout(win, file=(
os.path.join(script_path, "test_external.edj"),
"external/pbar"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()
@ -80,7 +89,9 @@ def edje_external_scroller_clicked(obj, item=None):
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
ly = Layout(win, file=("test_external.edj", "external/scroller"),
ly = Layout(win, file=(
os.path.join(script_path, "test_external.edj"),
"external/scroller"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()
@ -93,7 +104,9 @@ def edje_external_slider_clicked(obj, item=None):
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
ly = Layout(win, file=("test_external.edj", "external/slider"),
ly = Layout(win, file=(
os.path.join(script_path, "test_external.edj"),
"external/slider"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()
@ -106,7 +119,9 @@ def edje_external_video_clicked(obj, item=None):
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
ly = Layout(win, file=("test_external.edj", "external/video"),
ly = Layout(win, file=(
os.path.join(script_path, "test_external.edj"),
"external/video"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()

View File

@ -2,10 +2,10 @@
# encoding: utf-8
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.frame import Frame
from efl.elementary.label import Label
@ -17,6 +17,8 @@ from efl.elementary.fileselector_button import FileselectorButton
from efl.elementary.fileselector_entry import FileselectorEntry
from efl.elementary.separator import Separator
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def fs_cb_done(fs, selected, win):
win.delete()
@ -56,90 +58,65 @@ def bt_cb_mode_cycle(bt, fs):
def fileselector_clicked(obj, item=None):
win = Window("fileselector", elementary.ELM_WIN_BASIC)
win.title_set("File selector test")
win.autodel_set(True)
win = StandardWindow("fileselector", "File selector test", autodel=True,
size=(240,350))
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 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
vbox.show()
fs = Fileselector(win)
fs.is_save_set(True)
fs.expandable_set(False)
fs.folder_only_set(False)
fs.path_set(os.getenv("HOME"))
fs.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fs.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
fs = Fileselector(win, is_save=True, expandable=True, folder_only=True,
path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
fs.callback_done_add(fs_cb_done, win)
fs.callback_selected_add(fs_cb_selected, win)
fs.callback_directory_open_add(fs_cb_directory_open, win)
vbox.pack_end(fs)
fs.show()
sep = Separator(win)
sep.horizontal_set(True)
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.horizontal_set(True)
hbox = Box(win, horizontal=True)
vbox.pack_end(hbox)
hbox.show()
ck = Check(win)
ck.text_set("is_save")
ck.state_set(fs.is_save)
ck = Check(win, text="is_save", state=fs.is_save)
ck.callback_changed_add(ck_cb_is_save, fs)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("folder_only")
ck.state_set(fs.folder_only)
ck = Check(win, text="folder_only", state=fs.folder_only)
ck.callback_changed_add(ck_cb_folder_only, fs)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("expandable")
ck.state_set(fs.expandable)
ck = Check(win, text="expandable", state=fs.expandable)
ck.callback_changed_add(ck_cb_expandable, fs)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("buttons")
ck.state_set(fs.buttons_ok_cancel)
ck = Check(win, text="buttons", state=fs.buttons_ok_cancel)
ck.callback_changed_add(ck_cb_buttons, fs)
hbox.pack_end(ck)
ck.show()
hbox = Box(win)
hbox.horizontal_set(True)
hbox = Box(win, horizontal=True)
vbox.pack_end(hbox)
hbox.show()
bt = Button(win)
bt.text_set("selected_get")
bt = Button(win, text="selected_get")
bt.callback_clicked_add(bt_cb_sel_get, fs)
hbox.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("path_get")
bt = Button(win, text="path_get")
bt.callback_clicked_add(bt_cb_path_get, fs)
hbox.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("mode cycle")
bt = Button(win, text="mode cycle")
bt.callback_clicked_add(bt_cb_mode_cycle, fs)
hbox.pack_end(bt)
bt.show()
@ -149,75 +126,53 @@ def fileselector_clicked(obj, item=None):
def fileselector_button_clicked(obj, item=None):
win = Window("fileselector", elementary.ELM_WIN_BASIC)
win.title_set("File selector test")
win.autodel_set(True)
win = StandardWindow("fileselector", "File selector test", autodel=True,
size=(240, 350))
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 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
vbox.show()
fse = FileselectorButton(win)
fse.text_set("Select a file")
fse.inwin_mode_set(False)
fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fse = FileselectorButton(win, text="Select a file", inwin_mode=False,
size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(fse)
fse.show()
sep = Separator(win)
sep.horizontal_set(True)
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.horizontal_set(True)
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(hbox)
hbox.show()
ck = Check(win)
ck.text_set("inwin")
ck.state_set(fse.inwin_mode)
ck = Check(win, text="inwin", state=fse.inwin_mode)
ck.callback_changed_add(ck_entry_cb_inwin, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("folder_only")
ck.state_set(fse.folder_only)
ck = Check(win, text="folder_only", state=fse.folder_only)
ck.callback_changed_add(ck_entry_cb_folder_only, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("is_save")
ck.state_set(fse.is_save)
ck = Check(win, text="is_save", state=fse.is_save)
ck.callback_changed_add(ck_entry_cb_is_save, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("expandable")
ck.state_set(fse.expandable)
ck = Check(win, text="expandable", state=fse.expandable)
ck.callback_changed_add(ck_entry_cb_expandable, fse)
hbox.pack_end(ck)
ck.show()
win.resize(240, 350)
win.show()
def ck_entry_cb_is_save(bt, fse):
print("Toggle is save")
fse.is_save = not fse.is_save
def ck_entry_cb_inwin(bt, fse):
print("Toggle inwin mode")
fse.inwin_mode = not fse.inwin_mode
@ -232,110 +187,75 @@ def ck_entry_cb_expandable(bt, fse):
def fileselector_entry_clicked(obj, item=None):
win = Window("fileselector", elementary.ELM_WIN_BASIC)
win.title_set("File selector test")
win.autodel_set(True)
win = StandardWindow("fileselector", "File selector test", autodel=True,
size=(240, 150))
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 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbox)
vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
vbox.show()
fse = FileselectorEntry(win)
fse.text_set("Select a file")
fse.inwin_mode_set(False)
fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fse = FileselectorEntry(win, text="Select a file", inwin_mode=False,
size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(fse)
fse.show()
sep = Separator(win)
sep.horizontal_set(True)
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.horizontal_set(True)
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(hbox)
hbox.show()
ck = Check(win)
ck.text_set("inwin")
ck.state_set(fse.inwin_mode)
ck = Check(win, text="inwin", state=fse.inwin_mode)
ck.callback_changed_add(ck_entry_cb_inwin, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("folder_only")
ck.state_set(fse.folder_only)
ck = Check(win, text="folder_only", state=fse.folder_only)
ck.callback_changed_add(ck_entry_cb_folder_only, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("is_save")
ck.state_set(fse.is_save)
ck = Check(win, text="is_save", state=fse.is_save)
ck.callback_changed_add(ck_entry_cb_is_save, fse)
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text_set("expandable")
ck.state_set(fse.expandable)
ck = Check(win, text="expandable", state=fse.expandable)
ck.callback_changed_add(ck_entry_cb_expandable, fse)
hbox.pack_end(ck)
ck.show()
win.resize(240, 150)
win.show()
if __name__ == "__main__":
def destroy(obj):
elementary.exit()
elementary.init()
win = Window("test", elementary.ELM_WIN_BASIC)
win.title_set("python-elementary test application")
win.callback_delete_request_add(destroy)
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
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()
box0 = Box(win)
box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.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 = [("Fileselector", fileselector_clicked),
("Fileselector Button", fileselector_button_clicked),
("Fileselector Entry", fileselector_entry_clicked),
]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -344,8 +264,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -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
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.box import Box
from efl.elementary.frame import Frame
@ -12,8 +14,22 @@ from efl.elementary.button import Button
from efl.elementary.layout import Layout
from efl.elementary.list import List
from efl.elementary.radio import Radio
from efl.elementary.flip import Flip
from efl.elementary.flip import Flip, ELM_FLIP_ROTATE_X_CENTER_AXIS, \
ELM_FLIP_ROTATE_Y_CENTER_AXIS, ELM_FLIP_ROTATE_XZ_CENTER_AXIS, \
ELM_FLIP_ROTATE_YZ_CENTER_AXIS, ELM_FLIP_CUBE_LEFT, ELM_FLIP_CUBE_RIGHT, \
ELM_FLIP_CUBE_UP, ELM_FLIP_CUBE_DOWN, ELM_FLIP_PAGE_LEFT, \
ELM_FLIP_PAGE_RIGHT, ELM_FLIP_PAGE_UP, ELM_FLIP_PAGE_DOWN, \
ELM_FLIP_DIRECTION_UP, ELM_FLIP_DIRECTION_DOWN, \
ELM_FLIP_DIRECTION_LEFT, ELM_FLIP_DIRECTION_RIGHT, \
ELM_FLIP_INTERACTION_NONE, ELM_FLIP_INTERACTION_ROTATE, \
ELM_FLIP_INTERACTION_CUBE, ELM_FLIP_INTERACTION_PAGE
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
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 my_flip_go(bt, fl, mode):
fl.go(mode)
@ -25,128 +41,94 @@ def my_flip_animate_done(fl):
print("Animation Done")
def flip_clicked(obj, item=None):
# window
win = Window("flip", elementary.ELM_WIN_BASIC)
win.autodel_set(True)
win.title_set("Flip")
win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))
# background
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
# main vertical box
box = Box(win)
box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
box = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box)
box.show()
# flip object
fl = Flip(win)
fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
fl.callback_animate_begin_add(my_flip_animate_begin)
fl.callback_animate_done_add(my_flip_animate_done)
box.pack_end(fl)
fl.show()
# front content (image)
o = Background(win)
o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
o.file_set("images/sky_01.jpg")
# flip front content
o = Background(win, size_hint_weight=EXPAND_BOTH,
file=os.path.join(img_path, "sky_01.jpg"))
fl.part_content_set("front", o)
o.show()
# back content (layout)
ly = Layout(win)
ly.file_set("test.edj", "layout")
ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
# flip back content
ly = Layout(win, file=(os.path.join(script_path, "test.edj"), "layout"),
size_hint_weight=EXPAND_BOTH)
fl.part_content_set("back", ly)
ly.show()
bt = Button(win)
bt.text_set("Button 1")
bt = Button(win, text="Button 1")
ly.part_content_set("element1", bt)
bt.show()
bt = Button(win)
bt.text_set("Button 2")
bt = Button(win, text="Button 2")
ly.part_content_set("element2", bt)
bt.show()
bt = Button(win)
bt.text_set("Button 3")
bt = Button(win, text="Button 3")
ly.part_content_set("element3", bt)
bt.show()
# flip buttons (first row)
hbox = Box(win)
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
hbox.horizontal_set(True)
hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
hbox.show()
box.pack_end(hbox)
count = 1
for mode in [elementary.ELM_FLIP_ROTATE_X_CENTER_AXIS,
elementary.ELM_FLIP_ROTATE_Y_CENTER_AXIS,
elementary.ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
elementary.ELM_FLIP_ROTATE_YZ_CENTER_AXIS]:
bt = Button(win)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.text_set(str(count))
for mode in [ELM_FLIP_ROTATE_X_CENTER_AXIS,
ELM_FLIP_ROTATE_Y_CENTER_AXIS,
ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
ELM_FLIP_ROTATE_YZ_CENTER_AXIS]:
bt = Button(win, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH, text=str(count))
bt.callback_clicked_add(my_flip_go, fl, mode)
hbox.pack_end(bt)
bt.show()
count += 1
# flip buttons (second row)
hbox = Box(win)
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
hbox.horizontal_set(True)
hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
hbox.show()
box.pack_end(hbox)
for mode in [elementary.ELM_FLIP_CUBE_LEFT,
elementary.ELM_FLIP_CUBE_RIGHT,
elementary.ELM_FLIP_CUBE_UP,
elementary.ELM_FLIP_CUBE_DOWN]:
bt = Button(win)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.text_set(str(count))
for mode in [ELM_FLIP_CUBE_LEFT,
ELM_FLIP_CUBE_RIGHT,
ELM_FLIP_CUBE_UP,
ELM_FLIP_CUBE_DOWN]:
bt = Button(win, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH, text=str(count))
bt.callback_clicked_add(my_flip_go, fl, mode)
hbox.pack_end(bt)
bt.show()
count += 1
# flip buttons (third row)
hbox = Box(win)
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
hbox.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
hbox.horizontal_set(True)
hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
hbox.show()
box.pack_end(hbox)
for mode in [elementary.ELM_FLIP_PAGE_LEFT,
elementary.ELM_FLIP_PAGE_RIGHT,
elementary.ELM_FLIP_PAGE_UP,
elementary.ELM_FLIP_PAGE_DOWN]:
bt = Button(win)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.text_set(str(count))
for mode in [ELM_FLIP_PAGE_LEFT,
ELM_FLIP_PAGE_RIGHT,
ELM_FLIP_PAGE_UP,
ELM_FLIP_PAGE_DOWN]:
bt = Button(win, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH, text=str(count))
bt.callback_clicked_add(my_flip_go, fl, mode)
hbox.pack_end(bt)
bt.show()
count += 1
# window show
win.resize(320, 320)
win.show()
@ -155,147 +137,107 @@ def my_cb_radios (rd, fl):
fl.interaction_set(rd.value_get())
def flip_interactive_clicked(obj, item=None):
# window
win = Window("flip", elementary.ELM_WIN_BASIC)
win.autodel_set(True)
win.title_set("Flip")
win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))
# background
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
# main vertical box
box = Box(win)
box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
box = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box)
box.show()
# flip object
fl = Flip(win)
fl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
fl.interaction_set(elementary.ELM_FLIP_INTERACTION_NONE);
fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_UP, True);
fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_DOWN, True);
fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_LEFT, True);
fl.interaction_direction_enabled_set(elementary.ELM_FLIP_DIRECTION_RIGHT, True);
fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_UP, 0.25);
fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_DOWN, 0.25);
fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_LEFT, 0.25);
fl.interaction_direction_hitsize_set(elementary.ELM_FLIP_DIRECTION_RIGHT, 0.25);
fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
interaction=ELM_FLIP_INTERACTION_NONE)
fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_UP, True)
fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_DOWN, True)
fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_LEFT, True)
fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_RIGHT, True)
fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_UP, 0.25)
fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_DOWN, 0.25)
fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_LEFT, 0.25)
fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_RIGHT, 0.25)
fl.callback_animate_begin_add(my_flip_animate_begin)
fl.callback_animate_done_add(my_flip_animate_done)
box.pack_end(fl)
fl.show()
# front content (image)
o = Background(win)
o.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
o.file_set("images/sky_01.jpg")
o = Background(win, size_hint_weight=EXPAND_BOTH,
file=os.path.join(img_path, "sky_01.jpg"))
fl.part_content_set("front", o)
o.show()
# back content (layout)
ly = Layout(win)
ly.file_set("test.edj", "layout")
ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
ly = Layout(win, size_hint_weight=EXPAND_BOTH,
file=(os.path.join(script_path, "test.edj"), "layout"))
fl.part_content_set("back", ly)
ly.show()
bt = Button(win)
bt.text_set("Button 1")
bt = Button(win, text="Button 1")
ly.part_content_set("element1", bt)
bt.show()
bt = Button(win)
bt.text_set("Button 2")
bt = Button(win, text="Button 2")
ly.part_content_set("element2", bt)
bt.show()
bt = Button(win)
bt.text_set("Button 3")
bt = Button(win, text="Button 3")
ly.part_content_set("element3", bt)
bt.show()
# radio buttons
rd = Radio(win)
rd.state_value_set(elementary.ELM_FLIP_INTERACTION_NONE)
rd.text_set("None")
rd = Radio(win, state_value=ELM_FLIP_INTERACTION_NONE, text="None")
rd.callback_changed_add(my_cb_radios, fl)
box.pack_end(rd)
rd.show()
rdg = rd
rd = Radio(win)
rd.state_value_set(elementary.ELM_FLIP_INTERACTION_ROTATE)
rd.text_set("Rotate")
rd = Radio(win, state_value=ELM_FLIP_INTERACTION_ROTATE, text="Rotate")
rd.callback_changed_add(my_cb_radios, fl)
rd.group_add(rdg)
box.pack_end(rd)
rd.show()
rd = Radio(win)
rd.state_value_set(elementary.ELM_FLIP_INTERACTION_CUBE)
rd.text_set("Cube")
rd = Radio(win, state_value=ELM_FLIP_INTERACTION_CUBE, text="Cube")
rd.callback_changed_add(my_cb_radios, fl)
rd.group_add(rdg)
box.pack_end(rd)
rd.show()
rd = Radio(win)
rd.state_value_set(elementary.ELM_FLIP_INTERACTION_PAGE)
rd.text_set("Page")
rd = Radio(win, state_value=ELM_FLIP_INTERACTION_PAGE, text="Page")
rd.callback_changed_add(my_cb_radios, fl)
rd.group_add(rdg)
box.pack_end(rd)
rd.show()
# window show
win.resize(320, 320)
win.show()
if __name__ == "__main__":
def destroy(obj):
elementary.exit()
elementary.init()
win = Window("test", elementary.ELM_WIN_BASIC)
win.title_set("python-elementary test application")
win.callback_delete_request_add(destroy)
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
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()
box0 = Box(win)
box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.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 = [("Flip", flip_clicked),
("Flip Interactive", flip_interactive_clicked),
]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -304,7 +246,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -1,15 +1,16 @@
#!/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.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
from efl.elementary.slider import Slider
from efl.elementary.flipselector import FlipSelector
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def sel_cb(fp, *args):
if args:
@ -51,16 +52,13 @@ def flipselector_clicked(obj):
"Edbus"
)
win = StandardWindow("flipselector", "Flip Selector")
win.autodel = True
win = StandardWindow("flipselector", "Flip Selector", autodel=True)
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()
fp = FlipSelector(win)
fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
fp = FlipSelector(win, size_hint_weight=EXPAND_BOTH)
fp.callback_selected_add(sel_cb)
fp.callback_underflowed_add(overflow_cb)
fp.callback_overflowed_add(underflow_cb)
@ -72,21 +70,17 @@ def flipselector_clicked(obj):
bx.pack_end(fp)
fp.show()
bx2 = Box(win)
bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bx2.horizontal = True
bx2 = Box(win, size_hint_weight=EXPAND_BOTH, horizontal=True)
bx.pack_end(bx2)
bx2.show()
fp = FlipSelector(win)
fp = FlipSelector(win, size_hint_weight=EXPAND_BOTH)
fp.callback_underflowed_add(overflow_cb)
fp.callback_overflowed_add(underflow_cb)
fp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
for i in range(1990, 2100):
fp.item_append(str(i), sel_cb)
bt = Button(win)
bt.text = "Flip Prev"
bt = Button(win, text="Flip Prev")
bt.callback_clicked_add(flip_prev_cb, fp)
bx2.pack_end(bt)
@ -95,37 +89,29 @@ def flipselector_clicked(obj):
bx2.pack_end(fp)
fp.show()
bt = Button(win)
bt.text = "Flip Next"
bt = Button(win, text="Flip Next")
bt.callback_clicked_add(flip_next_cb, fp)
bx2.pack_end(bt)
bt.show()
sl = Slider(win)
sl.text = "Flip Iterval:"
sl.unit_format = "%1.2f"
sl.min_max = (0.0, 3.0)
sl.value = (0.85)
sl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
sl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
sl = Slider(win, text="Flip Iterval:", unit_format="%1.2f",
min_max=(0.0, 3.0), value=0.85, size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_BOTH)
bx.pack_end(sl)
sl.show()
sl.callback_changed_add(slider_change_cb, fp)
bt = Button(win)
bt.text = "Select Last"
bt = Button(win, text="Select Last")
bt.callback_clicked_add(last_cb, fp)
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text = "Select 2097"
bt = Button(win, text="Select 2097")
bt.callback_clicked_add(third_from_end_cb, fp)
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text = "Unselect year"
bt = Button(win, text="Unselect year")
bt.callback_clicked_add(unsel_cb, fp)
bx.pack_end(bt)
bt.show()

View File

@ -9,6 +9,9 @@ from efl.ecore import Animator, loop_time_get
from efl.evas import EVAS_ASPECT_CONTROL_VERTICAL, EVAS_HINT_EXPAND, \
EVAS_HINT_FILL
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
class ItemClass(GenlistItemClass):
def text_get(self, obj, part, *args, **kwargs):
return "Item #{0}".format(args[0])
@ -19,7 +22,7 @@ class ItemClass(GenlistItemClass):
ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
return ic
def gl_sel_cb(obj, event_info, *args):
def gl_sel_cb(obj, event_info, data):
print("sel item data [{0}] on genlist obj [{1}], item [{2}]".format(data, obj, event_info))
def anim(*args, **kwargs):
@ -35,20 +38,15 @@ def del_cb(obj, *args, **kwargs):
ani.delete()
def floating_clicked(obj):
win = StandardWindow("floating", "Floating")
win.autodel = True
win = StandardWindow("floating", "Floating", autodel=True, size=(480, 800))
gl = Genlist(win)
gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
gl.move(800, 0)
gl.size = 480, 800
gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
pos=(800, 0), size=(480, 800))
gl.show()
for i in range(20):
GenlistItem(ItemClass(), i, None, ELM_GENLIST_ITEM_NONE, gl_sel_cb, i).append_to(gl)
win.size = 480, 800
win.show()
ani = Animator(anim, gl)

View File

@ -1,61 +1,65 @@
#!/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")
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 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()
# 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()
# 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.resize(320, 320)
win.show()
if __name__ == "__main__":
elementary.init()

View File

@ -2,10 +2,11 @@
# encoding: utf-8
import random
import os
from efl import evas
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_ASPECT_CONTROL_BOTH
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.check import Check
@ -15,9 +16,17 @@ from efl.elementary.slider import Slider
from efl.elementary.table import Table
from efl.elementary.scroller import Scrollable
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")
class ScrollableGengrid(Scrollable, Gengrid):
def __init__(self, canvas, *args, **kwargs):
Gengrid.__init__(self, canvas)
Gengrid.__init__(self, canvas, *args, **kwargs)
images = ["panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg",
@ -29,9 +38,8 @@ def gg_text_get(obj, part, item_data):
def gg_content_get(obj, part, data):
if part == "elm.swallow.icon":
im = Image(obj)
im.file_set("images/" + random.choice(images))
im.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1)
im = Image(obj, file=os.path.join(img_path, random.choice(images)),
size_hint_aspect=(EVAS_ASPECT_CONTROL_BOTH, 1, 1))
return im
return None
@ -59,24 +67,12 @@ def gengrid_clicked(obj):
global item_count
item_count = 25
# window
win = Window("gengrid", elementary.ELM_WIN_BASIC)
win.title_set("Gengrid")
win.autodel_set(True)
win = StandardWindow("gengrid", "Gengrid", autodel=True, size=(480, 800))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
# background
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
# main table
tb = Table(win)
tb = Table(win, homogeneous=False, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.homogeneous_set(0)
tb.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
tb.show()
# gengrid
@ -85,13 +81,9 @@ def gengrid_clicked(obj):
content_get_func=gg_content_get,
state_get_func=gg_state_get,
del_func=gg_del)
gg = ScrollableGengrid(win)
gg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gg.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gg.horizontal_set(False)
gg.bounce_set(False, True)
gg.item_size_set(80, 80)
gg.align_set(0.5, 0.0)
gg = ScrollableGengrid(win, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH, horizontal=False, bounce=(False, True),
item_size=(80, 80), align=(0.5, 0.0))
tb.pack(gg, 0, 0, 6, 1)
gg.callback_selected_add(gg_sel)
gg.callback_unselected_add(gg_unsel)
@ -102,15 +94,12 @@ def gengrid_clicked(obj):
for i in range(item_count):
gg.item_append(itc, i, None)
# multi select
def multi_select_changed(bt, gg):
gg.multi_select_set(bt.state)
print((gg.multi_select_get()))
print((gg.multi_select))
bt = Check(win)
bt.text = "MultiSelect"
bt.state = gg.multi_select_get()
bt = Check(win, text="MultiSelect", state=gg.multi_select)
bt.callback_changed_add(multi_select_changed, gg)
tb.pack(bt, 0, 1, 1, 1)
bt.show()
@ -119,8 +108,7 @@ def gengrid_clicked(obj):
def horizontal_changed(bt, gg):
gg.horizontal_set(bt.state)
bt = Check(win)
bt.text_set("Horizontal")
bt = Check(win, text="Horizontal")
bt.callback_changed_add(horizontal_changed, gg)
tb.pack(bt, 1, 1, 1, 1)
bt.show()
@ -131,9 +119,8 @@ def gengrid_clicked(obj):
gg.bounce_set(bt.state, v_bounce)
print((gg.bounce_get()))
bt = Check(win)
bt.text_set("BounceH")
(h_bounce, v_bounce) = gg.bounce_get()
bt = Check(win, text="BounceH")
h_bounce = gg.bounce[0]
bt.state = h_bounce
bt.callback_changed_add(bounce_h_changed, gg)
tb.pack(bt, 4, 1, 1, 1)
@ -145,9 +132,8 @@ def gengrid_clicked(obj):
gg.bounce_set(h_bounce, bt.state)
print((gg.bounce_get()))
bt = Check(win)
bt.text_set("BounceV")
(h_bounce, v_bounce) = gg.bounce_get()
bt = Check(win, text="BounceV")
v_bounce = gg.bounce[1]
bt.state = v_bounce
bt.callback_changed_add(bounce_v_changed, gg)
tb.pack(bt, 5, 1, 1, 1)
@ -164,61 +150,40 @@ def gengrid_clicked(obj):
gg.item_size_set(w, sl.value)
print((gg.item_size_get()))
sl = Slider(win)
sl.text_set("ItemSizeW")
sl.min_max_set(0, 500)
sl.indicator_format_set("%.0f")
sl.unit_format_set("%.0f")
sl.span_size_set(100)
(w, h) = gg.item_size_get()
sl.value = w
(w, h) = gg.item_size
sl = Slider(win, text="ItemSizeW", min_max=(0, 500),
indicator_format="%.0f", unit_format="%.0f", span_size=100, value=w)
sl.callback_changed_add(item_size_w_changed, gg)
tb.pack(sl, 0, 2, 2, 1)
sl.show()
sl = Slider(win)
sl.text_set("ItemSizeH")
sl.min_max_set(0, 500)
sl.indicator_format_set("%.0f")
sl.unit_format_set("%.0f")
sl.span_size_set(100)
(w, h) = gg.item_size_get()
sl.value = h
sl = Slider(win, text="ItemSizeH", min_max=(0, 500),
indicator_format="%.0f", unit_format="%.0f", span_size=100, value=h)
sl.callback_changed_add(item_size_h_changed, gg)
tb.pack(sl, 0, 3, 2, 1)
sl.show()
# align
def alignx_changed(sl, gg):
(ax, ay) = gg.align_get()
gg.align_set(sl.value, ay)
print((gg.align_get()))
(ax, ay) = gg.align
gg.align = sl.value, ay
print(gg.align)
def aligny_changed(sl, gg):
(ax, ay) = gg.align_get()
gg.align_set(ax, sl.value)
print((gg.align_get()))
(ax, ay) = gg.align
gg.align = ax, sl.value
print(gg.align)
sl = Slider(win)
sl.text_set("AlignX")
sl.min_max_set(0.0, 1.0)
sl.indicator_format_set("%.2f")
sl.unit_format_set("%.2f")
sl.span_size_set(100)
(ax, ay) = gg.align_get()
sl.value = ax
(ax, ay) = gg.align
sl = Slider(win, text="AlignX", min_max=(0.0, 1.0),
indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ax)
sl.callback_changed_add(alignx_changed, gg)
tb.pack(sl, 0, 4, 2, 1)
sl.show()
sl = Slider(win)
sl.text_set("AlignY")
sl.min_max_set(0.0, 1.0)
sl.indicator_format_set("%.2f")
sl.unit_format_set("%.2f")
sl.span_size_set(100)
(ax, ay) = gg.align_get()
sl.value = ax
sl = Slider(win, text="AlignY", min_max=(0.0, 1.0),
indicator_format="%.2f", unit_format="%.2f", span_size=100, value=ay)
sl.callback_changed_add(aligny_changed, gg)
tb.pack(sl, 0, 5, 2, 1)
sl.show()
@ -226,11 +191,10 @@ def gengrid_clicked(obj):
# select first
def select_first_clicked(bt, gg):
ggi = gg.first_item
ggi.selected = not ggi.selected
if ggi:
ggi.selected = not ggi.selected
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Select first")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Select first")
bt.callback_clicked_add(select_first_clicked, gg)
tb.pack(bt, 2, 2, 1, 1)
bt.show()
@ -238,11 +202,10 @@ def gengrid_clicked(obj):
# select last
def select_last_clicked(bt, gg):
ggi = gg.last_item
ggi.selected = not ggi.selected
if ggi:
ggi.selected = not ggi.selected
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Select last")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Select last")
bt.callback_clicked_add(select_last_clicked, gg)
tb.pack(bt, 3, 2, 1, 1)
bt.show()
@ -252,9 +215,7 @@ def gengrid_clicked(obj):
for ggi in gg.selected_items_get():
ggi.delete()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Sel del")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Sel del")
bt.callback_clicked_add(seldel_clicked, gg)
tb.pack(bt, 4, 2, 1, 1)
bt.show()
@ -265,9 +226,7 @@ def gengrid_clicked(obj):
item_count = 0
gg.clear()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Clear")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Clear")
bt.callback_clicked_add(clear_clicked, gg)
tb.pack(bt, 5, 2, 1, 1)
bt.show()
@ -275,18 +234,15 @@ def gengrid_clicked(obj):
# show first/last
def show_clicked(bt, gg, first):
ggi = gg.first_item if first else gg.last_item
ggi.show()
if ggi:
ggi.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Show first")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show first")
bt.callback_clicked_add(show_clicked, gg, True)
tb.pack(bt, 2, 3, 1, 1)
bt.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Show last")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="Show last")
bt.callback_clicked_add(show_clicked, gg, False)
tb.pack(bt, 3, 3, 1, 1)
bt.show()
@ -294,18 +250,15 @@ def gengrid_clicked(obj):
# bring-in first/last
def bring_in_clicked(bt, gg, first):
ggi = gg.first_item if first else gg.last_item
ggi.bring_in()
if ggi:
ggi.bring_in()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("BringIn first")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn first")
bt.callback_clicked_add(bring_in_clicked, gg, True)
tb.pack(bt, 4, 3, 1, 1)
bt.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("BringIn last")
bt = Button(win, size_hint_align=(EVAS_HINT_FILL, 0), text="BringIn last")
bt.callback_clicked_add(bring_in_clicked, gg, False)
tb.pack(bt, 5, 3, 1, 1)
bt.show()
@ -318,30 +271,22 @@ def gengrid_clicked(obj):
gg.item_append(itc, item_count, None)
n -= 1
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Append 1")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1")
bt.callback_clicked_add(append_clicked, gg, 1)
tb.pack(bt, 2, 4, 1, 1)
bt.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Append 100")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 100")
bt.callback_clicked_add(append_clicked, gg, 100)
tb.pack(bt, 3, 4, 1, 1)
bt.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Append 1000")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 1000")
bt.callback_clicked_add(append_clicked, gg, 1000)
tb.pack(bt, 4, 4, 1, 1)
bt.show()
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Append 10000 :)")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Append 10000 :)")
bt.callback_clicked_add(append_clicked, gg, 10000)
tb.pack(bt, 5, 4, 1, 1)
bt.show()
@ -352,9 +297,7 @@ def gengrid_clicked(obj):
item_count += 1
gg.item_prepend(itc, item_count)
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Prepend")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Prepend")
bt.callback_clicked_add(prepend_clicked, gg)
tb.pack(bt, 2, 5, 1, 1)
bt.show()
@ -369,9 +312,7 @@ def gengrid_clicked(obj):
else:
print("nothing selected")
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Ins before")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins before")
bt.callback_clicked_add(ins_before_clicked, gg)
tb.pack(bt, 3, 5, 1, 1)
bt.show()
@ -386,15 +327,13 @@ def gengrid_clicked(obj):
else:
print("nothing selected")
bt = Button(win)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, 0)
bt.text_set("Ins after")
bt = Button(win, size_hint_align=FILL_HORIZ, text="Ins after")
bt.callback_clicked_add(ins_after_clicked, gg)
tb.pack(bt, 4, 5, 1, 1)
bt.show()
print(gg)
win.resize(480, 800)
win.show()

View File

@ -3,12 +3,15 @@
import time
import sys
import os
if sys.version_info < (3,): range = xrange
from efl import evas
from efl import ecore
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, \
EVAS_ASPECT_CONTROL_VERTICAL, Rectangle
from efl.ecore import Timer
from efl import elementary
from efl.elementary.window import Window, StandardWindow
from efl.elementary.window import StandardWindow, Window, ELM_WIN_BASIC
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.frame import Frame
@ -23,16 +26,20 @@ from efl.elementary.general import cache_all_flush
from efl.elementary.radio import Radio
from efl.elementary.check import Check
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EVAS_ASPECT_CONTROL_VERTICAL
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 gl_text_get(obj, part, item_data):
return "Item # %i" % (item_data,)
def gl_content_get(obj, part, data):
ic = Icon(obj)
ic.file_set("images/logo_small.png")
ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
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_state_get(obj, part, item_data):
@ -41,7 +48,8 @@ def gl_state_get(obj, part, item_data):
def gl_comp_func(item1, item2):
#print(item1.data)
#print(item2.data)
# If data1 is 'less' than data2, -1 must be returned, if it is 'greater', 1 must be returned, and if they are equal, 0 must be returned.
# If data1 is 'less' than data2, -1 must be returned, if it is 'greater',
# 1 must be returned, and if they are equal, 0 must be returned.
if item1.data < item2.data:
return -1
elif item1.data == item2.data:
@ -64,9 +72,8 @@ def glg_text_get(obj, part, item_data):
return "Group # %i" % (item_data,)
def glg_content_get(obj, part, data):
ic = Icon(obj)
ic.file_set("images/logo.png")
ic.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_VERTICAL, 1, 1)
ic = Icon(obj, file=os.path.join(img_path, "logo.png"),
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
return ic
def _gl_selected(gl, gli, *args, **kwargs):
@ -100,30 +107,23 @@ def _gl_over_click(evas, evt, gl):
def genlist_clicked(obj, item=None):
win = Window("Genlist", elementary.ELM_WIN_BASIC)
win.title_set("Genlist test")
win.autodel_set(True)
win = StandardWindow("Genlist", "Genlist test", autodel=True)
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()
gl = Genlist(win)
gl.callback_selected_add(_gl_selected, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2", kwarg1="kwarg1", kwarg2="kwarg2")
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
gl.callback_selected_add(_gl_selected, "arg1", "arg2",
kwarg1="kwarg1", kwarg2="kwarg2")
gl.callback_clicked_double_add(_gl_clicked_double, "arg1", "arg2",
kwarg1="kwarg1", kwarg2="kwarg2")
gl.callback_longpressed_add(_gl_longpressed, "arg1", "arg2",
kwarg1="kwarg1", kwarg2="kwarg2")
bx.pack_end(gl)
gl.show()
over = evas.Rectangle(win.evas_get())
over = Rectangle(win.evas_get())
over.color_set(0, 0, 0, 0)
over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl)
over.repeat_events_set(True)
@ -131,8 +131,7 @@ def genlist_clicked(obj, item=None):
over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
win.resize_object_add(over)
vbx = Box(win)
vbx.horizontal_set(True)
vbx = Box(win, horizontal=True)
bx.pack_end(vbx)
vbx.show()
@ -141,13 +140,11 @@ def genlist_clicked(obj, item=None):
content_get_func=gl_content_get,
state_get_func=gl_state_get)
bt_50 = Button(win)
bt_50.text_set("Go to 50")
bt_50 = Button(win, text="Go to 50")
vbx.pack_end(bt_50)
bt_50.show()
bt_1500 = Button(win)
bt_1500.text_set("Go to 1500")
bt_1500 = Button(win, text="Go to 1500")
vbx.pack_end(bt_1500)
bt_1500.show()
@ -163,24 +160,19 @@ def genlist_clicked(obj, item=None):
def genlist2_clicked(obj, item=None):
win = Window("Genlist", elementary.ELM_WIN_BASIC)
win.title_set("Genlist test 2")
win.autodel_set(True)
win = Window("Genlist", ELM_WIN_BASIC, title="Genlist test 2",
autodel=True, size=(320, 320))
bg = Background(win)
bg = Background(win, file=os.path.join(img_path, "plant_01.jpg"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bg)
bg.file_set("images/plant_01.jpg")
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
bx = 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()
gl = Genlist(win)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
gl.show()
itc1 = GenlistItemClass(item_style="default",
@ -198,24 +190,18 @@ def genlist2_clicked(obj, item=None):
bx.pack_end(gl)
bx2 = Box(win)
bx2.horizontal_set(True)
bx2.homogeneous_set(True)
bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bx2 = Box(win, horizontal=True, homogeneous=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
def my_gl_first(bt, gl):
gli = gl.first_item_get()
gli = gl.first_item
if gli:
gli.show()
gli.selected = True
bt = Button(win)
bt.text_set("/\\")
bt = Button(win, text="/\\", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_first, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -226,17 +212,15 @@ def genlist2_clicked(obj, item=None):
gli.show()
gli.selected = True
bt = Button(win)
bt.text_set("\\/")
bt = Button(win, text="\\/", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_last, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
def my_gl_disable(bt, gl):
gli = gl.selected_item_get()
gli = gl.selected_item
if gli:
gli.disabled = True
gli.selected = False
@ -244,11 +228,9 @@ def genlist2_clicked(obj, item=None):
else:
print("no item selected")
bt = Button(win)
bt.text_set("#")
bt = Button(win, text="#", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_disable, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -262,11 +244,9 @@ def genlist2_clicked(obj, item=None):
i = i + 1
gli = gli.next_get()
bt = Button(win)
bt.text_set("U")
bt = Button(win, text="U", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_update_all, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -274,21 +254,16 @@ def genlist2_clicked(obj, item=None):
bx2.show()
bx2 = Box(win)
bx2.horizontal_set(True)
bx2.homogeneous_set(True)
bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bx2 = Box(win, horizontal=True, homogeneous=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
def my_gl_clear(bt, gl):
gl.clear()
bt = Button(win)
bt.text_set("X")
bt = Button(win, text="X", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_clear, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -299,11 +274,9 @@ def genlist2_clicked(obj, item=None):
gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
MyGlAdd.i = MyGlAdd.i + 1
bt = Button(win)
bt.text_set("+")
bt = Button(win, text="+", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_add, gl, itc1)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -315,22 +288,17 @@ def genlist2_clicked(obj, item=None):
else:
print("no item selected")
bt = Button(win)
bt.text_set("-")
bt = Button(win, text="-", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_del, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
bx.pack_end(bx2)
bx2.show()
bx2 = Box(win)
bx2.horizontal_set(True)
bx2.homogeneous_set(True)
bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bx2 = Box(win, horizontal=True, homogeneous=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
class MyGlInsertBefore:
@ -338,16 +306,15 @@ def genlist2_clicked(obj, item=None):
def my_gl_insert_before(bt, gl, itc1):
gli = gl.selected_item_get()
if gli:
gl.item_insert_before(itc1, MyGlInsertBefore.i, gli, func=gl_item_sel)
gl.item_insert_before(itc1, MyGlInsertBefore.i, gli,
func=gl_item_sel)
MyGlInsertBefore.i = MyGlInsertBefore.i + 1
else:
print("no item selected")
bt = Button(win)
bt.text_set("+ before")
bt = Button(win, text="+ before", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -362,11 +329,9 @@ def genlist2_clicked(obj, item=None):
else:
print("no item selected")
bt = Button(win)
bt.text_set("+ after")
bt = Button(win, text="+ after", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
@ -374,36 +339,25 @@ def genlist2_clicked(obj, item=None):
def my_gl_flush(bt, gl):
def my_gl_flush_delay():
cache_all_flush()
ecore.timer_add(1.2, my_gl_flush_delay)
bt = Button(win)
bt.text_set("Flush")
Timer(1.2, my_gl_flush_delay)
bt = Button(win, text="Flush", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_gl_flush, gl)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
bx.pack_end(bx2)
bx2.show()
win.resize(320, 320)
win.show()
def genlist3_clicked(obj, item=None):
win = Window("Genlist", elementary.ELM_WIN_BASIC)
win.title_set("Genlist Group test")
win.autodel_set(True)
win = StandardWindow("Genlist", "Genlist Group test", autodel=True,
size=(320, 320))
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
gl = Genlist(win)
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(gl)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl.show()
itc_i = GenlistItemClass(item_style="default",
@ -422,23 +376,14 @@ def genlist3_clicked(obj, item=None):
git.select_mode_set(elementary.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
gl.item_append(itc_i, i, git)
win.resize(320, 320)
win.show()
def genlist4_clicked(obj, item=None):
win = Window("Genlist", elementary.ELM_WIN_BASIC)
win.title_set("Genlist sorted insert test")
win.autodel_set(True)
win = StandardWindow("Genlist", "Genlist sorted insert test", autodel=True,
size=(320, 320))
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
gl = Genlist(win)
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(gl)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl.show()
itc_i = GenlistItemClass(item_style="default",
@ -449,24 +394,15 @@ def genlist4_clicked(obj, item=None):
for i in range(100,-1,-1):
GenlistItem(itc_i, i).sorted_insert(gl, gl_comp_func)
win.resize(320, 320)
win.show()
def genlist5_clicked(obj, item=None):
win = Window("Genlist", elementary.ELM_WIN_BASIC)
win.title_set("Genlist iteration test")
win.autodel_set(True)
win = StandardWindow("Genlist", "Genlist iteration test", autodel=True,
size=(320, 320))
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
gl = Genlist(win)
gl.homogeneous = True
gl = Genlist(win, homogeneous=True, size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(gl)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl.show()
itc_i = GenlistItemClass(item_style="default",
@ -483,8 +419,8 @@ def genlist5_clicked(obj, item=None):
assert(len(gl) == gl.items_count)
it = gl.first_item
t3 = time.time()
it = gl.first_item
while it:
d = it.data
it = it.next
@ -502,12 +438,13 @@ def genlist5_clicked(obj, item=None):
print("Time to add {0} items:".format(item_count))
print(t2-t1)
print("Time to iterate item data over {0} items using it.next:".format(item_count))
print("Time to iterate item data over {0} items using "
"it.next:".format(item_count))
print(t4-t3)
print("Time to iterate item data over {0} items using a python iterator:".format(item_count))
print("Time to iterate item data over {0} items using "
"a python iterator:".format(item_count))
print(t6-t5)
win.resize(320, 320)
win.show()
mode_type = ["slide", "rotate"]
@ -523,9 +460,9 @@ class ItemClass10(GenlistItemClass):
def content_get(self, obj, part, data):
ic = Icon(obj)
if part == "elm.swallow.end":
f = "images/bubble.png"
f = os.path.join(img_path, "bubble.png")
else:
f = "images/logo_small.png"
f = os.path.join(img_path, "logo_small.png")
ic.file = f
ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
return ic
@ -554,42 +491,33 @@ def my_gl_mode_cancel(obj, it, rd):
glit.decorate_mode_set(mode_type[v], False)
def genlist10_clicked(obj, item=None):
win = StandardWindow("genlist-decorate-item-mode", "Genlist Decorate Item Mode");
win.autodel = True
win = StandardWindow("genlist-decorate-item-mode",
"Genlist Decorate Item Mode", autodel=True, size=(520, 520))
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()
fr = Frame(win)
fr.text = "Decorate Item Mode Type"
bx2 = Box(win)
bx2.show()
fr = Frame(win, text="Decorate Item Mode Type", content=bx2)
bx.pack_end(fr)
fr.show()
bx2 = Box(win)
fr.content = bx2
bx2.show()
rd = Radio(win)
rd.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
rd.state_value = 0
rd.text = "Slide : Sweep genlist items to the right."
rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=0,
text="Slide : Sweep genlist items to the right.")
rd.show()
bx2.pack_end(rd)
rdg = rd
rd = Radio(win)
rd.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
rd.state_value = 1
rd.text = "Rotate : Click each item."
rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=1,
text = "Rotate : Click each item.")
rd.group_add(rdg)
rd.show()
bx2.pack_end(rd)
gl = Genlist(win)
gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
gl.callback_drag_start_right_add(my_gl_mode_right, rdg)
gl.callback_drag_start_left_add(my_gl_mode_left, rdg)
gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg)
@ -600,12 +528,13 @@ def genlist10_clicked(obj, item=None):
itc10.state_get = gl_state_get
for i in range(1000, 1050):
GenlistItem(itc10,
i,
None,
ELM_GENLIST_ITEM_NONE,
gl_sel10,
(i, rdg)).append_to(gl)
GenlistItem(item_class=itc10,
item_data=i,
parent_item=None,
flags=ELM_GENLIST_ITEM_NONE,
func=gl_sel10,
func_data=(i, rdg)
).append_to(gl)
bx.pack_end(gl)
@ -613,11 +542,9 @@ def genlist10_clicked(obj, item=None):
win.show()
def edit_icon_clicked_cb(ic, item):
# TODO: get the item here
#item.delete()
pass
def edit_icon_clicked_cb(ic, data):
item = data[2]
item.delete()
class ItemClass15(GenlistItemClass):
def text_get(self, obj, part, data):
@ -633,22 +560,18 @@ class ItemClass15(GenlistItemClass):
# --------------------------------------------------------------------
if part == "elm.swallow.end":
ic = Icon(obj)
ic.file = "images/bubble.png"
ic.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
ic = Icon(obj, file=os.path.join(img_path, "bubble.png"),
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
return ic
elif part == "elm.edit.icon.1":
ck = Check(obj)
ck.state = checked
ck.propagate_events = False
ck = Check(obj, state=checked, propagate_events=False)
ck.show()
return ck
elif part == "elm.edit.icon.2":
icn = Icon(obj)
icn.file = "images/icon_06.png"
icn.propagate_events = False
icn.size_hint_aspect = EVAS_ASPECT_CONTROL_VERTICAL, 1, 1
icn.callback_clicked_add(edit_icon_clicked_cb, obj)
icn = Icon(obj, file=os.path.join(img_path, "icon_06.png"),
propagate_events=False,
size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
icn.callback_clicked_add(edit_icon_clicked_cb, data)
return icn
else:
return
@ -674,17 +597,14 @@ def gl15_normal_mode(obj, gl):
gl.select_mode = ELM_OBJECT_SELECT_MODE_DEFAULT
def genlist15_clicked(obj, item=None):
win = StandardWindow("genlist-decorate-all-mode", "Genlist Decorate All Mode")
win.autodel = True
win = StandardWindow("genlist-decorate-all-mode",
"Genlist Decorate All Mode", autodel=True, size=(520, 520))
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()
gl = Genlist(win)
gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
gl.show()
itc15 = ItemClass15(item_style="default", decorate_all_item_style="edit")
@ -692,68 +612,61 @@ def genlist15_clicked(obj, item=None):
for i in range(100):
ck = Check(gl)
GenlistItem(itc15,
[i, False], # item data
None, # parent
ELM_GENLIST_ITEM_NONE, # flags
gl15_sel, # func
[i, False], # func data
data = [i, False]
it = GenlistItem(item_class=itc15,
item_data=data,
parent_item=None,
flags=ELM_GENLIST_ITEM_NONE,
func=gl15_sel,
func_data=data,
).append_to(gl)
data.append(it)
bx.pack_end(gl)
bx.show()
bx2 = Box(win)
bx2.horizontal = True
bx2.homogeneous = True
bx2.size_hint_weight = EVAS_HINT_EXPAND, 0.0
bx2.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
bx2 = Box(win, horizontal=True, homogeneous=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
bt = Button(win)
bt.text = "Decorate All mode"
bt = Button(win, text="Decorate All mode", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(gl15_deco_all_mode, gl)
bt.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
bt.size_hint_weight = EVAS_HINT_EXPAND, 0.0
bx2.pack_end(bt)
bt.show()
bt = Button(win)
bt.text = "Normal mode"
bt = Button(win, text="Normal mode", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(gl15_normal_mode, gl)
bt.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
bt.size_hint_weight = EVAS_HINT_EXPAND, 0.0
bx2.pack_end(bt)
bt.show()
bx.pack_end(bx2)
bx2.show()
win.size = 520, 520
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.EVAS_HINT_EXPAND, evas.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 = [
("Genlist", genlist_clicked),
("Genlist 2", genlist2_clicked),
@ -764,9 +677,7 @@ if __name__ == "__main__":
("Genlist Decorate All Mode", genlist15_clicked),
]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -775,7 +686,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -1,5 +1,9 @@
#!/usr/bin/env python
# encoding: utf-8
import os
from efl import elementary
from efl import evas
from efl.elementary.window import Window, ELM_WIN_BASIC
from efl.elementary.transit import Transit
@ -11,7 +15,13 @@ from efl.elementary.layout import Layout
from efl.elementary.entry import Entry, ELM_WRAP_MIXED
from efl.elementary.icon import Icon
from efl.evas import Map, EVAS_HINT_EXPAND, EVAS_EVENT_FLAG_NONE
from efl.evas import EVAS_HINT_EXPAND, EVAS_EVENT_FLAG_NONE, Map, Polygon
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
script_path = os.path.dirname(os.path.abspath(__file__))
img_path = os.path.join(script_path, "images")
#We zoom out to this value so we'll be able to use map and have a nice
#resolution when zooming in.
@ -33,9 +43,9 @@ class Photo_Object(object):
# bx, by - current wanted coordinates of the photo object.
# bw, bh - original size of the "ic" object.
# dx, dy - Used to indicate the distance between the center point
# where we put down our fingers (when started moving the item) to
# the coords of the object, so we'll be able to calculate movement
# correctly.
# where we put down our fingers (when started moving the item) to
# the coords of the object, so we'll be able to calculate movement
# correctly.
bx, by, bw, bh, dx, dy = None, None, None, None, None, None
# Because gesture layer only knows the amount of rotation/zoom we do
# per gesture, we have to keep the current rotate/zoom factor and the
@ -50,7 +60,7 @@ def apply_changes(po):
evas objects. Zoom/rotate factors and etc.
"""
map = evas.Map(4)
map = Map(4)
map.point_coord_set(0, po.bx, po.by, 0)
map.point_coord_set(1, po.bx + po.bw, po.by, 0)
map.point_coord_set(2, po.bx + po.bw, po.by + po.bh, 0)
@ -250,12 +260,11 @@ def photo_object_add(parent, ic, icon, x, y, w, h, angle):
po.bh = h
# Add shadow
po.shadow = Icon(po.ic)
po.shadow.file = "images/pol_shadow.png"
po.shadow = Icon(po.ic, file=os.path.join(img_path, "pol_shadow.png"))
po.shadow.size = SHADOW_W, SHADOW_H
po.shadow.show()
po.hit = evas.Polygon(parent.evas)
po.hit = Polygon(parent.evas)
po.hit.precise_is_inside = True
po.hit.repeat_events = True
po.hit.color = 0, 0, 0, 0
@ -266,8 +275,7 @@ def photo_object_add(parent, ic, icon, x, y, w, h, angle):
po.hit.show()
po.gl = GestureLayer(po.ic)
po.gl.hold_events = True
po.gl = GestureLayer(po.ic, hold_events=True)
po.gl.attach(po.hit)
# FIXME: Add a po.rotate start so we take the first angle!!!!
@ -293,30 +301,28 @@ def gesture_layer_clicked(obj):
w = 480
h = 800
win = Window("gesture-layer", ELM_WIN_BASIC)
win.title = "Gesture Layer"
win.autodel = True
win.size = w, h
win = Window("gesture-layer", ELM_WIN_BASIC, title="Gesture Layer",
autodel=True, size=(w, h))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
bg = Background(win)
bg.file = "images/wood_01.jpg"
bg.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
bg = Background(win, file=os.path.join(img_path, "wood_01.jpg"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(bg)
bg.show()
photos = []
photos.append(photo_object_add(win, None, "images/pol_sky.png", 200, 200, 365, 400, 0))
photos.append(photo_object_add(win, None, "images/pol_twofish.png", 40, 300, 365, 400, 45))
photos.append(photo_object_add(win, None,
os.path.join(img_path, "pol_sky.png"), 200, 200, 365, 400, 0))
photos.append(photo_object_add(win, None,
os.path.join(img_path, "pol_twofish.png"), 40, 300, 365, 400, 45))
en = Entry(win)
en = Entry(win, line_wrap=ELM_WRAP_MIXED)
en.text = "You can use whatever object you want, even entries like this."
en.line_wrap = ELM_WRAP_MIXED
postit = Layout(win)
postit.file = "postit_ent.edj", "main"
postit = Layout(win,
file=(os.path.join(script_path, "postit_ent.edj"), "main"))
postit.part_content_set("ent", en)
photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

View File

@ -1,103 +1,79 @@
#!/usr/bin/env python
# encoding: utf-8
from efl import evas
from efl.evas import EVAS_HINT_EXPAND, 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.box import Box
from efl.elementary.button import Button
from efl.elementary.entry import Entry
from efl.elementary.grid import Grid
from efl.elementary.grid import Grid, grid_pack_get, grid_pack_set
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
def cb_change(bt):
(x, y, w, h) = grid_pack_get(bt)
grid_pack_set(bt, x - 2, y - 2, w + 4, h + 4)
def grid_clicked(obj):
win = Window("grid", elementary.ELM_WIN_BASIC)
win.title = "Grid test"
win.autodel = True
win = StandardWindow("grid", "Grid test", autodel=True, size=(480, 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 = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
gd = Grid(win)
gd.size = (100, 100)
gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
win.resize_object_add(gd)
gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gd.show()
en = Entry(win)
en.scrollable = True
en.text = "Entry text 2"
en.single_line = True
en = Entry(win, scrollable=True, text="Entry text 2", single_line=True)
gd.pack(en, 60, 20, 30, 10)
en.show()
bt = Button(win)
bt.text = "Next API function"
bt = Button(win, text="Next API function", disabled=True)
gd.pack(bt, 30, 0, 40, 10)
bt.disabled = True
bt.show()
bt = Button(win)
bt.text = "Button"
bt = Button(win, text="Button")
gd.pack(bt, 0, 0, 20, 20)
bt.show()
bt = Button(win);
bt.text = "Button"
bt = Button(win, text="Button")
gd.pack(bt, 10, 10, 40, 20)
bt.show()
bt = Button(win);
bt.text = "Button"
bt = Button(win, text="Button")
gd.pack(bt, 10, 30, 20, 50)
bt.show()
bt = Button(win);
bt.text = "Button"
bt = Button(win, text="Button")
gd.pack(bt, 80, 80, 20, 20)
bt.show()
bt = Button(win);
bt.text = "Change"
bt = Button(win, text="Change")
bt.callback_clicked_add(cb_change)
gd.pack(bt, 40, 40, 20, 20)
bt.show()
re = evas.Rectangle(win.evas)
re.color = (128, 0, 0, 128)
re = Rectangle(win.evas, color=(128, 0, 0, 128))
gd.pack(re, 40, 70, 20, 10)
re.show()
re = evas.Rectangle(win.evas)
re.color = (0, 128, 0, 128)
re = Rectangle(win.evas, color=(0, 128, 0, 128))
gd.pack(re, 60, 70, 10, 10)
re.show()
re = evas.Rectangle(win.evas)
re.color = (0, 0, 128, 128)
re = Rectangle(win.evas, color=(0, 0, 128, 128))
gd.pack(re, 40, 80, 10, 10)
re.show()
re = evas.Rectangle(win.evas)
re.color = (128, 0, 128, 128)
re = Rectangle(win.evas, color=(128, 0, 128, 128))
gd.pack(re, 50, 80, 10, 10)
re.show()
re = evas.Rectangle(win.evas)
re.color = (128, 64, 0, 128)
re = Rectangle(win.evas, color=(128, 64, 0, 128))
gd.pack(re, 60, 80, 10, 10)
re.show()
win.resize(480, 480)
win.show()

View File

@ -1,10 +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
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.frame import Frame
@ -13,204 +14,138 @@ from efl.elementary.label import Label
from efl.elementary.list import List
from efl.elementary.icon import Icon
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 hover_bt1_clicked(bt, hv):
hv.show()
def hover_clicked(obj, item=None):
win = Window("hover", elementary.ELM_WIN_BASIC)
win.title_set("Hover")
win.autodel_set(True)
win = StandardWindow("hover", "Hover", autodel=True, size=(320, 320))
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()
hv = Hover(win)
bt = Button(win)
bt.text_set("Button")
bt = Button(win, text="Button")
bt.callback_clicked_add(hover_bt1_clicked, hv)
bx.pack_end(bt)
bt.show()
hv.parent_set(win)
hv.target_set(bt)
hv.target = bt
bt = Button(win)
bt.text_set("Popup")
bt = Button(win, text="Popup")
hv.part_content_set("middle", bt)
bt.show()
bx = Box(win)
ic = Icon(win)
ic.file_set("images/logo_small.png")
ic.resizable_set(0, 0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False))
bx.pack_end(ic)
ic.show()
bt = Button(win)
bt.text_set("Top 1")
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("Top 2")
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("Top 3")
bx.pack_end(bt)
bt.show()
for t in "Top 1", "Top 2", "Top 3":
bt = Button(win, text=t)
bx.pack_end(bt)
bt.show()
bx.show()
hv.part_content_set("top", bx)
bt = Button(win)
bt.text_set("Bottom")
bt = Button(win, text="Bottom")
hv.part_content_set("bottom", bt)
bt.show()
bt = Button(win)
bt.text_set("Left")
bt = Button(win, text="Left")
hv.part_content_set("left", bt)
bt.show()
bt = Button(win)
bt.text_set("Right")
bt = Button(win, text="Right")
hv.part_content_set("right", bt)
bt.show()
bg.size_hint_min_set(160, 160)
bg.size_hint_max_set(640, 640)
win.resize(320, 320)
win.show()
def hover2_clicked(obj, item=None):
win = Window("hover2", elementary.ELM_WIN_BASIC)
win.title_set("Hover 2")
win.autodel_set(True)
win = StandardWindow("hover2", "Hover 2", autodel=True, size=(320, 320))
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()
hv = Hover(win)
hv.style_set("popout")
hv = Hover(win, style="popout")
bt = Button(win)
bt.text_set("Button")
bt = Button(win, text="Button")
bt.callback_clicked_add(hover_bt1_clicked, hv)
bx.pack_end(bt)
bt.show()
hv.parent_set(win)
hv.target_set(bt)
bt = Button(win)
bt.text_set("Popup")
bt = Button(win, text="Popup")
hv.part_content_set("middle", bt)
bt.show()
bx = Box(win)
ic = Icon(win)
ic.file_set("images/logo_small.png")
ic.resizable_set(0, 0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False))
bx.pack_end(ic)
ic.show()
bt = Button(win)
bt.text_set("Top 1")
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("Top 2")
bx.pack_end(bt)
bt.show()
bt = Button(win)
bt.text_set("Top 3")
bx.pack_end(bt)
bt.show()
for t in "Top 1", "Top 2", "Top 3":
bt = Button(win, text=t)
bx.pack_end(bt)
bt.show()
bx.show()
hv.part_content_set("top", bx)
bt = Button(win)
bt.text_set("Bot")
bt = Button(win, text="Bot")
hv.part_content_set("bottom", bt)
bt.show()
bt = Button(win)
bt.text_set("Left")
bt = Button(win, text="Left")
hv.part_content_set("left", bt)
bt.show()
bt = Button(win)
bt.text_set("Right")
bt = Button(win, text="Right")
hv.part_content_set("right", bt)
bt.show()
bg.size_hint_min_set(160, 160)
bg.size_hint_max_set(640, 640)
win.resize(320, 320)
win.show()
if __name__ == "__main__":
def destroy(obj):
elementary.exit()
elementary.init()
win = Window("test", elementary.ELM_WIN_BASIC)
win.title_set("python-elementary test application")
win.callback_delete_request_add(destroy)
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
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()
box0 = Box(win)
box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.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 = [("Hover", hover_clicked),
("Hover 2", hover2_clicked)]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -219,8 +154,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -1,110 +1,89 @@
#!/usr/bin/env python
# encoding: utf-8
from efl import evas
import os
from efl.evas import EVAS_HINT_EXPAND
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.hoversel import Hoversel
from efl.elementary.hoversel import Hoversel, ELM_ICON_STANDARD, ELM_ICON_FILE
from efl.elementary.icon import Icon
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
WEIGHT_ZERO = 0.0, 0.0
ALIGN_CENTER = 0.5, 0.5
script_path = os.path.dirname(os.path.abspath(__file__))
img_path = os.path.join(script_path, "images")
def hoversel_clicked(obj):
win = Window("hoversel", elementary.ELM_WIN_BASIC)
win.title_set("Hoversel")
win.autodel_set(True)
win = StandardWindow("hoversel", "Hoversel", 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()
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()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("Labels")
bt = Hoversel(win, hover_parent=win, text="Labels",
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1")
bt.item_add("Item 2")
bt.item_add("Item 3")
bt.item_add("Item 4 - Long Label Here")
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bx.pack_end(bt)
bt.show()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("Some Icons")
bt = Hoversel(win, hover_parent=win, text="Some Icons",
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1")
bt.item_add("Item 2")
bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("All Icons")
bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bt = Hoversel(win, hover_parent=win, text="All Icons",
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
bt.item_add("Item 2", "arrow_down", ELM_ICON_STANDARD)
bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("All Icons")
bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 2", "images/logo_small.png", elementary.ELM_ICON_FILE)
bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bt = Hoversel(win, hover_parent=win, text="All Icons",
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
bt.item_add("Item 2", os.path.join(img_path, "logo_small.png"),
ELM_ICON_FILE)
bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("Disabled Hoversel")
bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 2", "close", elementary.ELM_ICON_STANDARD)
bt.disabled_set(True)
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bt = Hoversel(win, hover_parent=win, text="Disabled Hoversel",
disabled=True, size_hint_weight=WEIGHT_ZERO,
size_hint_align=ALIGN_CENTER)
bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
bt.item_add("Item 2", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
bt = Hoversel(win)
bt.hover_parent_set(win)
bt.text_set("Icon + Label")
ic = Icon(win)
ic.file_set("images/sky_03.jpg")
bt.content_set(ic)
ic = Icon(win, file=os.path.join(img_path, "sky_03.jpg"))
bt = Hoversel(win, hover_parent=win, text="Icon + Label", content=ic,
size_hint_weight=WEIGHT_ZERO, size_hint_align=ALIGN_CENTER)
ic.show()
bt.item_add("Item 1", "apps", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 2", "arrow_down", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 3", "home", elementary.ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", elementary.ELM_ICON_STANDARD)
bt.size_hint_weight_set(0.0, 0.0)
bt.size_hint_align_set(0.5, 0.5)
bt.item_add("Item 1", "apps", ELM_ICON_STANDARD)
bt.item_add("Item 2", "arrow_down", ELM_ICON_STANDARD)
bt.item_add("Item 3", "home", ELM_ICON_STANDARD)
bt.item_add("Item 4", "close", ELM_ICON_STANDARD)
bx.pack_end(bt)
bt.show()
win.resize(320, 320)
win.show()

View File

@ -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
from efl import elementary
from efl.elementary.window import Window
from efl.elementary.window import StandardWindow, Window, ELM_WIN_BASIC
from efl.elementary.background import Background
from efl.elementary.box import Box
from efl.elementary.button import Button
@ -13,124 +15,95 @@ from efl.elementary.check import Check
from efl.elementary.list import List
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
script_path = os.path.dirname(os.path.abspath(__file__))
img_path = os.path.join(script_path, "images")
def aspect_fixed_cb(obj, ic):
ic.aspect_fixed_set(obj.state_get())
ic.aspect_fixed = obj.state
def fill_outside_cb(obj, ic):
ic.fill_outside_set(obj.state_get())
ic.fill_outside = obj.state
def smooth_cb(obj, ic):
ic.smooth_set(obj.state_get())
ic.smooth = obj.state
def bt_clicked(obj):
win = Window("preload-prescale", elementary.ELM_WIN_BASIC)
win.title_set("Preload & Prescale")
win.autodel_set(True)
win = StandardWindow("preload-prescale", "Preload & Prescale", autodel=True,
size=(350, 350))
bg = Background(win)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
win.resize_object_add(bg)
bg.show()
ic = Icon(win)
ic = Icon(win, file=os.path.join(img_path, "insanely_huge_test_image.jpg"),
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
resizable=(True, True), aspect_fixed=True, preload_disabled=True,
prescale=True)
win.resize_object_add(ic)
ic.file_set("images/insanely_huge_test_image.jpg")
ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
ic.resizable_set(True, True)
ic.aspect_fixed_set(True)
ic.preload_disabled_set(True)
ic.prescale_set(True)
ic.show()
win.resize(350, 350)
win.show()
def icon_clicked(obj, item=None):
win = Window("icon test", elementary.ELM_WIN_BASIC)
win.title_set("Icon Test")
win.autodel_set(True)
win = StandardWindow("icon test", "Icon Test", autodel=True,
size=(400, 400))
bg = Background(win)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
win.resize_object_add(bg)
bg.show()
box = Box(win)
box = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box)
box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
box.show()
content_box = Box(win)
content_box = Box(win, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
win.resize_object_add(content_box)
content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
content_box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
box.pack_end(content_box)
content_box.show()
ic = Icon(win)
ic.file_set("images/logo.png")
ic.resizable_set(True, True)
ic.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
ic.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
ic = Icon(win, file=os.path.join(img_path, "logo.png"),
resizable=(True, True), size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
content_box.pack_end(ic)
ic.show()
hbox = Box(win)
hbox.horizontal_set(True)
content_box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
box.pack_end(hbox)
hbox.show()
# Test Aspect Fixed
tg = Check(win)
tg.text_set("Aspect Fixed")
tg.state_set(True)
tg = Check(win, text="Aspect Fixed", state=True)
tg.callback_changed_add(aspect_fixed_cb, ic)
hbox.pack_end(tg)
tg.show()
# Test Fill Outside
tg = Check(win)
tg.text_set("Fill Outside")
tg = Check(win, text="Fill Outside")
tg.callback_changed_add(fill_outside_cb, ic)
hbox.pack_end(tg)
tg.show()
# Test Smooth
tg = Check(win)
tg.text_set("Smooth")
tg.state_set(True)
tg = Check(win, text="Smooth", state=True)
tg.callback_changed_add(smooth_cb, ic)
hbox.pack_end(tg)
tg.show()
# Test Preload, Prescale
bt = Button(win)
bt.text_set("Preload & Prescale")
bt = Button(win, text="Preload & Prescale")
bt.callback_clicked_add(bt_clicked)
hbox.pack_end(bt)
bt.show()
win.resize(400, 400)
win.show()
def icon_transparent_clicked(obj, item=None):
win = Window("icon-transparent", elementary.ELM_WIN_BASIC)
win.title_set("Icon Transparent")
win.autodel_set(True)
win.alpha_set(True)
win = Window("icon-transparent", ELM_WIN_BASIC, title="Icon Transparent",
autodel=True, alpha=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
icon = Icon(win)
icon.file_set("images/logo.png")
icon.resizable_set(0, 0)
icon = Icon(win, file=os.path.join(img_path, "logo.png"),
resizable=(False, False))
win.resize_object_add(icon)
icon.show()
@ -138,42 +111,29 @@ def icon_transparent_clicked(obj, item=None):
if __name__ == "__main__":
def destroy(obj):
elementary.exit()
elementary.init()
win = Window("test", elementary.ELM_WIN_BASIC)
win.title_set("python-elementary test application")
win.callback_delete_request_add(destroy)
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
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()
box0 = Box(win)
box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.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 = [("Icon", icon_clicked),
("Icon transparent", icon_transparent_clicked)]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -182,7 +142,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -1,24 +1,33 @@
#!/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.box import Box
from efl.elementary.box import Box, ELM_BOX_LAYOUT_FLOW_HORIZONTAL
from efl.elementary.button import Button
from efl.elementary.image import Image
from efl.elementary.image import Image, ELM_IMAGE_ROTATE_90, \
ELM_IMAGE_ROTATE_180, ELM_IMAGE_ROTATE_270, ELM_IMAGE_FLIP_HORIZONTAL, \
ELM_IMAGE_FLIP_VERTICAL, ELM_IMAGE_FLIP_TRANSPOSE, ELM_IMAGE_FLIP_TRANSVERSE
from efl.elementary.progressbar import Progressbar
from efl.elementary.separator import Separator
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")
orients = [
("Rotate 90", elementary.ELM_IMAGE_ROTATE_90),
("Rotate 180", elementary.ELM_IMAGE_ROTATE_180),
("Rotate 270", elementary.ELM_IMAGE_ROTATE_270),
("Flip Horizontal", elementary.ELM_IMAGE_FLIP_HORIZONTAL),
("Flip Vertical", elementary.ELM_IMAGE_FLIP_VERTICAL),
("Flip Transpose", elementary.ELM_IMAGE_FLIP_TRANSPOSE),
("Flip Tranverse", elementary.ELM_IMAGE_FLIP_TRANSVERSE),
("Rotate 90", ELM_IMAGE_ROTATE_90),
("Rotate 180", ELM_IMAGE_ROTATE_180),
("Rotate 270", ELM_IMAGE_ROTATE_270),
("Flip Horizontal", ELM_IMAGE_FLIP_HORIZONTAL),
("Flip Vertical", ELM_IMAGE_FLIP_VERTICAL),
("Flip Transpose", ELM_IMAGE_FLIP_TRANSPOSE),
("Flip Tranverse", ELM_IMAGE_FLIP_TRANSVERSE),
]
remote_url = "http://31.media.tumblr.com/29f1ecd4f98aaff73fb21f479b450d4c/tumblr_mqsxdciQmB1rrju89o1_1280.jpg"
@ -42,62 +51,49 @@ def _cb_im_download_error(im, info, pb):
pb.value = 1.0
def image_clicked(obj):
win = StandardWindow("image", "Image test")
win.autodel_set(True)
win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
vbox = Box(win)
vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
win.resize_object_add(vbox)
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.show()
im = Image(win)
im.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
im.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
im.file = 'images/logo.png'
im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
file=os.path.join(img_path, "logo.png"))
vbox.pack_end(im)
im.show()
sep = Separator(win)
sep.horizontal = True
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.layout = elementary.ELM_BOX_LAYOUT_FLOW_HORIZONTAL
hbox.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
size_hint_align=FILL_BOTH)
vbox.pack_end(hbox)
hbox.show()
for rot in orients:
b = Button(win)
b.text = rot[0]
b = Button(win, text=rot[0])
hbox.pack_end(b)
b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y))
b.show()
sep = Separator(win)
sep.horizontal = True
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.horizontal = True
hbox.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
vbox.pack_end(hbox)
hbox.show()
b = Button(win)
b.text = "Set remote URL"
b = Button(win, text="Set remote URL")
hbox.pack_end(b)
b.callback_clicked_add(lambda b: im.file_set(remote_url))
b.show()
pb = Progressbar(win)
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, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
hbox.pack_end(pb)
pb.show()
@ -106,7 +102,6 @@ def image_clicked(obj):
im.callback_download_progress_add(_cb_im_download_progress, pb)
im.callback_download_error_add(_cb_im_download_error, pb)
win.resize(320, 480)
win.show()

View File

@ -1,119 +1,96 @@
#!/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.check import Check
from efl.elementary.index import Index
from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass
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
def gl_text_get(gl, part, data):
return str(data)
def cb_idx_item(idx, item, gl_item):
print(("Current Index: %s" % (item.letter)))
gl_item.bring_in()
def cb_idx_changed(idx, item):
print(("changed event on: %s" % (item.letter)))
def cb_idx_delay_changed(idx, item):
print(("delay_changed event on: %s" % (item.letter)))
# BROKEN (see below)
# gl_item = item.data["gl_item"]
# gl_item.bring_in()
gl_item = item.data["gl_item"]
gl_item.bring_in()
def cb_idx_selected(idx, item):
print(("selected event on: %s" % (item.letter)))
def index_clicked(obj):
win = Window("index", elementary.ELM_WIN_BASIC)
win.title_set("Index test")
win.autodel_set(True)
win = StandardWindow("index", "Index 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()
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()
# index
idx = Index(win)
idx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
idx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
idx = Index(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
idx.callback_delay_changed_add(cb_idx_delay_changed)
idx.callback_changed_add(cb_idx_changed)
idx.callback_selected_add(cb_idx_selected)
win.resize_object_add(idx)
idx.show()
# genlist
itc = GenlistItemClass(item_style="default",
text_get_func=gl_text_get)
# content_get_func=gl_content_get,
# state_get_func=gl_state_get)
gl = Genlist(win)
gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
vbox.pack_end(gl)
gl.show()
for i in 'ABCDEFGHILMNOPQRSTUVZ':
for j in 'acegikmo':
gl_item = gl.item_append(itc, i + j)
if j == 'a':
idx_item = idx.item_append(i, cb_idx_item, gl_item)
# TODO This is broken (data assignment to ItemObject)
# ...for now just bringin on select
# idx_item.data["gl_item"] = gl_item
idx_item.data["gl_item"] = gl_item
idx.level_go(0)
sep = Separator(win)
sep.horizontal = True
sep = Separator(win, horizontal=True)
vbox.pack_end(sep)
sep.show()
hbox = Box(win)
hbox.horizontal = True
hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
vbox.pack_end(hbox)
hbox.show()
ck = Check(win)
ck.text = "autohide_disabled"
ck = Check(win, text="autohide_disabled")
ck.callback_changed_add(lambda ck: idx.autohide_disabled_set(ck.state))
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text = "indicator_disabled"
ck = Check(win, text="indicator_disabled")
ck.callback_changed_add(lambda ck: idx.indicator_disabled_set(ck.state))
hbox.pack_end(ck)
ck.show()
ck = Check(win)
ck.text = "horizontal"
ck = Check(win, text="horizontal")
ck.callback_changed_add(lambda ck: idx.horizontal_set(ck.state))
hbox.pack_end(ck)
ck.show()
win.resize(320, 480)
win.show()

View File

@ -3,24 +3,17 @@
from efl import evas
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.label import Label
from efl.elementary.innerwindow import InnerWindow
def inner_window_clicked(obj):
win = Window("inner-window", elementary.ELM_WIN_BASIC)
win.title_set("InnerWindow test")
win.autodel_set(True)
win = StandardWindow("inner-window", "InnerWindow 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()
lb = Label(win)
lb.text_set("This is an \"inwin\" - a window in a<br/>"
"window. This is handy for quick popups<br/>"
@ -28,8 +21,7 @@ def inner_window_clicked(obj):
"until dismissed somehow. Unlike hovers they<br/>"
"don't hover over their target.")
iw = InnerWindow(win)
iw.content_set(lb)
iw = InnerWindow(win, content=lb)
iw.show()
win.resize(320, 320)

View File

@ -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, 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.box import Box
from efl.elementary.grid import Grid
from efl.elementary.label import Label
from efl.elementary.label import Label, ELM_WRAP_CHAR, ELM_LABEL_SLIDE_MODE_AUTO
from efl.elementary.radio import Radio
from efl.elementary.separator import Separator
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_slide_radio(radio, lb):
lb.style = radio.text
@ -22,149 +25,109 @@ def cb_slider_duration(slider, lb):
lb.slide = True
def label_clicked(obj):
win = Window("label", elementary.ELM_WIN_BASIC)
win.title = "Label test"
win.autodel = True
win = StandardWindow("label", "Label test", autodel=True, size=(280, 400))
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()
lb = Label(win)
lb.text = "<b>This is a small label</b>"
lb.size_hint_align = (0.0, 0.5)
lb = Label(win, "<b>This is a small label</b>", size_hint_align=(0.0, 0.5))
vbox.pack_end(lb)
lb.show()
lb = Label(win)
lb = Label(win, size_hint_align=(0.0, 0.5))
lb.text = "This is a larger label with newlines<br/>" \
"to make it bigger, bit it won't expand or wrap<br/>" \
"just be a block of text that can't change its<br/>" \
"formatting as it's fixed based on text<br/>"
lb.size_hint_align = (0.0, 0.5)
vbox.pack_end(lb)
lb.show()
lb = Label(win)
lb.line_wrap_set(elementary.ELM_WRAP_CHAR)
lb = Label(win, line_wrap=ELM_WRAP_CHAR, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
lb.text = "<b>This is more text designed to line-wrap here as " \
"This object is resized horizontally. As it is " \
"resized vertically though, nothing should change. " \
"The amount of space allocated vertically should " \
"change as horizontal size changes.</b>"
lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
vbox.pack_end(lb)
lb.show()
lb = Label(win)
lb.text = "This small label set to wrap"
lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
lb = Label(win, text="This small label set to wrap",
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
vbox.pack_end(lb)
lb.show()
sp = Separator(win)
sp.horizontal = True
sp = Separator(win, horizontal=True)
vbox.pack_end(sp)
sp.show()
gd = Grid(win)
gd.size = (100, 100)
gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
gd.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
vbox.pack_end(gd)
gd.show()
lb = Label(win)
lb.text = "Test Label Ellipsis:"
lb.size_hint_align = (0.0, 0.5)
lb = Label(win, text="Test Label Ellipsis:", size_hint_align=(0.0, 0.5))
gd.pack(lb, 5, 5, 90, 15)
lb.show()
rect = evas.Rectangle(win.evas)
rect.color = (255, 125, 125, 255)
rect = Rectangle(win.evas, color=(255, 125, 125, 255))
gd.pack(rect, 5, 15, 90, 15)
rect.show()
lb = Label(win)
lb = Label(win, ellipsis=True, size_hint_align=(0.0, 0.5))
lb.text = "This is a label set to ellipsis. " \
"If set ellipsis to true and the text doesn't fit " \
"in the label an ellipsis(\"...\") will be shown " \
"at the end of the widget."
lb.ellipsis = True
lb.size_hint_align = (0.0, 0.5)
gd.pack(lb, 5, 15, 90, 15)
lb.show()
lb = Label(win)
lb.text = "Test Label Slide:"
lb.size_hint_align = (0.0, 0.5)
lb = Label(win, "Test Label Slide:", size_hint_align=(0.0, 0.5))
gd.pack(lb, 5, 40, 90, 15)
lb.show()
rect = evas.Rectangle(win.evas)
rect.color = (255, 125, 125, 255)
rect = Rectangle(win.evas, color=(255, 125, 125, 255))
gd.pack(rect, 5, 50, 90, 15)
rect.show()
lb = Label(win)
lb = Label(win, slide_mode=ELM_LABEL_SLIDE_MODE_AUTO, style="slide_short",
size_hint_align=(0.0, 0.5))
lb.text = "This is a label set to slide. " \
"If set slide to true the text of the label " \
"will slide/scroll through the length of label." \
"This only works with the themes \"slide_short\", " \
"\"slide_long\" and \"slide_bounce\"."
lb.slide_mode = elementary.ELM_LABEL_SLIDE_MODE_AUTO
lb.style = ("slide_short")
lb.size_hint_align = (0.0, 0.5)
gd.pack(lb, 5, 50, 90, 15)
lb.show()
rd = Radio(win)
rd.state_value = 1
rd.text = "slide_short"
rd = Radio(win, state_value=1, text="slide_short")
gd.pack(rd, 5, 65, 30, 15)
rd.callback_changed_add(cb_slide_radio, lb)
rd.show()
rdg = rd
rd = Radio(win)
rd = Radio(win, state_value=2, text="slide_long")
rd.group_add(rdg)
rd.state_value = 2
rd.text = "slide_long"
gd.pack(rd, 35, 65, 30, 15)
rd.callback_changed_add(cb_slide_radio, lb)
rd.show()
rd = Radio(win)
rd = Radio(win, state_value=3, text="slide_bounce")
rd.group_add(rdg)
rd.state_value = 3
rd.text = "slide_bounce"
gd.pack(rd, 65, 65, 30, 15)
rd.callback_changed_add(cb_slide_radio, lb)
rd.show()
sl = Slider(win)
sl.text = "Slide Duration"
sl.unit_format = "%1.1f units"
sl.min_max = (1, 20)
sl.value = 10
sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
sl = Slider(win, text="Slide Duration", unit_format="%1.1f units",
min_max=(1, 20), value=10, size_hint_align=FILL_HORIZ,
size_hint_weight=EXPAND_HORIZ)
sl.callback_changed_add(cb_slider_duration, lb)
gd.pack(sl, 5, 80, 90, 15)
sl.show()
win.resize(280, 400)
win.show()

View File

@ -1,50 +1,43 @@
#!/usr/bin/env python
# encoding: utf-8
from efl import evas
import os
from efl.evas import EVAS_HINT_EXPAND
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.layout import Layout
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
script_path = os.path.dirname(os.path.abspath(__file__))
def _event(*args, **kargs):
print((args, kargs))
def layout_clicked(obj):
win = Window("layout", elementary.ELM_WIN_BASIC)
win.title_set("Layout")
win = StandardWindow("layout", "Layout", autodel=True)
win.elm_event_callback_add(_event)
win.autodel_set(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()
ly = Layout(win)
ly.file_set("test.edj", "layout")
ly.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
ly = Layout(win, file=(os.path.join(script_path, "test.edj"), "layout"),
size_hint_weight=EXPAND_BOTH)
win.resize_object_add(ly)
ly.show()
bt = Button(win)
bt.text_set("Button 1")
bt = Button(win, text="Button 1")
ly.part_content_set("element1", bt)
bt.elm_event_callback_add(_event)
bt.elm_event_callback_del(_event)
bt.show()
bt = Button(win)
bt.text_set("Button 2")
bt = Button(win, text="Button 2")
ly.part_content_set("element2", bt)
bt.show()
bt = Button(win)
bt.text_set("Button 3")
bt = Button(win, text="Button 3")
ly.part_content_set("element3", bt)
bt.show()

View File

@ -1,81 +1,65 @@
#!/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, 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.frame import Frame
from efl.elementary.label import Label
from efl.elementary.list import List
from efl.elementary.list import List, ELM_LIST_LIMIT, ELM_LIST_COMPRESS
from efl.elementary.icon import Icon
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
ALIGN_CENTER = 0.5, 0.5
script_path = os.path.dirname(os.path.abspath(__file__))
img_path = os.path.join(script_path, "images")
def my_list_show_it(obj, it):
it.show()
def list_clicked(obj, item=None):
win = Window("list", elementary.ELM_WIN_BASIC)
win.title_set("List")
win.autodel_set(True)
win = StandardWindow("list", "List", autodel=True, size=(320, 320))
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
li = List(win)
li = List(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(li)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(1, 1)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(True, True))
it1 = li.item_append("Hello", ic)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False))
li.item_append("Hello", ic)
ic = Icon(win)
ic.standard_set("edit")
ic.resizable_set(0, 0)
ic2 = Icon(win)
ic2.standard_set("clock")
ic2.resizable_set(0, 0)
ic = Icon(win, standard="edit", resizable=(False, False))
ic2 = Icon(win, standard="clock", resizable=(False, False))
li.item_append(".", ic, ic2)
ic = Icon(win)
ic.standard_set("delete")
ic.resizable_set(0, 0)
ic2 = Icon(win)
ic2.standard_set("clock")
ic2.resizable_set(0, 0)
ic = Icon(win, standard="delete", resizable=(False, False))
ic2 = Icon(win, standard="clock", resizable=(False, False))
it2 = li.item_append("How", ic, ic2)
bx = Box(win)
bx.horizontal_set(True)
bx = Box(win, horizontal=True)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.5)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=ALIGN_CENTER)
bx.pack_end(ic)
ic.show()
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=(0.5, 0.0))
bx.pack_end(ic)
ic.show()
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=(0.0, EVAS_HINT_FILL))
bx.pack_end(ic)
ic.show()
li.item_append("are")
@ -98,53 +82,41 @@ def list_clicked(obj, item=None):
li.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("Hello")
bt = Button(win, text="Hello", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.5))
bt.callback_clicked_add(my_list_show_it, it1)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(0.9, 0.5)
tb2.pack(bt, 0, 0, 1, 1);
bt.show()
bt = Button(win)
bt.text_set("How")
bt = Button(win, text="How", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.5))
bt.callback_clicked_add(my_list_show_it, it2)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(0.9, 0.5)
tb2.pack(bt, 0, 1, 1, 1);
bt.show()
bt = Button(win)
bt.text_set("doing")
bt = Button(win, text="doing", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.5))
bt.callback_clicked_add(my_list_show_it, it3)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(0.9, 0.5)
tb2.pack(bt, 0, 2, 1, 1);
bt.show()
bt = Button(win)
bt.text_set("Here")
bt = Button(win, text="Here", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.5))
bt.callback_clicked_add(my_list_show_it, it4)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(0.9, 0.5)
tb2.pack(bt, 0, 3, 1, 1);
bt.show()
bt = Button(win)
bt.text_set("Maybe this...")
bt = Button(win, text="Maybe this...", size_hint_weight=EXPAND_BOTH,
size_hint_align=(0.9, 0.5))
bt.callback_clicked_add(my_list_show_it, it5)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bt.size_hint_align_set(0.9, 0.5)
tb2.pack(bt, 0, 4, 1, 1);
bt.show()
tb2.show()
win.resize(320, 320)
win.show()
@ -157,61 +129,43 @@ def my_list2_sel(obj, it):
it.selected_set(False)
def list2_clicked(obj, item=None):
win = Window("list-2", elementary.ELM_WIN_BASIC)
win.title_set("List 2")
win.autodel_set(True)
win = Window("list-2", ELM_WIN_BASIC, title="List 2",
autodel=True, size=(320, 320))
bg = Background(win)
bg.file_set('images/plant_01.jpg')
bg = Background(win, file=os.path.join(img_path, "plant_01.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()
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()
li = List(win)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.mode_set(elementary.ELM_LIST_LIMIT)
li = List(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH,
mode=ELM_LIST_LIMIT)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
it = li.item_append("Hello", ic, callback=my_list2_sel)
it.selected_set(True)
ic = Icon(win)
ic.resizable_set(0, 0)
ic.file_set('images/logo_small.png')
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False))
li.item_append("world", ic)
ic = Icon(win)
ic.standard_set("edit")
ic.resizable_set(0, 0)
ic = Icon(win, standard="edit", resizable=(False, False))
li.item_append(".", ic)
ic = Icon(win)
ic.standard_set("delete")
ic.resizable_set(0, 0)
ic2 = Icon(win)
ic2.standard_set("clock")
ic2.resizable_set(0, 0)
ic = Icon(win, standard="delete", resizable=(False, False))
ic2 = Icon(win, standard="clock", resizable=(False, False))
it2 = li.item_append("How", ic, ic2)
bx2 = Box(win)
bx2.horizontal_set(True)
bx2 = Box(win, horizontal=True)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.5)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=ALIGN_CENTER)
bx2.pack_end(ic)
ic.show()
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=(0.5, 0.0))
bx2.pack_end(ic)
ic.show()
@ -235,83 +189,54 @@ def list2_clicked(obj, item=None):
bx.pack_end(li)
li.show()
bx2 = Box(win)
bx2.horizontal_set(True)
bx2.homogeneous_set(True)
bx2.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bx2 = Box(win, horizontal=True, homogeneous=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
bt = Button(win)
bt.text_set("Clear")
bt = Button(win, text="Clear", size_hint_align=FILL_BOTH,
size_hint_weight=EXPAND_HORIZ)
bt.callback_clicked_add(my_list2_clear, li)
bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
bx2.pack_end(bt)
bt.show()
bx.pack_end(bx2)
bx2.show()
win.resize(320, 320)
win.show()
def list3_clicked(obj, item=None):
win = Window("list-3", elementary.ELM_WIN_BASIC)
win.title_set("List 3")
win.autodel_set(True)
win = StandardWindow("list-3", "List 3", autodel=True, size=(320, 300))
bg = Background(win)
win.resize_object_add(bg)
bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
bg.show()
li = List(win)
li = List(win, size_hint_weight=EXPAND_BOTH, mode=ELM_LIST_COMPRESS)
win.resize_object_add(li)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.mode_set(elementary.ELM_LIST_COMPRESS)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
li.item_append("Hello", ic)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False))
li.item_append("world", ic)
ic = Icon(win)
ic.standard_set("edit")
ic.resizable_set(0, 0)
ic = Icon(win, standard="edit", resizable=(False, False))
li.item_append(".", ic)
ic = Icon(win)
ic.standard_set("delete")
ic.resizable_set(0, 0)
ic2 = Icon(win)
ic2.standard_set("clock")
ic2.resizable_set(0, 0)
ic = Icon(win, standard="delete", resizable=(False, False))
ic2 = Icon(win, standard="clock", resizable=(False, False))
it2 = li.item_append("How", ic, ic2)
bx = Box(win)
bx = Box(win, horizontal=True)
bx.horizontal_set(True)
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.5)
ic = Icon(win, standard="delete", resizable=(False, False),
size_hint_align=ALIGN_CENTER)
bx.pack_end(ic)
ic.show()
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.5, 0.0)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=(0.5, 0.0))
bx.pack_end(ic)
ic.show()
ic = Icon(win)
ic.file_set('images/logo_small.png')
ic.resizable_set(0, 0)
ic.size_hint_align_set(0.0, evas.EVAS_HINT_EXPAND)
ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
resizable=(False, False), size_hint_align=(0.0, EVAS_HINT_FILL))
bx.pack_end(ic)
ic.show()
@ -331,51 +256,35 @@ def list3_clicked(obj, item=None):
it5 = li.item_append("Maybe this one is even longer so we can test long long items.")
li.go()
li.show()
win.resize(320, 300)
win.show()
if __name__ == "__main__":
def destroy(obj):
elementary.exit()
elementary.init()
win = Window("test", elementary.ELM_WIN_BASIC)
win.title_set("python-elementary test application")
win.callback_delete_request_add(destroy)
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
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()
box0 = Box(win)
box0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.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 = [("List", list_clicked),
("List 2", list2_clicked),
("List 3", list3_clicked)]
li = List(win)
li.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
li.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
@ -384,7 +293,6 @@ if __name__ == "__main__":
li.go()
win.resize(320,520)
win.show()
elementary.run()
elementary.shutdown()