|
|
|
@ -25,7 +25,6 @@ from os import path
|
|
|
|
|
import os
|
|
|
|
|
from collections import OrderedDict, Iterable
|
|
|
|
|
from threading import RLock
|
|
|
|
|
import pyinotify
|
|
|
|
|
from itertools import *
|
|
|
|
|
import operator
|
|
|
|
|
import traceback
|
|
|
|
@ -917,39 +916,6 @@ class ReadonlyTableVariable(TableVariable):
|
|
|
|
|
mode = READONLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FileVariable(Variable):
|
|
|
|
|
"""
|
|
|
|
|
Test variable
|
|
|
|
|
"""
|
|
|
|
|
filename = ""
|
|
|
|
|
directory = ""
|
|
|
|
|
recursive = False
|
|
|
|
|
wm = None
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
|
if self.wm is None:
|
|
|
|
|
self.wm = pyinotify.WatchManager()
|
|
|
|
|
IN_MODIFY = pyinotify.EventsCodes.FLAG_COLLECTIONS['IN_MODIFY']
|
|
|
|
|
IN_CREATE = pyinotify.EventsCodes.FLAG_COLLECTIONS['IN_CREATE']
|
|
|
|
|
IN_DELETE = pyinotify.EventsCodes.FLAG_COLLECTIONS['IN_DELETE']
|
|
|
|
|
if self.filename:
|
|
|
|
|
self.mask = IN_MODIFY
|
|
|
|
|
else:
|
|
|
|
|
self.mask = IN_CREATE | IN_DELETE
|
|
|
|
|
self.notifier = pyinotify.Notifier(self.wm, timeout=1)
|
|
|
|
|
self.wdd = self.wm.add_watch(self.filename or self.directory,
|
|
|
|
|
self.mask,
|
|
|
|
|
rec=self.recursive)
|
|
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
|
self.notifier.stop()
|
|
|
|
|
|
|
|
|
|
def refresh(self):
|
|
|
|
|
if self.notifier.check_events():
|
|
|
|
|
self.notifier.read_events()
|
|
|
|
|
self.parent.Invalidate(self.name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SimpleDataVars(object):
|
|
|
|
|
"""
|
|
|
|
|
Simple datavars for temporary link var objs.
|
|
|
|
|