Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- qgis.utils.iface.mapCanvas().refresh()
- layers = qgis.utils.iface.legendInterface().layers()
- for layer in layers:
- layer.triggerRepaint()
- def md5checksum(fp):
- import hash
- with open(fp, 'rb') as fh:
- m = hashlib.md5()
- while True:
- data = fh.read(8192)
- if not data:
- break
- m.update(data)
- return m.hexdigest()
- import time
- import copy
- a,b = str(),str()
- while True:
- a = md5checksum(fp) # file
- if a != b: # the file has changed, do what you want
- myLayer.triggerRepaint()
- b = copy.copy(a) #shallow copy, otherwise a and b will point at the same object
- else:
- sleep.time(1) #wait for 1 sec, then recheck
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement