mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #2660 from davep/dirtree-tweaks
This commit is contained in:
@@ -131,8 +131,9 @@ class DirectoryTree(Tree[DirEntry]):
|
|||||||
node: The node to add to the load queue.
|
node: The node to add to the load queue.
|
||||||
"""
|
"""
|
||||||
assert node.data is not None
|
assert node.data is not None
|
||||||
node.data.loaded = True
|
if not node.data.loaded:
|
||||||
self._load_queue.put_nowait(node)
|
node.data.loaded = True
|
||||||
|
self._load_queue.put_nowait(node)
|
||||||
|
|
||||||
def reload(self) -> None:
|
def reload(self) -> None:
|
||||||
"""Reload the `DirectoryTree` contents."""
|
"""Reload the `DirectoryTree` contents."""
|
||||||
@@ -271,6 +272,7 @@ class DirectoryTree(Tree[DirEntry]):
|
|||||||
node: The Tree node to populate.
|
node: The Tree node to populate.
|
||||||
content: The collection of `Path` objects to populate the node with.
|
content: The collection of `Path` objects to populate the node with.
|
||||||
"""
|
"""
|
||||||
|
node.remove_children()
|
||||||
for path in content:
|
for path in content:
|
||||||
node.add(
|
node.add(
|
||||||
path.name,
|
path.name,
|
||||||
@@ -350,8 +352,7 @@ class DirectoryTree(Tree[DirEntry]):
|
|||||||
if dir_entry is None:
|
if dir_entry is None:
|
||||||
return
|
return
|
||||||
if self._safe_is_dir(dir_entry.path):
|
if self._safe_is_dir(dir_entry.path):
|
||||||
if not dir_entry.loaded:
|
self._add_to_load_queue(event.node)
|
||||||
self._add_to_load_queue(event.node)
|
|
||||||
else:
|
else:
|
||||||
self.post_message(self.FileSelected(event.node, dir_entry.path))
|
self.post_message(self.FileSelected(event.node, dir_entry.path))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user