當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。