本文整理汇总了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")