kopia lustrzana https://github.com/crahan/ipyfilechooser
One step closer
rodzic
fa44a64200
commit
34802201cb
|
@ -172,7 +172,8 @@ class FileChooser(VBox, ValueWidget):
|
|||
show_hidden=self._show_hidden,
|
||||
prepend_icons=False,
|
||||
show_only_dirs=self._show_only_dirs,
|
||||
filter_pattern=self._filter_pattern
|
||||
filter_pattern=self._filter_pattern,
|
||||
root_path=self._root_path
|
||||
)
|
||||
|
||||
# file/folder display names
|
||||
|
@ -181,7 +182,8 @@ class FileChooser(VBox, ValueWidget):
|
|||
show_hidden=self._show_hidden,
|
||||
prepend_icons=self._use_dir_icons,
|
||||
show_only_dirs=self._show_only_dirs,
|
||||
filter_pattern=self._filter_pattern
|
||||
filter_pattern=self._filter_pattern,
|
||||
root_path=self._root_path
|
||||
)
|
||||
|
||||
# Dict to map real names to display names
|
||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
|||
from typing import List, Sequence, Iterable, Optional
|
||||
|
||||
|
||||
def get_subpaths(path: str, root_path: str) -> List[str]:
|
||||
def get_subpaths(path: str, root_path: str = '') -> List[str]:
|
||||
"""Walk a path and return a list of subpaths."""
|
||||
if os.path.isfile(path):
|
||||
path = os.path.dirname(path)
|
||||
|
@ -64,7 +64,8 @@ def get_dir_contents(
|
|||
show_hidden: bool = False,
|
||||
prepend_icons: bool = False,
|
||||
show_only_dirs: bool = False,
|
||||
filter_pattern: Optional[Sequence[str]] = None) -> List[str]:
|
||||
filter_pattern: Optional[Sequence[str]] = None,
|
||||
root_path: str = '') -> List[str]:
|
||||
"""Get directory contents."""
|
||||
files = list()
|
||||
dirs = list()
|
||||
|
@ -83,7 +84,7 @@ def get_dir_contents(
|
|||
files.append(item)
|
||||
else:
|
||||
files.append(item)
|
||||
if has_parent(path):
|
||||
if has_parent(strip_root_path(path, root_path)):
|
||||
dirs.insert(0, '..')
|
||||
if prepend_icons:
|
||||
return prepend_dir_icons(sorted(dirs)) + sorted(files)
|
||||
|
|
Ładowanie…
Reference in New Issue