Logo Search packages:      
Sourcecode: mailcrypt version File versions  Download package

def dnotify::DNotify::__init__ (   self,
  dirname,
  callback = None,
  flags = [DN_MODIFY,
  DN_CREATE,
  DN_DELETE,
  DN_RENAME 
)
This object watches a directory for changes. The .callback
attribute should be set to a function to be run every time something
happens to it. Be aware that it will be called more times than you
expect.

Definition at line 43 of file dnotify.py.

                                                                 :

        """This object watches a directory for changes. The .callback
        attribute should be set to a function to be run every time something
        happens to it. Be aware that it will be called more times than you
        expect."""

        if callback:
            self.callback = callback
        else:
            self.callback = self.fire
        self.dirname = dirname
        self.flags = reduce(lambda x, y: x | y, flags) | fcntl.DN_MULTISHOT
        self.fd = open(dirname, "r")
        # ideally we would move the notification to something like SIGRTMIN,
        # (to free up SIGIO) and use sigaction to have the signal handler
        # receive a structure with the fd number. But python doesn't offer
        # either.
        if not self.handler[0]:
            self.handler[0] = DNotify_Handler()
        self.handler[0].add(self)
        fcntl.fcntl(self.fd, fcntl.F_NOTIFY, self.flags)

Generated by  Doxygen 1.6.0   Back to index