From e90e5e0871cd584e0408ecefc3fc768b025b4543 Mon Sep 17 00:00:00 2001 From: mitaa Date: Mon, 7 Oct 2024 05:42:24 +0200 Subject: [PATCH] Fix race condition with DirectoryTrees --- pyproject.toml | 2 +- src/production_planner/screens.py | 8 ++++---- tests | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c0bef50..b8121bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ - "textual[syntax] == 0.79", + "textual[syntax] == 0.81", "rich", "platformdirs", "pyaml", diff --git a/src/production_planner/screens.py b/src/production_planner/screens.py index 11d7f6a..68fc497 100644 --- a/src/production_planner/screens.py +++ b/src/production_planner/screens.py @@ -80,26 +80,26 @@ def highlighted_path(self) -> Path: current = self.first_dtree.cursor_node return None if current is None else current.data.path - def on_mount(self) -> None: + async def on_mount(self) -> None: # All these lines to simply move the cursor to the currently open file/folder datafile = core.APP.focused_table.sink.sink.target if not datafile: datafile = DataFile.get(Path(CONFIG.dpath_data) / "") self.first_dtree = self.FirstDTree(datafile.root) - self.mount(self.first_dtree, before=self.query_one(Footer)) + await self.mount(self.first_dtree, before=self.query_one(Footer)) if self.SecondDTree: # TODO: provide a way to change the root for this loading/saving action self.second_dtree = self.SecondDTree(datafile.root) - self.mount(self.second_dtree, after=self.first_dtree) + await self.mount(self.second_dtree, after=self.first_dtree) if self.entry: self.query_one(Input).value = os.path.splitext(str(datafile.subpath.name))[0] tree = self.first_dtree if self.expand_all: - tree.expand_all() + await tree.expand_all() def preselect(start=True): if start: diff --git a/tests b/tests index 80e570a..81878a7 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 80e570a540af6dae42998c2719eb7ba2d3302742 +Subproject commit 81878a7d58809dd454a9de5c5f5da9dffdc61f6d