mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 13:01:56 +00:00
Fix IdeEventHandler not working with arbitrary keys
This commit is contained in:
parent
20f8cdb00c
commit
83dd6ae836
@ -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'}
|
||||
})
|
||||
|
||||
|
@ -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,
|
||||
|
@ -141,6 +141,7 @@ class IdeEventHandler(EventHandlerBase, MonitorManagerMixin):
|
||||
MonitorManagerMixin.__init__(
|
||||
self,
|
||||
DirectoryMonitor,
|
||||
self.key,
|
||||
self.filemanager.allowed_directories
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user