Add support for root_path parameter

pull/62/head
Thomas Bouve 2021-09-05 23:16:41 +02:00
rodzic 3f5c14c92c
commit fa44a64200
2 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -23,6 +23,7 @@ class FileChooser(VBox, ValueWidget):
use_dir_icons: bool = False,
show_only_dirs: bool = False,
filter_pattern: Optional[Sequence[str]] = None,
root_path: str = '',
layout: Layout = Layout(width='500px'),
**kwargs):
"""Initialize FileChooser object."""
@ -37,6 +38,7 @@ class FileChooser(VBox, ValueWidget):
self._use_dir_icons = use_dir_icons
self._show_only_dirs = show_only_dirs
self._filter_pattern = filter_pattern
self._root_path = root_path
self._callback: Optional[Callable] = None
# Widgets
@ -160,7 +162,7 @@ class FileChooser(VBox, ValueWidget):
filename = ''
# Set form values
self._pathlist.options = get_subpaths(path)
self._pathlist.options = get_subpaths(path, self._root_path)
self._pathlist.value = path
self._filename.value = filename

Wyświetl plik

@ -97,7 +97,7 @@ def prepend_dir_icons(dir_list: Iterable[str]) -> List[str]:
def get_drive_letters(path: str) -> List[str]:
"""Get drive letters."""
"""Get all drive letters minus the drive used in path."""
if sys.platform == 'win32':
# Check if path uses upper or lowercase drive letters
chars = string.ascii_lowercase