Remove unnecessary additional_dirs IdeEH.__init__ argument

This commit is contained in:
Kristóf Tóth 2018-06-04 21:20:36 +02:00
parent edc46a8ae6
commit 92e9812776

View File

@ -106,17 +106,13 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin):
The API of each command is documented in their respective handler. The API of each command is documented in their respective handler.
""" """
def __init__(self, key, directory, allowed_directories, selected_file=None, exclude=None, def __init__(self, key, directory, allowed_directories, selected_file=None, exclude=None):
additional_watched_directories=None):
""" """
:param key: the key this instance should listen to :param key: the key this instance should listen to
:param directory: working directory which the EventHandler should serve files from :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 allowed_directories: list of directories that can be switched to using the selectdir command
:param selected_file: file that is selected by default :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 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) super().__init__(key)
try: try:
@ -125,16 +121,19 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin):
except IndexError: except IndexError:
raise EnvironmentError(f'No file(s) in IdeEventHandler working_directory "{directory}"!') raise EnvironmentError(f'No file(s) in IdeEventHandler working_directory "{directory}"!')
self.watched_directories = [self.filemanager.workdir] MonitorManagerMixin.__init__(
if additional_watched_directories: self,
self.watched_directories.extend(additional_watched_directories) DirectoryMonitor,
MonitorManagerMixin.__init__(self, DirectoryMonitor, self.watched_directories) self.filemanager.allowed_directories
)
self.commands = {'read': self.read, self.commands = {
'read': self.read,
'write': self.write, 'write': self.write,
'select': self.select, 'select': self.select,
'selectdir': self.select_dir, 'selectdir': self.select_dir,
'exclude': self.exclude} 'exclude': self.exclude
}
def read(self, data): def read(self, data):
""" """