diff --git a/lib/tfw/components/directory_monitor.py b/lib/tfw/components/directory_monitor.py index dc72e9e..c72a13e 100644 --- a/lib/tfw/components/directory_monitor.py +++ b/lib/tfw/components/directory_monitor.py @@ -15,8 +15,8 @@ LOG = logging.getLogger(__name__) class DirectoryMonitor(ObserverMixin): - def __init__(self, directories): - self.eventhandler = IdeReloadWatchdogEventHandler() + def __init__(self, ide_key, directories): + self.eventhandler = IdeReloadWatchdogEventHandler(ide_key) for directory in directories: self.observer.schedule(self.eventhandler, directory, recursive=True) @@ -44,8 +44,9 @@ class DirectoryMonitor(ObserverMixin): class IdeReloadWatchdogEventHandler(FileSystemWatchdogEventHandler): - def __init__(self): + def __init__(self, ide_key): super().__init__() + self.ide_key = ide_key self.uplink = ServerUplinkConnector() self._paused = False self.ignore = 0 @@ -65,7 +66,7 @@ class IdeReloadWatchdogEventHandler(FileSystemWatchdogEventHandler): return LOG.debug(event) self.uplink.send({ - 'key': 'ide', + 'key': self.ide_key, 'data': {'command': 'reload'} }) diff --git a/lib/tfw/components/directory_monitoring_event_handler.py b/lib/tfw/components/directory_monitoring_event_handler.py index b3beeb2..6f89e91 100644 --- a/lib/tfw/components/directory_monitoring_event_handler.py +++ b/lib/tfw/components/directory_monitoring_event_handler.py @@ -15,7 +15,12 @@ class DirectoryMonitoringEventHandler(EventHandlerBase, MonitorManagerMixin): def __init__(self, key, directory): super().__init__(key) self._directory = directory - MonitorManagerMixin.__init__(self, DirectoryMonitor, self._directory) + MonitorManagerMixin.__init__( + self, + DirectoryMonitor, + key, + self._directory + ) self.commands = { 'pause': self.pause, diff --git a/lib/tfw/components/ide_event_handler.py b/lib/tfw/components/ide_event_handler.py index 659ade0..72e83b3 100644 --- a/lib/tfw/components/ide_event_handler.py +++ b/lib/tfw/components/ide_event_handler.py @@ -141,6 +141,7 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin): MonitorManagerMixin.__init__( self, DirectoryMonitor, + self.key, self.filemanager.allowed_directories )