Expose DirManagingEH.directory as a property

This commit is contained in:
Kristóf Tóth 2018-03-15 21:02:49 +01:00
parent aaaad9c459
commit 7b834f8f25

View File

@ -1,5 +1,6 @@
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from os.path import exists, isdir
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
from tfw.components.decorators import RateLimiter
@ -78,6 +79,15 @@ class DirectoryMonitoringEventHandler(TriggerlessEventHandler):
'resume': self.resume,
'ignore': self.ignore}
@property
def directory(self):
return self._directory
@directory.setter
def directory(self, directory):
if not exists(directory) or not isdir(directory): raise EnvironmentError('No such directory!')
self._directory = directory
@property
def monitor(self):
return self._monitor