2018-04-14 18:36:43 +00:00
|
|
|
# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
|
|
|
|
# All Rights Reserved. See LICENSE file for details.
|
|
|
|
|
|
|
|
from watchdog.observers import Observer
|
|
|
|
|
2018-07-26 11:59:06 +00:00
|
|
|
from tfw.decorators.lazy_property import lazy_property
|
2018-06-01 12:06:40 +00:00
|
|
|
|
2018-04-14 18:36:43 +00:00
|
|
|
|
|
|
|
class ObserverMixin:
|
2018-06-02 09:48:34 +00:00
|
|
|
@lazy_property
|
2018-06-01 12:06:40 +00:00
|
|
|
def observer(self):
|
2018-07-16 09:17:06 +00:00
|
|
|
# pylint: disable=no-self-use
|
2018-06-01 12:06:40 +00:00
|
|
|
return Observer()
|
2018-04-14 18:36:43 +00:00
|
|
|
|
|
|
|
def watch(self):
|
|
|
|
self.observer.start()
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
self.observer.stop()
|
|
|
|
self.observer.join()
|