Exemplo n.º 1
0
    def __init__(self):
        Plugin.__init__(self)

        # Create DB Wrapper and start the thread
        self._db_wrapper = DBWrapper()

        self._config = Config()
        self._file_monitor = FileMonitor(self._db_wrapper,
            self._config.root_path(), self._config)
Exemplo n.º 2
0
def startLesson(fileName, lineList, stringList, tts, editorName):
    """Create a FileMonitor, open an editor and monitor file.

    Keyword arguments:
    fileName -- file to monitor and open
    lineList -- list of lines to monitor
    stringList -- list of correct lines
    tts -- Nao proxy
    editorName -- Editor to open for the kid
    """
    monitor = FileMonitor()
    monitor.setData(fileName, lineList, stringList)
    openEditor(editorName, fileName)
    monitor.monitor_file(tts)
Exemplo n.º 3
0
 def __init__(self):
     '''
     Constructor
     '''
     Controller.controller = self
     self.sysStatus = SystemStatus()
     self.configMgr = ConfigManager()
     self.statusMgr = StatusManager()
     self.boardManager = RpiBoardManager()
     self.eventProcessor = EventProcessor()
     self.sensorMgr = SensorManager(self, self.eventProcessor)
     self.scheduleManager = ScheduleManager(self, self.eventProcessor)
     self.fileMon = FileMonitor(Constants.SYSTEM_CONFIG_FILE, self,
                                self.eventProcessor)
     self.initializeStatus()
     self.initializeScheduler()
     self.controllerService = ControllerService(self)
Exemplo n.º 4
0
    def __init__(self, path, to_formats, from_formats, option_info,
                 ignore_info, api_key):
        """ Called upon Watch object creation
            :param path: the file path for the watch
                to_formats: the formats that the path converts to
                from_formats: the formats that the path automatically converts to the to_formats
                option_info: the toggles for the optional functionality
        """
        # It is possible that a user may not have set the recursive search toggle, in which case we default to False.
        if option_info["subdirsearch"]:
            if option_info["subdirsearch"] == 1:
                recursive_toggle = True
            else:
                recursive_toggle = False
        else:
            recursive_toggle = False

        # Make an instance of the FileMonitor class which extends the FileSystemEventHandler class.
        event_handler = FileMonitor(to_formats, from_formats, option_info,
                                    ignore_info, api_key)
        # Create the observer thread linked to the FileMonitor instance.
        self.observer = Observer()
        self.observer.schedule(event_handler, path, recursive=recursive_toggle)
        self.observer.start()
Exemplo n.º 5
0
 def __init__(self):
     self.exit = False
     self.fileMonitor = FileMonitor()
     self.poll_thread = None
Exemplo n.º 6
0
from watchdog.observers import Observer
import sys
import time
from FileMonitor import FileMonitor

if __name__ == "__main__":
    path = sys.argv[1] if len(sys.argv) > 1 else '.'
    event_handler = FileMonitor()
    observer = Observer()
    observer.schedule(event_handler, path, recursive=True)
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()