Elm: Update main test to be more like C test and add more table examples

This commit is contained in:
Kai Huuhko 2013-11-27 21:08:45 +02:00
parent 4dc1f2a412
commit cfd74a40e9
2 changed files with 290 additions and 18 deletions

View File

@ -60,10 +60,16 @@ items = [
("Box Vert2", "test_box", "box_vert2_clicked"),
("Box Layout", "test_box", "box_layout_clicked"),
("Box Layout Transition", "test_box", "box_transition_clicked"),
("Table", "test_table", "table_clicked"),
("Layout", "test_layout", "layout_clicked"),
("Grid", "test_grid", "grid_clicked"),
("Frame", "test_frame", "frame_clicked"),
("Grid", "test_grid", "grid_clicked"),
("Layout", "test_layout", "layout_clicked"),
("Table", "test_table", "table_clicked"),
("Table Homogeneous", "test_table", "table2_clicked"),
("Table 3", "test_table", "table3_clicked"),
("Table 4", "test_table", "table4_clicked"),
("Table 5", "test_table", "table5_clicked"),
("Table 6", "test_table", "table6_clicked"),
("Table 7", "test_table", "table7_clicked"),
]),
("Cursors", [
("Cursor", "test_cursor", "cursor_clicked"),
@ -125,9 +131,7 @@ items = [
("Gesture Layer", "test_gesture_layer", "gesture_layer_clicked"),
]),
("Lists", [
("List", "test_list", "list_clicked"),
("List 2", "test_list", "list2_clicked"),
("List 3", "test_list", "list3_clicked"),
("Gengrid", "test_gengrid", "gengrid_clicked"),
("Genlist", "test_genlist", "genlist_clicked"),
("Genlist 2", "test_genlist", "genlist2_clicked"),
("Genlist Group", "test_genlist", "genlist3_clicked"),
@ -135,13 +139,16 @@ items = [
("Genlist Iteration", "test_genlist", "genlist5_clicked"),
("Genlist Decorate Item Mode", "test_genlist", "genlist10_clicked"),
("Genlist Decorate All Mode", "test_genlist", "genlist15_clicked"),
("Gengrid", "test_gengrid", "gengrid_clicked"),
("List", "test_list", "list_clicked"),
("List 2", "test_list", "list2_clicked"),
("List 3", "test_list", "list3_clicked"),
]),
("Miscellaneous", [
# ("Accessibility", "test_access", "access_clicked"),
# ("Accessibility 2", "test_access", "access2_clicked"),
# ("Accessibility 3", "test_access", "access3_clicked"),
("Configuration", "test_config", "config_clicked"),
("Copy And Paste", "test_cnp", "cnp_clicked"),
("Floating Objects", "test_floating", "floating_clicked"),
("Themes", "test_theme", "theme_clicked"),
]),
@ -149,17 +156,17 @@ items = [
("Naviframe", "test_naviframe", "naviframe_clicked"),
]),
("Popups", [
("Ctxpopup", "test_ctxpopup", "ctxpopup_clicked"),
("Hover", "test_hover", "hover_clicked"),
("Hover 2", "test_hover", "hover2_clicked"),
("Notify", "test_notify", "notify_clicked"),
("Tooltip", "test_tooltip", "tooltip_clicked"),
("Ctxpopup", "test_ctxpopup", "ctxpopup_clicked"),
("Popup", "test_popup", "popup_clicked"),
("Tooltip", "test_tooltip", "tooltip_clicked"),
]),
("Range Values", [
("Spinner", "test_spinner", "spinner_clicked"),
("Progressbar", "test_progressbar", "progressbar_clicked"),
("Slider", "test_slider", "slider_clicked"),
("Spinner", "test_spinner", "spinner_clicked"),
]),
("Scroller", [
("Scroller", "test_scroller", "scroller_clicked"),
@ -169,10 +176,10 @@ items = [
("Color Selector", "test_colorselector", "colorselector_clicked"),
("Day Selector", "test_dayselector", "dayselector_clicked"),
("Disk Selector", "test_diskselector", "diskselector_clicked"),
("Flip Selector", "test_flipselector", "flipselector_clicked"),
("File Selector", "test_fileselector", "fileselector_clicked"),
("Fileselector button", "test_fileselector", "fileselector_button_clicked"),
("Fileselector entry", "test_fileselector", "fileselector_entry_clicked"),
("Flip Selector", "test_flipselector", "flipselector_clicked"),
("Hoversel", "test_hoversel", "hoversel_clicked"),
("Index", "test_index", "index_clicked"),
("Menu", "test_menu", "menu_clicked"),
@ -253,7 +260,7 @@ def cb_filter(en, win):
if __name__ == "__main__":
elementary.init()
win = StandardWindow("test", "python-elementary test application")
win = StandardWindow("test", "Python EFL test application")
win.callback_delete_request_add(destroy, "test1", "test2", str3="test3", str4="test4")
box0 = Box(win, size_hint_weight=EXPAND_BOTH)
@ -261,9 +268,10 @@ if __name__ == "__main__":
box0.show()
lb = Label(win)
lb.text = "Please select a test from the list below<br>" \
"by clicking the test button to show the<br>" \
"test window."
lb.text = (
"Please select a test from the list below by clicking<br>"
"the test button to show the test window."
)
lb.show()
fr = Frame(win, text="Information", content=lb)
@ -286,6 +294,7 @@ if __name__ == "__main__":
en = Entry(win, single_line=True, scrollable=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
en.part_text_set("guide", "Type widget name here to search.")
en.callback_changed_add(cb_filter, win)
bx1.pack_end(en)
en.show()
@ -303,7 +312,7 @@ if __name__ == "__main__":
menu_create(None, win)
win.resize(320, 480)
win.resize(480, 480)
win.show()
elementary.run()
elementary.shutdown()

View File

@ -7,11 +7,16 @@ from efl.elementary.window import StandardWindow
from efl.elementary.background import Background
from efl.elementary.button import Button
from efl.elementary.table import Table
from efl.elementary.box import Box
from efl.elementary.list import List
from efl.elementary.label import Label
from efl.elementary.frame import Frame
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0
FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
def table_clicked(obj):
def table_clicked(obj, item=None):
win = StandardWindow("table", "Table", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
@ -52,11 +57,269 @@ def table_clicked(obj):
win.show()
def table2_clicked(obj, item=None):
win = StandardWindow("table2", "Table Homogeneous", autodel=True)
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="Blah blah blah", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 3, 0, 2, 3)
bt.show()
bt = Button(win, text="Hallow", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 3, 10, 1)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 5, 2, 1)
bt.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 8, 8, 1, 1)
bt.show()
bt = Button(win, text="Wide", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
def my_tb_ch(obj, event_info, data):
win = data
tb = win.data["tb"]
b2 = win.data["b2"]
tb.unpack(b2)
tb.pack(b2, 1, 0, 1, 2)
def table3_clicked(obj, item=None):
win = StandardWindow("table3", "Table 3", autodel=True)
tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
win.data["tb"] = tb
tb.show()
bt = Button(win, text="Button 1", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
win.data["b1"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 2", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
win.data["b2"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 3", size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 1, 1)
win.data["b3"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
win.show()
def table4_clicked(obj, item=None):
win = StandardWindow("table4", "Table 4", autodel=True)
tb = Table(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
win.data["tb"] = tb
tb.show()
bt = Button(win, text="Button 1", size_hint_weight=(0.25, 0.25),
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
win.data["b1"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 2", size_hint_weight=(0.75, 0.25),
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
win.data["b2"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
bt = Button(win, text="Button 3", size_hint_weight=(0.25, 0.75),
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 1, 1)
win.data["b3"] = bt
bt.callback_clicked_add(my_tb_ch, win)
bt.show()
win.show()
def table5_clicked(obj, item=None):
win = StandardWindow("table5", "Table 5", autodel=True)
tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 0, 34, 33)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 67, 33, 33, 34)
bt.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 67, 34, 33)
bt.show()
bt = Button(win, text="D", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 33, 33, 34)
bt.show()
bt = Button(win, text="X", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 33, 34, 34)
bt.show()
win.show()
def table6_clicked(obj, item=None):
win = StandardWindow("table6", "Table 6", autodel=True)
tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="Blah blah blah", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 3, 0, 2, 3)
bt.show()
bt = Button(win, text="Hallow", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 3, 10, 1)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 1, 1)
bt.show()
bt = Button(win, text="Wide", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
def table7_clicked(obj, item=None):
win = StandardWindow("table7", "Table 7", autodel=True)
tb = Table(win, padding=(10, 20), size_hint_weight=EXPAND_BOTH)
win.resize_object_add(tb)
tb.show()
bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 2, 2)
bt.show()
bt = Button(win, text="Blah blah blah", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 3, 0, 2, 3)
bt.show()
bt = Button(win, text="Hallow", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 3, 10, 1)
bt.show()
bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 1, 1, 1)
bt.show()
bt = Button(win, text="Wide", size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
if __name__ == "__main__":
elementary.init()
win = StandardWindow("test", "python-elementary test application",
size=(320,520))
win.callback_delete_request_add(lambda o: elementary.exit())
table_clicked(None)
box0 = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(box0)
box0.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.")
lb.show()
fr = Frame(win, text="Information", content=lb)
box0.pack_end(fr)
fr.show()
items = [
("Table", table_clicked),
("Table Homogeneous", table2_clicked),
("Table 3", table3_clicked),
("Table 4", table4_clicked),
("Table 5", table5_clicked),
("Table 6", table6_clicked),
("Table 7", table7_clicked),
]
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)
li.show()
for item in items:
li.item_append(item[0], callback=item[1])
li.go()
win.show()
elementary.run()
elementary.shutdown()