本文整理匯總了Python中watchdog.events方法的典型用法代碼示例。如果您正苦於以下問題:Python watchdog.events方法的具體用法?Python watchdog.events怎麽用?Python watchdog.events使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類watchdog
的用法示例。
在下文中一共展示了watchdog.events方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: handleSingleEvent
# 需要導入模塊: import watchdog [as 別名]
# 或者: from watchdog import events [as 別名]
def handleSingleEvent(self, event):
# events may happen in clumps. start a timer
# to defer processing. if the timer is already going,
# it will be canceled
# in the future there can be more smarts about
# granular file events. for now this will be
# good enough to just get a a trigger that *something*
# changed
self.mutex.acquire()
if self.eventProcessingTimer is not None:
self.eventProcessingTimer.cancel()
self.eventProcessingTimer = threading.Timer(30, self.handleEventProcessing)
self.eventProcessingTimer.start()
self.mutex.release()
示例2: dispatch
# 需要導入模塊: import watchdog [as 別名]
# 或者: from watchdog import events [as 別名]
def dispatch(self, event):
watchdog.events.FileSystemEventHandler.dispatch(self, event)
示例3: mainLoop
# 需要導入模塊: import watchdog [as 別名]
# 或者: from watchdog import events [as 別名]
def mainLoop(self):
logging.debug("Monitor: started main loop.")
self.session = self.dm.Session()
observer = Observer()
self.eventHandler = MonitorEventHandler(self)
for path in self.paths:
if os.path.exists(path):
observer.schedule(self.eventHandler, path, recursive=True)
observer.start()
while True:
try:
(msg, args) = self.queue.get(block=True, timeout=1)
except:
msg = None
#dispatch messages
if msg == "scan":
self.dofullScan(self.paths)
if msg == "events":
self.doEventProcessing(args)
#time.sleep(1)
if self.quit:
break
self.session.close()
self.session = None
observer.stop()
logging.debug("Monitor: stopped main loop.")
示例4: event_notification
# 需要導入模塊: import watchdog [as 別名]
# 或者: from watchdog import events [as 別名]
def event_notification(self, event):
""" HANDLES ROUTING OF WATCHDOG EVENT TYPES, SOME EDITORS MOVE TO TEMP FILES TO WRITE"""
# TODO LP Investigate other possible file modifications
if isinstance(event, watchdog.events.FileModifiedEvent):
self.settings_modified(event)
elif isinstance(event, watchdog.events.FileMovedEvent):
if event.dest_path == self.file_observing:
self.settings_modified(event)
else:
self.root.debug("Event type {} is not handled".format(type(event)))
示例5: settings_modified
# 需要導入模塊: import watchdog [as 別名]
# 或者: from watchdog import events [as 別名]
def settings_modified(self, events):
raise NotImplementedError("settings_modified not implemented")