files.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:SuperOcto 作者: mcecchi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号