aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-01-17 17:47:58 +0100
committerDave Andreoli <dave@gurumeditation.it>2015-01-17 17:47:58 +0100
commit28d1e6853eb46b1030078abd9cd5fcd21778a012 (patch)
tree23823388e616c4cfbf15c8fb45a5df8444a296ee /examples
parentNew 1.13 signal clicked,right for Gengrid and List (diff)
downloadpython-efl-28d1e6853eb46b1030078abd9cd5fcd21778a012.tar.gz
New 1.13 property elm.Table.align
And small improvements to the table test
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/elementary/test.py10
-rw-r--r--examples/elementary/test_table.py139
2 files changed, 82 insertions, 67 deletions
diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 46a110d..858b5b8 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -71,11 +71,11 @@ items = [
("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"),
+ ("Table Repack", "test_table", "table3_clicked"),
+ ("Table Repack 2", "test_table", "table4_clicked"),
+ ("Table Percent", "test_table", "table5_clicked"),
+ ("Table Multi", "test_table", "table6_clicked"),
+ ("Table Multi 2", "test_table", "table7_clicked"),
]),
("Cursors", [
("Cursor", "test_cursor", "cursor_clicked"),
diff --git a/examples/elementary/test_table.py b/examples/elementary/test_table.py
index 974202b..b4a8e67 100644
--- a/examples/elementary/test_table.py
+++ b/examples/elementary/test_table.py
@@ -14,6 +14,7 @@ from efl.elementary.label import Label
from efl.elementary.frame import Frame
+### Table
def table_clicked(obj, item=None):
win = StandardWindow("table", "Table", autodel=True)
@@ -22,37 +23,39 @@ def table_clicked(obj, item=None):
tb.show()
bt = Button(win, text="Button 1", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 2", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 3", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
bt = Button(win, text="Button 4", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 1, 2, 1)
bt.show()
bt = Button(win, text="Button 5", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 2, 1, 1, 3)
bt.show()
bt = Button(win, text="Button 6", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 0, 2, 2, 2)
bt.show()
win.show()
+
+### Table Homogeneous
def table2_clicked(obj, item=None):
win = StandardWindow("table2", "Table Homogeneous", autodel=True)
@@ -61,214 +64,226 @@ def table2_clicked(obj, item=None):
tb.show()
bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_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)
+ 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)
+ 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)
+ 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)
+ 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)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
-def my_tb_ch(obj, data):
- win = data
+
+### Table Repack
+def table3_cb1(obj, win):
tb = win.data["tb"]
b2 = win.data["b2"]
tb.unpack(b2)
tb.pack(b2, 1, 0, 1, 2)
+def table3_cb2(obj, win):
+ tb = win.data["tb"]
+ b2 = win.data["b2"]
+
+ tb.unpack(b2)
+ tb.pack(b2, 1, 0, 1, 1)
+
def table3_clicked(obj, item=None):
- win = StandardWindow("table3", "Table 3", autodel=True)
+ win = StandardWindow("table3", "Table Repack", 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)
+ bt = Button(win, text="Click me", 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.callback_clicked_add(table3_cb1, win)
bt.show()
- bt = Button(win, text="Button 2", size_hint_weight=EXPAND_BOTH,
- size_hint_align=FILL_BOTH)
+ bt = Button(win, text="Click me", 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.callback_clicked_add(table3_cb2, win)
bt.show()
- bt = Button(win, text="Button 3", size_hint_weight=EXPAND_HORIZ,
- size_hint_align=FILL_BOTH)
+ bt = Button(win, text="Button 3", disabled=True,
+ 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()
+
+### Table Repack 2
def table4_clicked(obj, item=None):
- win = StandardWindow("table4", "Table 4", autodel=True)
+ win = StandardWindow("table4", "Table Repack 2", 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)
+ bt = Button(win, text="Click me", 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.callback_clicked_add(table3_cb1, win)
bt.show()
- bt = Button(win, text="Button 2", size_hint_weight=(0.75, 0.25),
- size_hint_align=FILL_BOTH)
+ bt = Button(win, text="Click me", 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.callback_clicked_add(table3_cb2, win)
bt.show()
- bt = Button(win, text="Button 3", size_hint_weight=(0.25, 0.75),
- size_hint_align=FILL_BOTH)
+ bt = Button(win, text="Button 3", disabled=True,
+ 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()
+
+### Table Percent
def table5_clicked(obj, item=None):
- win = StandardWindow("table5", "Table 5", autodel=True)
+ win = StandardWindow("table5", "Table Percent", 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 33, 33, 34, 34)
bt.show()
win.show()
+
+### Table Multi
def table6_clicked(obj, item=None):
- win = StandardWindow("table6", "Table 6", autodel=True)
+ win = StandardWindow("table6", "Table Multi", 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
win.show()
+
+### Table Multi 2
def table7_clicked(obj, item=None):
- win = StandardWindow("table7", "Table 7", autodel=True)
+ win = StandardWindow("table7", "Table Multi 2", 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ 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)
+ size_hint_align=FILL_BOTH)
tb.pack(bt, 1, 7, 7, 2)
bt.show()
@@ -298,12 +313,12 @@ if __name__ == "__main__":
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),
- ]
+ ("Table Repack", table3_clicked),
+ ("Table Repack 2", table4_clicked),
+ ("Table Percent", table5_clicked),
+ ("Table Multi", table6_clicked),
+ ("Table Multi 2", table7_clicked),
+ ]
li = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box0.pack_end(li)