def __init__(self, **kwargs):
super(FilesContent, self).__init__(**kwargs)
Clock.schedule_interval(self.collect_meta_data, 0.1)
#if octoprint has changed files then update them
session_saver.save_variable('file_callback', self.call_to_update)
session_saver.save_variable('usb_mounted', False)
#schedule directory observer http://pythonhosted.org/watchdog/api.html#watchdog.events.FileSystemEventHandler
self.dir_observe = Observer()
self.callback = FileSystemEventHandler()
self.callback.on_any_event = self.on_any_event
if sys.platform != "win32":
self.dir_observe.schedule(self.callback, "/dev", recursive=True)
self.dir_observe.start()
self.update_files()
# This seems like a roundabout way to call 'update_files' However if it is not called in this way
# Graphical issues become present.It is called in this way to make the request come from the
# thread kivy is on
评论列表
文章目录