Commit 5d80a31f by willmcgugan

watcher tweak

parent e29c00bf
...@@ -170,7 +170,7 @@ class OSFSWatchMixin(WatchableFSMixin): ...@@ -170,7 +170,7 @@ class OSFSWatchMixin(WatchableFSMixin):
if inevt.mask & pyinotify.IN_MODIFY: if inevt.mask & pyinotify.IN_MODIFY:
watcher.handle_event(MODIFIED(self,path,True)) watcher.handle_event(MODIFIED(self,path,True))
if inevt.mask & pyinotify.IN_CLOSE_WRITE: if inevt.mask & pyinotify.IN_CLOSE_WRITE:
watcher.handle_event(MODIFIED(self,path,True)) watcher.handle_event(MODIFIED(self,path,True, closed=True))
if inevt.mask & pyinotify.IN_MOVED_FROM: if inevt.mask & pyinotify.IN_MOVED_FROM:
# Sorry folks, I'm not up for decoding the destination path. # Sorry folks, I'm not up for decoding the destination path.
watcher.handle_event(MOVED_SRC(self,path,None)) watcher.handle_event(MOVED_SRC(self,path,None))
......
...@@ -78,15 +78,16 @@ class REMOVED(EVENT): ...@@ -78,15 +78,16 @@ class REMOVED(EVENT):
class MODIFIED(EVENT): class MODIFIED(EVENT):
"""Event fired when a file or directory is modified.""" """Event fired when a file or directory is modified."""
def __init__(self,fs,path,data_changed=False): def __init__(self,fs,path,data_changed=False, closed=False):
super(MODIFIED,self).__init__(fs,path) super(MODIFIED,self).__init__(fs,path)
self.data_changed = data_changed self.data_changed = data_changed
self.closed = closed
def clone(self,fs=None,path=None,data_changed=None): def clone(self,fs=None,path=None,data_changed=None):
evt = super(MODIFIED,self).clone(fs,path) evt = super(MODIFIED,self).clone(fs,path)
if data_changed is None: if data_changed is None:
data_changed = self.data_changed data_changed = self.data_changed
evt.data_changd = data_changed evt.data_changed = data_changed
return evt return evt
class MOVED_DST(EVENT): class MOVED_DST(EVENT):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment