-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DirectoryTree should load a directory in a Worker #2456
Comments
Background requirement for this: the worst case scenario here would be that some code does Turns out that this doesn't currently work for It looks like |
Until now the Tree.NodeExpanded and Tree.NodeCollapsed messages were only sent out when changes were made to the tree by user interaction. This meant that if any changes were made with the TreeNode expand, expand_all, collapse, collapse_all, toggle or toggle_all API calls no messages would be sent. This PR corrects this. The work here is, in part, required for Textualize#2456 (DirectoryTree lazy-loads directory information on node expansion so if someone is expanding nodes under code control the DirectoryTree never gets to know that it should load a directory's content) and will build on Textualize#1644, essentially adding a missing aspect to the latter PR.
This isn't the final form, not even close, this is more to help test out the idea and how well it will work. Note the very deliberate sleep in the code that's there to emulate loading from a slow blocking source. This will be removed and tidied up before a final PR, of course. The main aim here is to emulate a worst-case scenario so that the use of a worker can be tried out with some confidence. See Textualize#2456.
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
- This regressed due to updates in Textual 0.25.0, because DirectoryTree now loads directory contents in a worker: Textualize/textual#2456 - Directory tree expansion may be more robust now, although it's using more internals now, and it still needs timers for whatever reason.
Getting the current directory is a blocking operation.
It is typically virtually instant, but it can be slow for larger directories. We should load the directory within a thread worker to avoid suspending the UI.
The text was updated successfully, but these errors were encountered: