... | ... |
@@ -1739,6 +1739,18 @@ class DotWindow(gtk.Window): |
1739 | 1739 |
|
1740 | 1740 |
self.show_all() |
1741 | 1741 |
|
1742 |
+ def update(self, filename): |
|
1743 |
+ import os |
|
1744 |
+ if not hasattr(self, "last_mtime"): |
|
1745 |
+ self.last_mtime = None |
|
1746 |
+ |
|
1747 |
+ current_mtime = os.stat(filename).st_mtime |
|
1748 |
+ if current_mtime != self.last_mtime: |
|
1749 |
+ self.last_mtime = current_mtime |
|
1750 |
+ self.open_file(filename) |
|
1751 |
+ |
|
1752 |
+ return True |
|
1753 |
+ |
|
1742 | 1754 |
def set_filter(self, filter): |
1743 | 1755 |
self.widget.set_filter(filter) |
1744 | 1756 |
|
... | ... |
@@ -1813,6 +1825,7 @@ def main(): |
1813 | 1825 |
win.set_dotcode(sys.stdin.read()) |
1814 | 1826 |
else: |
1815 | 1827 |
win.open_file(args[0]) |
1828 |
+ gtk.timeout_add(1000, win.update, args[0]) |
|
1816 | 1829 |
gtk.main() |
1817 | 1830 |
|
1818 | 1831 |
|