detecting document changes

  • Thread starter Alessandro Crugnola *sephiroth*
  • Start date
C

Cliff Wells

Hi,
i'm using wxPython and wxTextStyled.
How can I intercept document changes for active documents (for example
modified with others external editors)?

If you're on Linux (and perhaps other Unices) you can use FAM (file
alteration monitor). There's a Python library for the SGI version of
FAM (I don't know if it will work with anything other than XFS):

http://python-fam.sourceforge.net/

also check out this link:

http://oss.sgi.com/projects/fam/faq.html

If you're looking for a more general or cross-platform solution then
probably just periodically checking timestamp/size/md5sum for the file
is another (albeit somewhat less elegant) option.

Regards,
 
T

Tim Golden

Cliff Wells said:
If you're on Linux (and perhaps other Unices) you can use FAM

Don't know if this is exactly what you're
after, but there are a couple of recipes
on the Cookbook:

This one deals with Linux:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/217829

and this one with Win32:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178

The MSDN docs on FindFirstChangeNotification
tell you which flags you need to use for
modification (as opposed to addition etc.):

http://msdn.microsoft.com/library/d...s/fileio/base/findfirstchangenotification.asp

HTH
TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top