From c55ca4dd8fa3353afd86432d302d07d0fdaddfff Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 26 Apr 2008 05:05:26 -0700 Subject: [PATCH] inotify: simplify the code a bit Signed-off-by: David Aguilar --- ugit/inotify.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ugit/inotify.py b/ugit/inotify.py index 0098ef4..29fe04c 100644 --- a/ugit/inotify.py +++ b/ugit/inotify.py @@ -29,6 +29,12 @@ class GitNotifier(QThread): self.path = path self.abort = False self.dirs_seen = {} + self.mask = ( + EventsCodes.IN_CREATE | + EventsCodes.IN_DELETE | + EventsCodes.IN_MODIFY | + EventsCodes.IN_MOVED_TO + ) def notify(self): if not self.abort: @@ -39,15 +45,11 @@ class GitNotifier(QThread): def watch_directory(self, directory): directory = os.path.realpath(directory) if directory not in self.dirs_seen: - self.wm.add_watch(directory, mask) + self.wm.add_watch(directory, self.mask) self.dirs_seen[directory] = True def run(self): # Only capture those events that git cares about - mask = ( EventsCodes.IN_CREATE - | EventsCodes.IN_DELETE - | EventsCodes.IN_MODIFY - | EventsCodes.IN_MOVED_TO) self.wm = WatchManager() notifier = Notifier(self.wm, FileSysEvent(self)) self.notifier = notifier -- 2.11.4.GIT