kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=4b95a88618f95afd0e654603b527c2688adee42b
commit 4b95a88618f95afd0e654603b527c2688adee42b Author: Kai Huuhko <[email protected]> Date: Mon Nov 25 21:31:07 2013 +0200 Elementary.entry: Clean up the utf8 <-> markup API --- efl/elementary/entry.pyx | 16 ++++++++++++++-- examples/elementary/test_input_events.py | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/efl/elementary/entry.pyx b/efl/elementary/entry.pyx index d421a14..2c7d61c 100644 --- a/efl/elementary/entry.pyx +++ b/efl/elementary/entry.pyx @@ -540,16 +540,28 @@ cdef void _entry_context_menu_callback(void *data, Evas_Object *obj, void *event except Exception as e: traceback.print_exc() +@DEPRECATED("1.8", "Use markup_to_utf8() instead.") def Entry_markup_to_utf8(string): if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string) return _touni(elm_entry_markup_to_utf8( <const_char *>string if string is not None else NULL)) +@DEPRECATED("1.8", "Use utf8_to_markup() instead.") def Entry_utf8_to_markup(string): if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string) return _touni(elm_entry_utf8_to_markup( <const_char *>string if string is not None else NULL)) +def markup_to_utf8(string): + if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string) + return _touni(elm_entry_markup_to_utf8( + <const_char *>string if string is not None else NULL)) + +def utf8_to_markup(string): + if isinstance(string, unicode): string = PyUnicode_AsUTF8String(string) + return _touni(elm_entry_utf8_to_markup( + <const_char *>string if string is not None else NULL)) + cdef class EntryContextMenuItem(object): """ @@ -1400,9 +1412,9 @@ cdef class Entry(Object): Py_INCREF(cb_data) elm_entry_markup_filter_remove(self.obj, py_elm_entry_filter_cb, <void *>cb_data) - markup_to_utf8 = staticmethod(Entry_markup_to_utf8) + markup_to_utf8 = staticmethod(DEPRECATED("1.8", "Use module level markup_to_utf8() instead.")(Entry_markup_to_utf8)) - utf8_to_markup = staticmethod(Entry_utf8_to_markup) + utf8_to_markup = staticmethod(DEPRECATED("1.8", "Use module level utf8_to_markup() instead.")(Entry_utf8_to_markup)) property file: """The file for the text to display and then edit. diff --git a/examples/elementary/test_input_events.py b/examples/elementary/test_input_events.py index 189e6fc..ab670da 100644 --- a/examples/elementary/test_input_events.py +++ b/examples/elementary/test_input_events.py @@ -5,7 +5,7 @@ from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL from efl import elementary from efl.elementary.box import Box from efl.elementary.button import Button -from efl.elementary.entry import Entry, Entry_utf8_to_markup +from efl.elementary.entry import Entry, utf8_to_markup from efl.elementary.object import EVAS_CALLBACK_KEY_UP from efl.elementary.window import StandardWindow @@ -17,7 +17,7 @@ def events_cb(obj, src, event_type, event, data): entry = data append = entry.entry_append - append(Entry_utf8_to_markup( + append(utf8_to_markup( "Obj: %r\n\nSrc: %r\n\nEvent: %s\n\n" % (obj, src, event) )) @@ -26,7 +26,7 @@ def events_cb(obj, src, event_type, event, data): if event_type == EVAS_CALLBACK_KEY_UP: append("Modifiers:<br>") - append(Entry_utf8_to_markup( + append(utf8_to_markup( "Control: %s Shift: %s Alt: %s" % ( event.modifier_is_set("Control"), event.modifier_is_set("Shift"), --
