当前位置: 首页>>代码示例>>Python>>正文


Python watchdog.events方法代码示例

本文整理汇总了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() 
开发者ID:beville,项目名称:ComicStreamer,代码行数:20,代码来源:monitor.py

示例2: dispatch

# 需要导入模块: import watchdog [as 别名]
# 或者: from watchdog import events [as 别名]
def dispatch(self, event):
        watchdog.events.FileSystemEventHandler.dispatch(self, event) 
开发者ID:datawire,项目名称:forge,代码行数:4,代码来源:tasks.py

示例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.") 
开发者ID:beville,项目名称:ComicStreamer,代码行数:35,代码来源:monitor.py

示例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))) 
开发者ID:will7200,项目名称:Yugioh-bot,代码行数:12,代码来源:watcher.py

示例5: settings_modified

# 需要导入模块: import watchdog [as 别名]
# 或者: from watchdog import events [as 别名]
def settings_modified(self, events):
        raise NotImplementedError("settings_modified not implemented") 
开发者ID:will7200,项目名称:Yugioh-bot,代码行数:4,代码来源:watcher.py


注:本文中的watchdog.events方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。