kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=23d221ef8a65980bc0ce31e9a17754da7b9973d4
commit 23d221ef8a65980bc0ce31e9a17754da7b9973d4 Author: Kai Huuhko <[email protected]> Date: Sat Jan 25 03:53:57 2014 +0200 Elementary: Follow changes wrt. fileselector interface --- efl/elementary/fileselector_button.pxd | 11 -- efl/elementary/fileselector_button.pyx | 159 +++++++++++++++------------- efl/elementary/fileselector_entry.pxd | 12 --- efl/elementary/fileselector_entry.pyx | 185 ++++++++++++++++++--------------- 4 files changed, 186 insertions(+), 181 deletions(-) diff --git a/efl/elementary/fileselector_button.pxd b/efl/elementary/fileselector_button.pxd index 4dab058..6506f7c 100644 --- a/efl/elementary/fileselector_button.pxd +++ b/efl/elementary/fileselector_button.pxd @@ -1,6 +1,4 @@ from efl.evas cimport Eina_Bool, Evas_Object, Evas_Coord -from button cimport Button -from enums cimport Elm_Fileselector_Mode from libc.string cimport const_char cdef extern from "Elementary.h": @@ -9,14 +7,5 @@ cdef extern from "Elementary.h": const_char * elm_fileselector_button_window_title_get(Evas_Object *obj) void elm_fileselector_button_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height) void elm_fileselector_button_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) - void elm_fileselector_button_folder_only_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_button_folder_only_get(Evas_Object *obj) void elm_fileselector_button_inwin_mode_set(Evas_Object *obj, Eina_Bool value) Eina_Bool elm_fileselector_button_inwin_mode_get(Evas_Object *obj) - void elm_fileselector_button_is_save_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_button_is_save_get(Evas_Object *obj) - void elm_fileselector_button_path_set(Evas_Object *obj, const_char *path) - const_char * elm_fileselector_button_path_get(Evas_Object *obj) - void elm_fileselector_button_expandable_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_button_expandable_get(Evas_Object *obj) - diff --git a/efl/elementary/fileselector_button.pyx b/efl/elementary/fileselector_button.pyx index cafdde1..5ae8d36 100644 --- a/efl/elementary/fileselector_button.pyx +++ b/efl/elementary/fileselector_button.pyx @@ -58,6 +58,19 @@ for are: - ``icon`` - Icon of the fileselector_button +Fileselector Interface +====================== + +This widget supports the fileselector interface. + +If you wish to control the fileselector part using these functions, +inherit both the widget class and the +:py:class:`~efl.elementary.fileselector.Fileselector` class +using multiple inheritance, for example:: + + class CustomFileselectorButton(Fileselector, FileselectorButton): + def __init__(self, canvas, *args, **kwargs): + FileselectorButton.__init__(self, canvas) """ @@ -68,6 +81,15 @@ from efl.eo cimport _object_mapping_register from efl.utils.conversions cimport _ctouni from efl.evas cimport Object as evasObject +from button cimport Button + +from efl.utils.deprecated cimport DEPRECATED +from fileselector cimport elm_fileselector_path_set, \ + elm_fileselector_path_get, elm_fileselector_expandable_set, \ + elm_fileselector_expandable_get, elm_fileselector_folder_only_set, \ + elm_fileselector_folder_only_get, elm_fileselector_is_save_set, \ + elm_fileselector_is_save_get + cimport enums def _cb_string_conv(uintptr_t addr): @@ -138,129 +160,120 @@ cdef class FileselectorButton(Button): elm_fileselector_button_window_size_get(self.obj, &w, &h) return (w, h) + property inwin_mode: + """Whether a given file selector button widget's internal file + selector will raise an Elementary "inner window", instead of a + dedicated Elementary window. By default, it won't. + + .. seealso:: + :py:class:`~efl.elementary.innerwindow.InnerWindow` for more + information on inner windows + + :type: bool + + """ + def __get__(self): + return bool(elm_fileselector_button_inwin_mode_get(self.obj)) + + def __set__(self, inwin_mode): + elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode) + + def inwin_mode_set(self, inwin_mode): + elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode) + def inwin_mode_get(self): + return bool(elm_fileselector_button_inwin_mode_get(self.obj)) + + property path: - """The initial file system path for a given file selector - button widget + """ - It must be a **directory** path, which will have the contents - displayed initially in the file selector's view. The default initial - path is the ``"HOME"`` environment variable's value. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.path` - :type: string + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return _ctouni(elm_fileselector_button_path_get(self.obj)) + return self.path_get() def __set__(self, path): - if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_button_path_set(self.obj, - <const_char *>path if path is not None else NULL) + self.path_set(path) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def path_set(self, path): if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_button_path_set(self.obj, + elm_fileselector_path_set(self.obj, <const_char *>path if path is not None else NULL) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def path_get(self): - return _ctouni(elm_fileselector_button_path_get(self.obj)) + return _ctouni(elm_fileselector_path_get(self.obj)) property expandable: - """Enable/disable a tree view in the given file selector button - widget's internal file selector - - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.expandable`, - but now applied to a file selector button's internal file - selector. + """ - .. note:: There's no way to put a file selector button's internal - file selector in "grid mode", as one may do with "pure" file - selectors. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.expandable` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_button_expandable_get(self.obj)) + return self.expandable_get() def __set__(self, expand): - elm_fileselector_button_expandable_set(self.obj, expand) + self.expandable_set(expand) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def expandable_set(self, expand): - elm_fileselector_button_expandable_set(self.obj, expand) + elm_fileselector_expandable_set(self.obj, expand) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def expandable_get(self): - return bool(elm_fileselector_button_expandable_get(self.obj)) + return bool(elm_fileselector_expandable_get(self.obj)) property folder_only: - """Whether a given file selector button widget's internal file - selector is to display folders only or the directory contents, - as well. + """ - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.folder_only`, - but now applied to a file selector button's internal file - selector. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.folder_only` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_button_folder_only_get(self.obj)) + return self.folder_only_get() def __set__(self, folder_only): - elm_fileselector_button_folder_only_set(self.obj, folder_only) + self.folder_only_set(folder_only) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def folder_only_set(self, folder_only): - elm_fileselector_button_folder_only_set(self.obj, folder_only) + elm_fileselector_folder_only_set(self.obj, folder_only) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def folder_only_get(self): - return bool(elm_fileselector_button_folder_only_get(self.obj)) + return bool(elm_fileselector_folder_only_get(self.obj)) property is_save: - """Enable/disable the file name entry box where the user can type - in a name for a file, in a given file selector button widget's - internal file selector. + """ - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.is_save`, - but now applied to a file selector button's internal file - selector. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.is_save` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_button_is_save_get(self.obj)) + return self.is_save_get() def __set__(self, is_save): - elm_fileselector_button_is_save_set(self.obj, is_save) + self.is_save_set(is_save) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def is_save_set(self, is_save): - elm_fileselector_button_is_save_set(self.obj, is_save) + elm_fileselector_is_save_set(self.obj, is_save) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def is_save_get(self): - return bool(elm_fileselector_button_is_save_get(self.obj)) - - property inwin_mode: - """Whether a given file selector button widget's internal file - selector will raise an Elementary "inner window", instead of a - dedicated Elementary window. By default, it won't. - - .. seealso:: - :py:class:`~efl.elementary.innerwindow.InnerWindow` for more - information on inner windows - - :type: bool - - """ - def __get__(self): - return bool(elm_fileselector_button_inwin_mode_get(self.obj)) + return bool(elm_fileselector_is_save_get(self.obj)) - def __set__(self, inwin_mode): - elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode) - - def inwin_mode_set(self, inwin_mode): - elm_fileselector_button_inwin_mode_set(self.obj, inwin_mode) - def inwin_mode_get(self): - return bool(elm_fileselector_button_inwin_mode_get(self.obj)) def callback_file_chosen_add(self, func, *args, **kwargs): """The user has selected a path which comes as the ``event_info`` diff --git a/efl/elementary/fileselector_entry.pxd b/efl/elementary/fileselector_entry.pxd index 3eba3f7..8a93564 100644 --- a/efl/elementary/fileselector_entry.pxd +++ b/efl/elementary/fileselector_entry.pxd @@ -1,5 +1,4 @@ from efl.evas cimport Eina_Bool, Evas_Object, Evas_Coord -from enums cimport Elm_Fileselector_Mode from libc.string cimport const_char cdef extern from "Elementary.h": @@ -8,16 +7,5 @@ cdef extern from "Elementary.h": const_char * elm_fileselector_entry_window_title_get(Evas_Object *obj) void elm_fileselector_entry_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height) void elm_fileselector_entry_window_size_get(Evas_Object *obj, Evas_Coord *width, Evas_Coord *height) - void elm_fileselector_entry_path_set(Evas_Object *obj, const_char *path) - const_char * elm_fileselector_entry_path_get(Evas_Object *obj) - void elm_fileselector_entry_expandable_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_entry_expandable_get(Evas_Object *obj) - void elm_fileselector_entry_folder_only_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_entry_folder_only_get(Evas_Object *obj) - void elm_fileselector_entry_is_save_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_entry_is_save_get(Evas_Object *obj) void elm_fileselector_entry_inwin_mode_set(Evas_Object *obj, Eina_Bool value) Eina_Bool elm_fileselector_entry_inwin_mode_get(Evas_Object *obj) - void elm_fileselector_entry_selected_set(Evas_Object *obj, const_char *path) - const_char * elm_fileselector_entry_selected_get(Evas_Object *obj) - diff --git a/efl/elementary/fileselector_entry.pyx b/efl/elementary/fileselector_entry.pyx index 1cfcea9..f484e78 100644 --- a/efl/elementary/fileselector_entry.pyx +++ b/efl/elementary/fileselector_entry.pyx @@ -74,6 +74,19 @@ are: - ``button icon`` - Button icon of the fileselector_entry +Fileselector Interface +====================== + +This widget supports the fileselector interface. + +If you wish to control the fileselector part using these functions, +inherit both the widget class and the +:py:class:`~efl.elementary.fileselector.Fileselector` class +using multiple inheritance, for example:: + + class CustomFileselectorButton(Fileselector, FileselectorButton): + def __init__(self, canvas, *args, **kwargs): + FileselectorButton.__init__(self, canvas) """ @@ -85,6 +98,14 @@ from efl.utils.conversions cimport _ctouni from efl.evas cimport Object as evasObject from layout_class cimport LayoutClass +from efl.utils.deprecated cimport DEPRECATED +from fileselector cimport elm_fileselector_path_set, \ + elm_fileselector_path_get, elm_fileselector_expandable_set, \ + elm_fileselector_expandable_get, elm_fileselector_folder_only_set, \ + elm_fileselector_folder_only_get, elm_fileselector_is_save_set, \ + elm_fileselector_is_save_get, elm_fileselector_selected_set, \ + elm_fileselector_selected_get + cimport enums def _cb_string_conv(uintptr_t addr): @@ -160,155 +181,143 @@ cdef class FileselectorEntry(LayoutClass): elm_fileselector_entry_window_size_get(self.obj, &w, &h) return (w, h) + property inwin_mode: + """Whether a given file selector entry widget's internal file + selector will raise an Elementary "inner window", instead of a + dedicated Elementary window. By default, it won't. + + .. seealso:: + :py:class:`~efl.elementary.innerwindow.InnerWindow` for more + information on inner windows + + :type: bool + + """ + def __get__(self): + return bool(elm_fileselector_entry_inwin_mode_get(self.obj)) + + def __set__(self, inwin_mode): + elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode) + + def inwin_mode_set(self, inwin_mode): + elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode) + def inwin_mode_get(self): + return bool(elm_fileselector_entry_inwin_mode_get(self.obj)) + + property path: - """The initial file system path and the entry's path string for - a given file selector entry widget + """ - It must be a **directory** path, which will have the contents - displayed initially in the file selector's view. The default initial - path is the ``"HOME"`` environment variable's value. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.path` - :type: string + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return _ctouni(elm_fileselector_entry_path_get(self.obj)) + return self.path_get() def __set__(self, path): - if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_entry_path_set(self.obj, - <const_char *>path if path is not None else NULL) + self.path_set(path) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def path_set(self, path): if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_entry_path_set(self.obj, + elm_fileselector_path_set(self.obj, <const_char *>path if path is not None else NULL) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def path_get(self): - return _ctouni(elm_fileselector_entry_path_get(self.obj)) + return _ctouni(elm_fileselector_path_get(self.obj)) property expandable: - """Enable/disable a tree view in the given file selector entry - widget's internal file selector - - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.expandable`, - but now applied to a file selector entry's internal file - selector. + """ - .. note:: There's no way to put a file selector entry's internal - file selector in "grid mode", as one may do with "pure" file - selectors. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.expandable` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_entry_expandable_get(self.obj)) + return self.expandable_get() def __set__(self, expand): - elm_fileselector_entry_expandable_set(self.obj, expand) + self.expandable_set(expand) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def expandable_set(self, expand): - elm_fileselector_entry_expandable_set(self.obj, expand) + elm_fileselector_expandable_set(self.obj, expand) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def expandable_get(self): - return bool(elm_fileselector_entry_expandable_get(self.obj)) + return bool(elm_fileselector_expandable_get(self.obj)) property folder_only: - """Whether a given file selector entry widget's internal file - selector is to display folders only or the directory contents, - as well. + """ - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.folder_only`, - but now applied to a file selector entry's internal file - selector. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.folder_only` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_entry_folder_only_get(self.obj)) + return self.folder_only_get() def __set__(self, folder_only): - elm_fileselector_entry_folder_only_set(self.obj, folder_only) + self.folder_only_set(folder_only) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def folder_only_set(self, folder_only): - elm_fileselector_entry_folder_only_set(self.obj, folder_only) + elm_fileselector_folder_only_set(self.obj, folder_only) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def folder_only_get(self): - return bool(elm_fileselector_entry_folder_only_get(self.obj)) + return bool(elm_fileselector_folder_only_get(self.obj)) property is_save: - """Enable/disable the file name entry box where the user can type - in a name for a file, in a given file selector entry widget's - internal file selector. + """ - This has the same effect as - :py:attr:`efl.elementary.fileselector.Fileselector.is_save`, - but now applied to a file selector entry's internal file - selector. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.is_save` - :type: bool + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return bool(elm_fileselector_entry_is_save_get(self.obj)) + return self.is_save_get() def __set__(self, is_save): - elm_fileselector_entry_is_save_set(self.obj, is_save) + self.is_save_set(is_save) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def is_save_set(self, is_save): - elm_fileselector_entry_is_save_set(self.obj, is_save) + elm_fileselector_is_save_set(self.obj, is_save) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def is_save_get(self): - return bool(elm_fileselector_entry_is_save_get(self.obj)) - - property inwin_mode: - """Whether a given file selector entry widget's internal file - selector will raise an Elementary "inner window", instead of a - dedicated Elementary window. By default, it won't. - - .. seealso:: - :py:class:`~efl.elementary.innerwindow.InnerWindow` for more - information on inner windows - - :type: bool - - """ - def __get__(self): - return bool(elm_fileselector_entry_inwin_mode_get(self.obj)) - - def __set__(self, inwin_mode): - elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode) - - def inwin_mode_set(self, inwin_mode): - elm_fileselector_entry_inwin_mode_set(self.obj, inwin_mode) - def inwin_mode_get(self): - return bool(elm_fileselector_entry_inwin_mode_get(self.obj)) + return bool(elm_fileselector_is_save_get(self.obj)) property selected: - """The initial file system path for a given file selector entry - widget + """ - It must be a **directory** path, which will have the contents - displayed initially in the file selector's view. The default initial - path is the ``"HOME"`` environment variable's value. + :see: :py:attr:`~efl.elementary.fileselector.Fileselector.selected` - :type: string + .. deprecated:: 1.9 + Combine with Fileselector class instead """ def __get__(self): - return _ctouni(elm_fileselector_entry_selected_get(self.obj)) + return _ctouni(elm_fileselector_selected_get(self.obj)) def __set__(self, path): if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_entry_selected_set(self.obj, + elm_fileselector_selected_set(self.obj, <const_char *>path if path is not None else NULL) def selected_set(self, path): if isinstance(path, unicode): path = PyUnicode_AsUTF8String(path) - elm_fileselector_entry_selected_set(self.obj, + elm_fileselector_selected_set(self.obj, <const_char *>path if path is not None else NULL) def selected_get(self): - return _ctouni(elm_fileselector_entry_selected_get(self.obj)) + return _ctouni(elm_fileselector_selected_get(self.obj)) def callback_changed_add(self, func, *args, **kwargs): """The text within the entry was changed.""" @@ -317,10 +326,16 @@ cdef class FileselectorEntry(LayoutClass): def callback_changed_del(self, func): self._callback_del("changed", func) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def callback_activated_add(self, func, *args, **kwargs): - """The entry has had editing finished and changes are to be committed.""" + """callback_activated_add(func) + + :see: :py:meth:`~efl.elementary.fileselector.Fileselector.callback_activated_add` + + """ self._callback_add("activated", func, *args, **kwargs) + @DEPRECATED("1.9", "Combine with Fileselector class instead") def callback_activated_del(self, func): self._callback_del("activated", func) --
