New 1.12 API: elm_fileselector_current_name_set/get
With proper test
This commit is contained in:
parent
3be938511f
commit
5e8a644f24
|
@ -32,3 +32,5 @@ cdef extern from "Elementary.h":
|
|||
void elm_fileselector_sort_method_set(Evas_Object *obj, Elm_Fileselector_Sort method)
|
||||
void elm_fileselector_thumbnail_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||
void elm_fileselector_thumbnail_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
||||
void elm_fileselector_current_name_set(Evas_Object *obj, const char *name)
|
||||
const char * elm_fileselector_current_name_get(const Evas_Object *obj)
|
||||
|
|
|
@ -299,6 +299,29 @@ cdef class Fileselector(LayoutClass):
|
|||
def path_get(self):
|
||||
return _ctouni(elm_fileselector_path_get(self.obj))
|
||||
|
||||
property current_name:
|
||||
""" The name of the file in a save fileselector
|
||||
|
||||
:type: string
|
||||
|
||||
.. versionadded:: 1.12
|
||||
|
||||
"""
|
||||
def __get__(self):
|
||||
return _ctouni(elm_fileselector_current_name_get(self.obj))
|
||||
|
||||
def __set__(self, name):
|
||||
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
|
||||
elm_fileselector_current_name_set(self.obj,
|
||||
<const char *>name if name is not None else NULL)
|
||||
|
||||
def current_name_set(self, name):
|
||||
if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name)
|
||||
elm_fileselector_current_name_set(self.obj,
|
||||
<const char *>name if name is not None else NULL)
|
||||
def current_name_get(self):
|
||||
return _ctouni(elm_fileselector_current_name_get(self.obj))
|
||||
|
||||
property mode:
|
||||
"""The mode in which a given file selector widget will display
|
||||
(layout) file system entries in its view
|
||||
|
|
|
@ -70,6 +70,9 @@ def bt_cb_path_get(bt, fs):
|
|||
def bt_cb_paths_get(bt, fs):
|
||||
print("Get Path:" + str(fs.selected_paths))
|
||||
|
||||
def bt_cb_current_name_get(bt, fs):
|
||||
print("Get CurrentName:" + str(fs.current_name))
|
||||
|
||||
def rd_cb_mode(rd, fs):
|
||||
mode = rd.value
|
||||
fs.mode_set(mode)
|
||||
|
@ -98,8 +101,8 @@ def fileselector_clicked(obj, item=None):
|
|||
box1.show()
|
||||
|
||||
fs = Fileselector(win, is_save=True, expandable=False, folder_only=False,
|
||||
path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
|
||||
size_hint_align=FILL_BOTH)
|
||||
path=os.getenv("HOME"), current_name="No name",
|
||||
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
|
||||
fs.callback_done_add(fs_cb_done, win)
|
||||
fs.callback_selected_add(fs_cb_selected, win)
|
||||
fs.callback_directory_open_add(fs_cb_directory_open, win)
|
||||
|
@ -172,23 +175,36 @@ def fileselector_clicked(obj, item=None):
|
|||
vbox.pack_end(fr)
|
||||
fr.show()
|
||||
|
||||
fbox = Box(win, horizontal=True)
|
||||
fr.content = fbox
|
||||
fbox.show()
|
||||
fbox1 = Box(win)
|
||||
fr.content = fbox1
|
||||
fbox1.show()
|
||||
|
||||
fbox2 = Box(win, horizontal=True)
|
||||
fbox1.pack_end(fbox2)
|
||||
fbox2.show()
|
||||
|
||||
bt = Button(win, text="selected_get")
|
||||
bt.callback_clicked_add(bt_cb_sel_get, fs)
|
||||
fbox.pack_end(bt)
|
||||
fbox2.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
bt = Button(win, text="path_get")
|
||||
bt.callback_clicked_add(bt_cb_path_get, fs)
|
||||
fbox.pack_end(bt)
|
||||
fbox2.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
bt = Button(win, text="selected_paths")
|
||||
bt.callback_clicked_add(bt_cb_paths_get, fs)
|
||||
fbox.pack_end(bt)
|
||||
fbox2.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
fbox2 = Box(win, horizontal=True)
|
||||
fbox1.pack_end(fbox2)
|
||||
fbox2.show()
|
||||
|
||||
bt = Button(win, text="current_name_get")
|
||||
bt.callback_clicked_add(bt_cb_current_name_get, fs)
|
||||
fbox2.pack_end(bt)
|
||||
bt.show()
|
||||
|
||||
# Mode frame
|
||||
|
|
Loading…
Reference in New Issue