kuuko pushed a commit to branch master.

http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=44ea5ef0867a63d005928fcdf414d75e70fe8b8f

commit 44ea5ef0867a63d005928fcdf414d75e70fe8b8f
Author: Kai Huuhko <[email protected]>
Date:   Wed Nov 27 23:08:34 2013 +0200

    Elementary: Fix issues in examples, including segfault in config example
    
    It seems socket image windows size and pos should not by manipulated
    before calling socket_listen().
    
    Removed several remaining uses of enums from package namespace.
---
 examples/elementary/test_config.py   |  6 ++++--
 examples/elementary/test_cursor.py   | 13 ++++++++++---
 examples/elementary/test_genlist.py  |  7 ++++---
 examples/elementary/test_photocam.py |  4 ++--
 examples/elementary/test_table.py    |  6 +-----
 5 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/examples/elementary/test_config.py 
b/examples/elementary/test_config.py
index d6030e2..382a400 100644
--- a/examples/elementary/test_config.py
+++ b/examples/elementary/test_config.py
@@ -197,8 +197,7 @@ def inlined_add(parent):
     return win
 
 def socket_add(name):
-    win = Window("socket image", ELM_WIN_SOCKET_IMAGE, pos=(0, 0),
-        size=(150, 200))
+    win = Window("socket image", ELM_WIN_SOCKET_IMAGE)
 
     try:
         win.socket_listen(name, 0, False)
@@ -226,6 +225,9 @@ def socket_add(name):
 
         inlined_add(win)
 
+        win.move(0, 0)
+        win.resize(150, 200)
+
         win.callback_profile_changed_add(win_profile_changed_cb)
         win.show()
         return win
diff --git a/examples/elementary/test_cursor.py 
b/examples/elementary/test_cursor.py
index b6d8058..2471d45 100644
--- a/examples/elementary/test_cursor.py
+++ b/examples/elementary/test_cursor.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 # encoding: utf-8
 
+import os
 
 from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
 from efl import elementary
@@ -13,12 +14,16 @@ from efl.elementary.frame import Frame
 from efl.elementary.clock import Clock
 from efl.elementary.entry import Entry
 from efl.elementary.toolbar import Toolbar
+from efl.elementary.theme import Theme
+from efl.elementary.configuration import Configuration
 
 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__))
+
 def cursor_clicked(obj, item=None):
     win = StandardWindow("cursors", "Cursors", autodel=True, size=(320,480))
     win.autodel_set(True)
@@ -92,7 +97,9 @@ def cursor2_clicked(obj, item=None):
 def cursor3_clicked(obj, item=None):
     win = StandardWindow("cursors", "Cursors 3", autodel=True, size=(320, 480))
 
-    elementary.theme_extension_add("./cursors.edj")
+    conf = Configuration()
+
+    Theme.default_get().extension_add(os.path.join(script_path, "cursors.edj"))
 
     bx = Box(win, size_hint_weight=EXPAND_BOTH)
     win.resize_object_add(bx)
@@ -127,13 +134,13 @@ def cursor3_clicked(obj, item=None):
     bx.pack_end(bt)
     bt.show()
 
-    elementary.cursor_engine_only_set(False)
+    conf.cursor_engine_only = False
 
     bt = Button(win, text="hand 2 engine only config false", cursor="hand2")
     bx.pack_end(bt)
     bt.show()
 
-    elementary.cursor_engine_only_set(True)
+    conf.cursor_engine_only = True
 
     bt = Button(win, text="hand 2 engine only config true", cursor="hand2")
     bx.pack_end(bt)
diff --git a/examples/elementary/test_genlist.py 
b/examples/elementary/test_genlist.py
index 8fa17fb..780922a 100644
--- a/examples/elementary/test_genlist.py
+++ b/examples/elementary/test_genlist.py
@@ -21,7 +21,8 @@ from efl.elementary.list import List
 from efl.elementary.icon import Icon
 from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass, \
     ELM_GENLIST_ITEM_NONE, ELM_OBJECT_SELECT_MODE_ALWAYS, \
-    ELM_OBJECT_SELECT_MODE_DEFAULT
+    ELM_OBJECT_SELECT_MODE_DEFAULT, ELM_GENLIST_ITEM_GROUP, \
+    ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY
 from efl.elementary.general import cache_all_flush
 from efl.elementary.radio import Radio
 from efl.elementary.check import Check
@@ -372,8 +373,8 @@ def genlist3_clicked(obj, item=None):
     for i in range(300):
         if i % 10 == 0:
             git = gl.item_append(itc_g, i/10,
-                                 flags=elementary.ELM_GENLIST_ITEM_GROUP)
-            git.select_mode_set(elementary.ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
+                                 flags=ELM_GENLIST_ITEM_GROUP)
+            git.select_mode_set(ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
         gl.item_append(itc_i, i, git)
 
     win.show()
diff --git a/examples/elementary/test_photocam.py 
b/examples/elementary/test_photocam.py
index 0dc0f5f..16b0361 100644
--- a/examples/elementary/test_photocam.py
+++ b/examples/elementary/test_photocam.py
@@ -98,7 +98,7 @@ def photocam_clicked(obj):
     # Fit btn
     bt = Button(win, text="Fit", size_hint_weight=EXPAND_BOTH,
         size_hint_align=(0.1, 0.9))
-    bt.callback_clicked_add(lambda b: 
pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT))
+    bt.callback_clicked_add(lambda b: 
pc.zoom_mode_set(ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT))
     tb.pack(bt, 0, 2, 1, 1)
     bt.show()
 
@@ -117,7 +117,7 @@ def photocam_clicked(obj):
     # Fill btn
     bt = Button(win, text="Fill", size_hint_weight=EXPAND_BOTH,
         size_hint_align=(0.9, 0.9))
-    bt.callback_clicked_add(lambda b: 
pc.zoom_mode_set(elementary.ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL))
+    bt.callback_clicked_add(lambda b: 
pc.zoom_mode_set(ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL))
     tb.pack(bt, 2, 2, 1, 1)
     bt.show()
 
diff --git a/examples/elementary/test_table.py 
b/examples/elementary/test_table.py
index 23a86e0..86f7ff2 100644
--- a/examples/elementary/test_table.py
+++ b/examples/elementary/test_table.py
@@ -18,8 +18,6 @@ FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL
 
 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())
 
     tb = Table(win, size_hint_weight=EXPAND_BOTH)
     win.resize_object_add(tb)
@@ -59,8 +57,6 @@ def table_clicked(obj, item=None):
 
 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)
@@ -98,7 +94,7 @@ def table2_clicked(obj, item=None):
 
     win.show()
 
-def my_tb_ch(obj, event_info, data):
+def my_tb_ch(obj, data):
     win = data
     tb = win.data["tb"]
     b2 = win.data["b2"]

-- 


Reply via email to