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.
"""
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):
"""