2017-04-09 1 views
0

나는 'automode'를 추가하고 싶은 어플리케이션이있다.QMainWindow는 watchdog.start()에서 동결시키는 법을 동시에 작동합니까?

def start_stop_automode(self): 
    self.set_auto() 

    if not self.auto_mode_btn.isChecked() and self.observer.is_alive(): 
     self.observer.stop() 
     self.observer.join() 
     return 
    else: 
     self.observer.start() 
     while True: 
      try: 
      time.sleep(1) 
      except KeyboardInterrupt: 
      self.observer.stop() 
      self.observer.join() 

그것은 차례로 watchdogevent를 트리거 한 파일에 일부 기능을 실행하는 watchdogFileSystemEventHandler 클래스를 시작하는 슬롯을 호출합니다.

class Event(FileSystemEventHandler): 

    def on_created(self, event): 

    input_path = event.src_path 
    if input_path.endswith('_1.CSV'): 

     if self.file_creation_finished(input_path): 
      file = os.path.split(input_path)[-1].rstrip('.CSV') 
      file = file.split('_')[0] 
      self.exec_funk(order=file) 

는 debugg 통해 난 내부 FileSystemEventHandler 클래스 코드 watchdog 실행 중에 QMainWindow 실제로 작동되는 누락 기능을 제외하고 정확하게 행하는 것을 알았다. 어떻게 둘 다 수용합니까?

답변

0

좋아요, 이제 해결책이 얼마나 간단했는지 알았으니 while loop을 제거하면 QMainWindow으로 작업 할 수 있습니다.

관련 문제