From 92e9812776e56cb1cf31127fed39cb4d247a7bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 4 Jun 2018 21:20:36 +0200 Subject: [PATCH] Remove unnecessary additional_dirs IdeEH.__init__ argument --- lib/tfw/components/ide_event_handler.py | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/tfw/components/ide_event_handler.py b/lib/tfw/components/ide_event_handler.py index 4c4fa6f..72fc073 100644 --- a/lib/tfw/components/ide_event_handler.py +++ b/lib/tfw/components/ide_event_handler.py @@ -106,17 +106,13 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin): The API of each command is documented in their respective handler. """ - def __init__(self, key, directory, allowed_directories, selected_file=None, exclude=None, - additional_watched_directories=None): + def __init__(self, key, directory, allowed_directories, selected_file=None, exclude=None): """ :param key: the key this instance should listen to :param directory: working directory which the EventHandler should serve files from :param allowed_directories: list of directories that can be switched to using the selectdir command :param selected_file: file that is selected by default :param exclude: list of filenames that should not appear between files (for .o, .pyc, etc.) - :param additional_watched_directories: refresh the selected file when files change in these directories - (the working directory is watched by default, this is useful for - symlinks and such) """ super().__init__(key) try: @@ -125,16 +121,19 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin): except IndexError: raise EnvironmentError(f'No file(s) in IdeEventHandler working_directory "{directory}"!') - self.watched_directories = [self.filemanager.workdir] - if additional_watched_directories: - self.watched_directories.extend(additional_watched_directories) - MonitorManagerMixin.__init__(self, DirectoryMonitor, self.watched_directories) + MonitorManagerMixin.__init__( + self, + DirectoryMonitor, + self.filemanager.allowed_directories + ) - self.commands = {'read': self.read, - 'write': self.write, - 'select': self.select, - 'selectdir': self.select_dir, - 'exclude': self.exclude} + self.commands = { + 'read': self.read, + 'write': self.write, + 'select': self.select, + 'selectdir': self.select_dir, + 'exclude': self.exclude + } def read(self, data): """