刷新/重新加载FileChooser [英] Refresh / Reload FileChooser

查看:83
本文介绍了刷新/重新加载FileChooser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在与FileChooser进行大量合作,但在

Currently I'm working with FileChooser a lot and I didn't find any mention of refreshing the widget in the docs. The widget is awesome, but if someone wants to refresh shown files, a movement from current directory is necessary to refresh files.

问题是当您将单个目录作为rootpath并且内部只有文件时,因此无法进行此类移动.

The problem is when you have a single directory as a rootpath and inside are only files, therefore no such movement is possible.

我的问题是,如果我想避免浪费性地删除/添加FileChooser并尽可能将其嵌套在kv文件中的FileChooser尽可能短的话,该如何刷新窗口小部件.

My question was how to refresh the widget if I want to avoid any wasteful removing/adding of FileChooser and do it as short as possible for a FileChooser that is very nested in a kv file.

推荐答案

在搜索filechooser.py之后,我发现了

After I searched filechooser.py I found the code which is triggered on each movement between directories. Giving the fact the FileChooserIconView and FileChooserListView inherit from FileChooserController, the access to the function is simple and no additional imports are required.


比方说我们有filechooser = FileChooserIconView():


Let's say we have filechooser = FileChooserIconView():

filechooser._update_files()效果很好,当FileChooser嵌套在某处时,通过id

filechooser._update_files() works well and when is FileChooser nested somewhere, it's easy to access it with id

要进行更多调整,Clock.schedule_interval(filechooser._update_files, t)可能会有所帮助,您可以在合理的时间内更新目录内容.

For more tweaks Clock.schedule_interval(filechooser._update_files, t) may be helpful where you can update your directory content within a reasonable time.

(我在这里添加它,因为我没有提到它,但是它可能对某人有用.)

(I add it here, because I found no mention of it, however it may be useful to someone.)

这篇关于刷新/重新加载FileChooser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆