From 2e8fdf67f1174c25a1f2b83b075b621804ad5e81 Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Sat, 24 Feb 2024 13:38:35 +0100 Subject: [PATCH] fix: Reload on adding a file --- src/files.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/files.py b/src/files.py index 3f16da0..59b4639 100644 --- a/src/files.py +++ b/src/files.py @@ -2,6 +2,9 @@ import os import posixpath from typing import Self +# TODO: Cut any dependency of DocumentNode on the backend implementation +# Maybe use some king of "yield" to achieve this? + class DocumentNode(): def __init__(self, name: str, children: list): @@ -75,6 +78,11 @@ class DocumentTree(): def get_node(self, path: str) -> DocumentNode | None: return self.root.get_child(path) + def reload(self) -> bool: + # TODO: Instead of doing this, actually reload + self.root = DocumentNode.get_tree(self.base, '') + return True + # ----- Document Operations ----- # Split and remerge for Windows @@ -93,4 +101,6 @@ class DocumentTree(): with open(internal_path, 'w') as file: file.write(text) + self.reload() + # -------------------------------