kuuko pushed a commit to branch master.

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

commit e27e5e3f137531d62d5e0793f5d04f16a9fd49f4
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Sat Feb 21 17:51:33 2015 +0200

    Examples.elementary: Update fs_entry/btn tests
    
    to not use deprecated methods.
---
 examples/elementary/test_fileselector_button.py | 23 ++++++++++++++++++++---
 examples/elementary/test_fileselector_entry.py  | 20 ++++++++++++++++++--
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/examples/elementary/test_fileselector_button.py 
b/examples/elementary/test_fileselector_button.py
index 99cb192..dd50db0 100644
--- a/examples/elementary/test_fileselector_button.py
+++ b/examples/elementary/test_fileselector_button.py
@@ -1,12 +1,13 @@
 #!/usr/bin/env python
 # encoding: utf-8
 
-from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH
+from efl.evas import EXPAND_BOTH, FILL_BOTH
 from efl import elementary
 from efl.elementary.window import StandardWindow
 from efl.elementary.box import Box
 from efl.elementary.check import Check
 from efl.elementary.fileselector_button import FileselectorButton
+from efl.elementary.fileselector import Fileselector
 from efl.elementary.separator import Separator
 
 
@@ -14,27 +15,39 @@ def toggle_is_save(bt, fsb):
     print("Toggle is save")
     fsb.is_save = not fsb.is_save
 
+
 def toggle_inwin(bt, fsb):
     print("Toggle inwin mode")
     fsb.inwin_mode = not fsb.inwin_mode
 
+
 def toggle_folder_only(bt, fsb):
     print("Toggle folder_only")
     fsb.folder_only = not fsb.folder_only
 
+
 def toggle_expandable(bt, fsb):
     print("Toggle expandable")
     fsb.expandable = not fsb.expandable
 
+
+class FsButton(Fileselector, FileselectorButton):
+
+    def __init__(self, *args, **kwargs):
+        FileselectorButton.__init__(self, *args, **kwargs)
+
+
 def fileselector_button_clicked(obj, item=None):
-    win = StandardWindow("fileselector", "File selector test",
+    win = StandardWindow("fileselector", "File selector button test",
                          autodel=True, size=(240, 350))
+    if not obj:
+        win.callback_delete_request_add(lambda x: elementary.exit())
 
     vbox = Box(win, size_hint_weight=EXPAND_BOTH)
     win.resize_object_add(vbox)
     vbox.show()
 
-    fse = FileselectorButton(win, text="Select a file", inwin_mode=False,
+    fse = FsButton(win, text="Select a file", inwin_mode=False,
                              size_hint_align=FILL_BOTH,
                              size_hint_weight=EXPAND_BOTH)
     vbox.pack_end(fse)
@@ -74,6 +87,10 @@ def fileselector_button_clicked(obj, item=None):
 if __name__ == "__main__":
     elementary.init()
 
+    import logging
+    efl_log = logging.getLogger("efl")
+    efl_log.addHandler(logging.StreamHandler())
+
     fileselector_button_clicked(None)
 
     elementary.run()
diff --git a/examples/elementary/test_fileselector_entry.py 
b/examples/elementary/test_fileselector_entry.py
index 4c4b5db..8a09ae1 100644
--- a/examples/elementary/test_fileselector_entry.py
+++ b/examples/elementary/test_fileselector_entry.py
@@ -1,12 +1,13 @@
 #!/usr/bin/env python
 # encoding: utf-8
 
-from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH
+from efl.evas import EXPAND_BOTH, FILL_BOTH
 from efl import elementary
 from efl.elementary.window import StandardWindow
 from efl.elementary.box import Box
 from efl.elementary.check import Check
 from efl.elementary.fileselector_entry import FileselectorEntry
+from efl.elementary.fileselector import Fileselector
 from efl.elementary.separator import Separator
 
 
@@ -14,28 +15,39 @@ def toggle_is_save(bt, fse):
     print("Toggle is save")
     fse.is_save = not fse.is_save
 
+
 def toggle_inwin(bt, fse):
     print("Toggle inwin mode")
     fse.inwin_mode = not fse.inwin_mode
 
+
 def toggle_folder_only(bt, fse):
     print("Toggle folder_only")
     fse.folder_only = not fse.folder_only
 
+
 def toggle_expandable(bt, fse):
     print("Toggle expandable")
     fse.expandable = not fse.expandable
 
 
+class FsEntry(Fileselector, FileselectorEntry):
+
+    def __init__(self, *args, **kwargs):
+        FileselectorEntry.__init__(self, *args, **kwargs)
+
+
 def fileselector_entry_clicked(obj, item=None):
     win = StandardWindow("fileselector", "File selector test",
                          autodel=True, size=(240, 150))
+    if not obj:
+        win.callback_delete_request_add(lambda x: elementary.exit())
 
     vbox = Box(win, size_hint_weight=EXPAND_BOTH)
     win.resize_object_add(vbox)
     vbox.show()
 
-    fse = FileselectorEntry(win, text="Select a file", inwin_mode=False,
+    fse = FsEntry(win, text="Select a file", inwin_mode=False,
                             size_hint_align=FILL_BOTH,
                             size_hint_weight=EXPAND_BOTH)
     vbox.pack_end(fse)
@@ -75,6 +87,10 @@ def fileselector_entry_clicked(obj, item=None):
 if __name__ == "__main__":
     elementary.init()
 
+    import logging
+    efl_log = logging.getLogger("efl")
+    efl_log.addHandler(logging.StreamHandler())
+
     fileselector_entry_clicked(None)
 
     elementary.run()

-- 


Reply via email to