kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=1e0868376330bb072944a4dbb4cfcf0da2d45bc1
commit 1e0868376330bb072944a4dbb4cfcf0da2d45bc1 Author: Kai Huuhko <kai.huu...@gmail.com> Date: Fri Nov 29 02:20:12 2013 +0200 Elementary.fileselector: Add missing bits, fix doc issues. --- efl/elementary/fileselector.pxd | 24 ++++--- efl/elementary/fileselector.pyx | 138 ++++++++++++++++++++++++++++++++-------- 2 files changed, 126 insertions(+), 36 deletions(-) diff --git a/efl/elementary/fileselector.pxd b/efl/elementary/fileselector.pxd index d35b390..0adb20c 100644 --- a/efl/elementary/fileselector.pxd +++ b/efl/elementary/fileselector.pxd @@ -1,22 +1,28 @@ -from efl.evas cimport Eina_Bool, Evas_Object +from efl.eina cimport Eina_Bool, const_Eina_List +from efl.evas cimport Evas_Object, const_Evas_Object from enums cimport Elm_Fileselector_Mode from libc.string cimport const_char cdef extern from "Elementary.h": Evas_Object * elm_fileselector_add(Evas_Object *parent) void elm_fileselector_is_save_set(Evas_Object *obj, Eina_Bool is_save) - Eina_Bool elm_fileselector_is_save_get(Evas_Object *obj) + Eina_Bool elm_fileselector_is_save_get(const_Evas_Object *obj) void elm_fileselector_folder_only_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_folder_only_get(Evas_Object *obj) + Eina_Bool elm_fileselector_folder_only_get(const_Evas_Object *obj) void elm_fileselector_buttons_ok_cancel_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_buttons_ok_cancel_get(Evas_Object *obj) + Eina_Bool elm_fileselector_buttons_ok_cancel_get(const_Evas_Object *obj) void elm_fileselector_expandable_set(Evas_Object *obj, Eina_Bool value) - Eina_Bool elm_fileselector_expandable_get(Evas_Object *obj) + Eina_Bool elm_fileselector_expandable_get(const_Evas_Object *obj) void elm_fileselector_path_set(Evas_Object *obj, const_char *path) - const_char * elm_fileselector_path_get(Evas_Object *obj) - Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const_char *path) - const_char * elm_fileselector_selected_get(Evas_Object *obj) + const_char * elm_fileselector_path_get(const_Evas_Object *obj) void elm_fileselector_mode_set(Evas_Object *obj, Elm_Fileselector_Mode mode) - Elm_Fileselector_Mode elm_fileselector_mode_get(Evas_Object *obj) + Elm_Fileselector_Mode elm_fileselector_mode_get(const_Evas_Object *obj) + void elm_fileselector_multi_select_set(Evas_Object *obj, Eina_Bool multi) + Eina_Bool elm_fileselector_multi_select_get(const_Evas_Object *obj) + Eina_Bool elm_fileselector_selected_set(Evas_Object *obj, const_char *path) + const_char * elm_fileselector_selected_get(const_Evas_Object *obj) + const_Eina_List * elm_fileselector_selected_paths_get(const_Evas_Object *obj) Eina_Bool elm_fileselector_mime_types_filter_append(Evas_Object *obj, const_char *mime_types, const_char *filter_name) void elm_fileselector_filters_clear(Evas_Object *obj) + void elm_fileselector_hidden_visible_set(Evas_Object *obj, Eina_Bool visible) + Eina_Bool elm_fileselector_hidden_visible_get(const_Evas_Object *obj) diff --git a/efl/elementary/fileselector.pyx b/efl/elementary/fileselector.pyx index afd5869..0e891a1 100644 --- a/efl/elementary/fileselector.pyx +++ b/efl/elementary/fileselector.pyx @@ -49,8 +49,11 @@ the second form of view will display preview thumbnails of files which it supports. This widget emits the following signals, besides the ones sent from -:py:class:`elementary.layout.Layout`: +:py:class:`~efl.elementary.layout_class.LayoutClass`: +- ``activated`` - the user activated a file. This can happen by + double-clicking or pressing Enter key. (**event_info** is a + pointer to the activated file path) - ``selected`` - the user has clicked on a file (when not in folders-only mode) or directory (when in folders-only mode) - ``directory,open`` - the list has been populated with new @@ -80,7 +83,7 @@ Fileselector modes from cpython cimport PyUnicode_AsUTF8String from efl.eo cimport _object_mapping_register -from efl.utils.conversions cimport _ctouni +from efl.utils.conversions cimport _ctouni, eina_list_strings_to_python_list from efl.evas cimport Object as evasObject from layout_class cimport LayoutClass @@ -216,9 +219,61 @@ cdef class Fileselector(LayoutClass): def path_get(self): return _ctouni(elm_fileselector_path_get(self.obj)) + property mode: + """The mode in which a given file selector widget will display + (layout) file system entries in its view + + .. note:: By using :py:attr:`expandable`, the user may + trigger a tree view for that list. + + .. note:: If Elementary is built with support of the Ethumb + thumbnailing library, the second form of view will display + preview thumbnails of files which it supports. You must have + elm_need_ethumb() called in your Elementary for thumbnailing to + work, though. + + :seealso: :py:attr:`expandable` + + :type: :ref:`Elm_Fileselector_Mode` + + """ + def __get__(self): + return elm_fileselector_mode_get(self.obj) + + def __set__(self, mode): + elm_fileselector_mode_set(self.obj, mode) + + def mode_set(self, mode): + elm_fileselector_mode_set(self.obj, mode) + def mode_get(self): + return elm_fileselector_mode_get(self.obj) + + property multi_select: + """Multi-selection in the file selector widget. + + This enables (**True**) or disables (**False**) multi-selection in + the list/grid of the file selector widget. This allows more than 1 item to + be selected. To retrieve the list of selected paths, use + :py:attr:`selected_paths`. + + :type: bool + :since: 1.8 + + """ + def __set__(self, bint multi): + elm_fileselector_multi_select_set(self.obj, multi) + + def __get__(self): + return bool(elm_fileselector_multi_select_get(self.obj)) + + def multi_select_set(self, multi): + elm_fileselector_multi_select_set(self.obj, multi) + def multi_select_get(self): + return bool(elm_fileselector_multi_select_get(self.obj)) + property selected: """The currently selected file/directory in the given file selector - widget + widget. :type: string :raise RuntimeError: when setting the selected file path fails @@ -241,34 +296,29 @@ cdef class Fileselector(LayoutClass): def selected_get(self): return _ctouni(elm_fileselector_selected_get(self.obj)) - property mode: - """The mode in which a given file selector widget will display - (layout) file system entries in its view + property selected_paths: + """A list of selected paths in the file selector. - .. note:: By using :py:attr:`expandable`, the user may - trigger a tree view for that list. + It returns a list of the selected paths. This list pointer is only valid + so long as the selection doesn't change (no items are selected or + unselected, or unselected implicitly by deletion). The list contains + strings. The order of the items in this list is the order which + they were selected, i.e. the first item in this list is the first item + that was selected, and so on. - .. note:: If Elementary is built with support of the Ethumb - thumbnailing library, the second form of view will display - preview thumbnails of files which it supports. You must have - elm_need_ethumb() called in your Elementary for thumbnailing to - work, though. + .. note:: If not in multi-select mode, consider using + :py:attr:`selected` instead. - .. seealso:: :py:attr:`expandable` + .. seealso:: + :py:attr:`multi_select` + :py:attr:`selected` - :type: :ref:`Elm_Fileselector_Mode` + :since: 1.8 """ def __get__(self): - return elm_fileselector_mode_get(self.obj) - - def __set__(self, mode): - elm_fileselector_mode_set(self.obj, mode) - - def mode_set(self, mode): - elm_fileselector_mode_set(self.obj, mode) - def mode_get(self): - return elm_fileselector_mode_get(self.obj) + return eina_list_strings_to_python_list( + elm_fileselector_selected_paths_get(self.obj)) def mime_types_filter_append(self, list mime_types, filter_name=None): """mime_types_filter_append(list mime_types, str filter_name=None) @@ -285,8 +335,8 @@ cdef class Fileselector(LayoutClass): .. note:: mime type filter is only working with efreet now. .. note:: first added filter will be the default filter at the moment. - :see: :py:func:`~efl.elementary.need.need_efreet` - :see: :py:meth:`filters_clear` + :seealso: :py:func:`~efl.elementary.need.need_efreet` + :seealso: :py:meth:`filters_clear` :since: 1.8 @@ -308,13 +358,47 @@ cdef class Fileselector(LayoutClass): If filter list is empty, file selector assume that all files are matched. - :see: elm_fileselector_mime_type_filter_append() + :seealso: :py:meth:`mime_types_filter_append` :since: 1.8 """ elm_fileselector_filters_clear(self.obj) + property hidden_visible: + """Visibility of hidden files/directories in the file selector widget. + + This enables (**True**) or disables (**False**) visibility of hidden + files/directories in the list/grid of the file selector widget. + + Default is disabled. + + :type: bool + + :since: 1.8 + + """ + def __set__(self, bint visible): + elm_fileselector_hidden_visible_set(self.obj, visible) + + def __get__(self): + return bool(elm_fileselector_hidden_visible_get(self.obj)) + + def hidden_visible_set(self, bint visible): + elm_fileselector_hidden_visible_set(self.obj, visible) + def hidden_visible_get(self): + return bool(elm_fileselector_hidden_visible_get(self.obj)) + + def callback_activated_add(self, func, *args, **kwargs): + """the user activated a file. This can happen by + double-clicking or pressing Enter key. (**event_info** is a + pointer to the activated file path).""" + self._callback_add_full("activated", _cb_string_conv, func, + *args, **kwargs) + + def callback_activated_del(self, func): + self._callback_del_full("activated", _cb_string_conv, func) + def callback_selected_add(self, func, *args, **kwargs): """The user has clicked on a file (when not in folders-only mode) or directory (when in folders-only mode). Parameter ``event_info`` --