Skip to content

Commit

Permalink
Improved the dirwatch example
Browse files Browse the repository at this point in the history
  • Loading branch information
prologic committed Jul 21, 2014
1 parent ed3fc32 commit 9978312
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions examples/dirwatch.py
Expand Up @@ -10,12 +10,25 @@

import sys

from circuits import Debugger

from circuits import Component
from circuits.io import Notify


class FileWatcher(Component):

channel = "notify"

def opened(self, filename, path, fullpath, isdir):
print("File {0:s} opened".format(filename))

def closed(self, filename, path, fullpath, isdir):
print("File {0:s} closed".format(filename))


# Configure the system
app = Notify()
Debugger().register(app)
FileWatcher().register(app)

# Add the path to watch
app.add_path(sys.argv[1])
Expand Down

0 comments on commit 9978312

Please sign in to comment.