From 76f7dfd7b7fe10e849f70f059f27294e86b88a95 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sat, 23 May 2020 13:19:36 +1000 Subject: [PATCH] Fixed appearance not updating while syncing with filesystem. - Also limited screen refreshes to 100 fps maximum. --- eris/__main__.py | 7 +++++-- eris/fill3.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eris/__main__.py b/eris/__main__.py index acce4f4..84c1017 100755 --- a/eris/__main__.py +++ b/eris/__main__.py @@ -352,7 +352,7 @@ class Summary: if y >= len(self._entries): self._cursor_position = (x, len(self._entries) - 1) - async def sync_with_filesystem(self, log=None): + async def sync_with_filesystem(self, appearance_changed_event, log=None): start_time = time.time() cache = {} log.log_message("Started loading summary…") @@ -361,6 +361,7 @@ class Summary: log.log_message(f"Loaded {index} files…") await asyncio.sleep(0) self.add_entry(entry) + appearance_changed_event.set() cache[entry.path] = entry.change_time duration = time.time() - start_time log.log_message(f"Finished loading summary. {round(duration, 2)} secs") @@ -380,6 +381,7 @@ class Summary: entry.change_time = change_time else: self.on_file_added(path) + appearance_changed_event.set() for path in cache.keys() - all_paths: await asyncio.sleep(0) self.on_file_deleted(path) @@ -1142,7 +1144,8 @@ def main(root_path, loop, worker_count=None, editor_command=None, theme=None, time.sleep(0.05) screen.stop_workers() loop.stop() - loop.create_task(summary.sync_with_filesystem(log)) + loop.create_task(summary.sync_with_filesystem( + appearance_changed_event, log)) for worker in screen.workers: loop.create_task(worker.future) if sys.stdout.isatty(): diff --git a/eris/fill3.py b/eris/fill3.py index 073ff00..9eff6a9 100644 --- a/eris/fill3.py +++ b/eris/fill3.py @@ -479,6 +479,7 @@ async def update_screen(screen_widget, appearance_changed_event): await appearance_changed_event.wait() appearance_changed_event.clear() patch_screen(screen_widget) + await asyncio.sleep(0.01) def on_input(urwid_screen, screen_widget):