file_manager: Don't filter inotify events on the gcodes root

Broadcast events for all files and let clients determine
what should be shown.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-10-10 11:33:33 -04:00
parent 7f1c327f02
commit 070e03d741
1 changed files with 2 additions and 9 deletions

View File

@ -1306,7 +1306,7 @@ class INotifyHandler:
self.event_loop.register_callback(
self._sync_with_request, result,
sync_lock.sync(full_path), is_valid)
elif is_valid and self._check_need_notify(file_info):
elif is_valid:
self.server.send_event("file_manager:filelist_changed", result)
async def _sync_with_request(self,
@ -1315,16 +1315,9 @@ class INotifyHandler:
is_valid: bool
) -> None:
await sync_fut
if is_valid and self._check_need_notify(result['item']):
if is_valid:
self.server.send_event("file_manager:filelist_changed", result)
def _check_need_notify(self, file_info: Dict[str, Any]) -> bool:
if file_info['root'] == "gcodes":
ext = os.path.splitext(file_info['path'])[-1]
if ext and ext not in VALID_GCODE_EXTS:
return False
return True
def close(self) -> None:
self.event_loop.remove_reader(self.inotify.fileno())
for watch in self.watched_nodes.keys():