mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2025-06-29 05:35:12 +00:00
Refactor watchdog Observer handling to a mixin
This commit is contained in:
@ -3,3 +3,4 @@
|
||||
|
||||
from .supervisor_mixin import SupervisorMixin
|
||||
from .callback_mixin import CallbackMixin
|
||||
from .observer_mixin import ObserverMixin
|
||||
|
16
lib/tfw/components/mixins/observer_mixin.py
Normal file
16
lib/tfw/components/mixins/observer_mixin.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
||||
# All Rights Reserved. See LICENSE file for details.
|
||||
|
||||
from watchdog.observers import Observer
|
||||
|
||||
|
||||
class ObserverMixin:
|
||||
def __init__(self):
|
||||
self.observer = Observer()
|
||||
|
||||
def watch(self):
|
||||
self.observer.start()
|
||||
|
||||
def stop(self):
|
||||
self.observer.stop()
|
||||
self.observer.join()
|
Reference in New Issue
Block a user