mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 02:11:55 +00:00
Implement sending reload command on file system changes
This commit is contained in:
parent
9c006451bf
commit
67579aea29
@ -1,16 +1,22 @@
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
|
||||
from tfw.message_sender import MessageSender
|
||||
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
||||
|
||||
from tfw.config.logs import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MessagingEventHandler(FileSystemEventHandler):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.message_sender = MessageSender()
|
||||
self.uplink = ServerUplinkConnector()
|
||||
|
||||
def on_modified(self, event):
|
||||
self.message_sender.send('Watchdog', 'CECA')
|
||||
log.debug(event)
|
||||
anchor = 'anchor_webide'
|
||||
self.uplink.send(anchor, {'anchor': anchor,
|
||||
'data': {'command': 'reload'}})
|
||||
|
||||
|
||||
class DirectoryMonitor:
|
||||
|
Loading…
Reference in New Issue
Block a user