Module vlib.vFileBrowser
A file browser component, based on vTable
Functions
get_items () | get all items in table |
get_selected_item () | get selected item (first one, if multiple) |
create_path (str) | return bool |
delete_selected () | delete selected items in table |
delete_folder (str) | delete selected folder (including workaround for non-POSIX systems) |
match_file_type (file_path) | get icon and extension in case of recognized file type |
rename_file () | rename the currently selected file (single item) |
set_path (str) | display the indicated path |
Fields
self._num_rows | (int) number of visible rows |
self._path | (string) full, absolute folder path - file part is ignored |
self._file_ext | (string) |
self._file_types | (table>{ext1 = {icon},ext2 = {icon},...}) |
self.on_checked | (function) callback event |
self.on_changed_path | (function) callback event |
self.on_resize | (function) callback event |
Functions
- get_items ()
- get all items in table
- get_selected_item ()
-
get selected item (first one, if multiple)
Returns:
-
table or nil
- create_path (str)
-
return bool
Parameters:
- str print("vFileBrowser create_path(str)",str) TODO proper sanitize of string
- delete_selected ()
-
delete selected items in table
Returns:
-
bool
- delete_folder (str)
-
delete selected folder (including workaround for non-POSIX systems)
Parameters:
- str (string)
Returns:
- bool
- string (error message)
- match_file_type (file_path)
-
get icon and extension in case of recognized file type
Parameters:
- file_path print("vFileBrowser match_file_type(file_path)",file_path)
Returns:
-
string(icon) or nil when not matched
- rename_file ()
- rename the currently selected file (single item)
- set_path (str)
-
display the indicated path
Parameters:
- str print("vFileBrowser set_path(str)",str) TODO proper sanitize of string * strip filenames from path * end with slash * avoid multiple slashes
Fields
- self._num_rows
- (int) number of visible rows
- self._path
- (string) full, absolute folder path - file part is ignored
- self._file_ext
- (string)
- self._file_types
- (table>{ext1 = {icon},ext2 = {icon},...})
- self.on_checked
- (function) callback event
- self.on_changed_path
- (function) callback event
- self.on_resize
- (function) callback event