mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 11:31:32 +00:00
Refactor MonitorManagerMixin to allow arbitrary Monitor arguments
This commit is contained in:
parent
28c16e1127
commit
9e6cd57532
@ -7,10 +7,10 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class MonitorManagerMixin:
|
class MonitorManagerMixin:
|
||||||
def __init__(self, monitor_type, directories):
|
def __init__(self, monitor_type, *monitor_args):
|
||||||
self._monitor_type = monitor_type
|
self._monitor_type = monitor_type
|
||||||
self._monitor = None
|
self._monitor = None
|
||||||
self._monitored_directories = directories
|
self._monitor_args = monitor_args
|
||||||
self.reload_monitor()
|
self.reload_monitor()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -23,5 +23,5 @@ class MonitorManagerMixin:
|
|||||||
self._monitor.stop()
|
self._monitor.stop()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
LOG.debug('Working directory was removed – ignoring...')
|
LOG.debug('Working directory was removed – ignoring...')
|
||||||
self._monitor = self._monitor_type(self._monitored_directories)
|
self._monitor = self._monitor_type(*self._monitor_args)
|
||||||
self._monitor.watch() # This runs on a separate thread
|
self._monitor.watch() # This runs on a separate thread
|
||||||
|
Loading…
Reference in New Issue
Block a user