Commit Graph

6264 Commits

Author SHA1 Message Date
Rodrigo Girão Serrão
7a8d6920e8 Error when dismissing non-active screen.
Related issues: #2575.
2023-05-16 11:14:54 +01:00
Rodrigo Girão Serrão
9b09b19e5f Update workflows.
This caches the virtual environment so we don't have to download it every time (the cache can be cleared from the repository > Actions > Caches (on the left).

We also split black formatting into a separate workflow.
This means we can run black ONLY when *.py files are changed.
It also means all other testing jobs don't need to _also_ check formatting.
2023-05-16 10:18:30 +01:00
Will McGugan
6147c28dbf arrange refactor (#2569)
* arrange refactor

* Apply suggestions from code review

Co-authored-by: Dave Pearson <davep@davep.org>

* Apply suggestions from code review

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>

---------

Co-authored-by: Dave Pearson <davep@davep.org>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-05-15 14:53:17 +01:00
Rodrigo Girão Serrão
1bba3973bf Merge pull request #2568 from Textualize/empty-paste
Fix empty paste
2023-05-15 14:31:14 +01:00
Rodrigo Girão Serrão
720bd37bba Consume event. 2023-05-15 14:22:16 +01:00
Rodrigo Girão Serrão
f02e2fcdd9 Short-circuit paste on empty text.
Related comments: https://github.com/Textualize/textual/pull/2568#discussion_r1193790630
2023-05-15 14:12:22 +01:00
Rodrigo Girão Serrão
81289c328a Fix empty paste.
Related issues: #2563.
2023-05-15 13:25:01 +01:00
Rodrigo Girão Serrão
fe7812d94d Add regression test for #2563. 2023-05-15 13:24:48 +01:00
Dave Pearson
aff9bcdf93 Fix clearing an OptionList
See #2557, credit to Will:

  https://github.com/Textualize/textual/issues/2557#issuecomment-1546883815
2023-05-15 11:30:26 +01:00
Dave Pearson
d296fc5f04 Allow for passing in a selection as a tuple 2023-05-15 11:11:04 +01:00
Rodrigo Girão Serrão
83618db642 Merge pull request #2527 from Textualize/auto-focus
Add `auto_focus` to screens
2023-05-15 11:04:15 +01:00
Rodrigo Girão Serrão
0b6e3b3040 Merge branch 'main' into auto-focus 2023-05-15 10:41:15 +01:00
Rodrigo Girão Serrão
4db54eac4b Merge pull request #2530 from Textualize/move-child-no-op
Moving child before/after self is a no-op.
2023-05-15 10:39:57 +01:00
Rodrigo Girão Serrão
c967661699 Merge branch 'main' into move-child-no-op 2023-05-15 10:31:43 +01:00
Dave Pearson
258180c996 Add a selected flag to the Selection 2023-05-15 10:25:30 +01:00
Dave Pearson
8208388cf9 Allow for type unions under Python 3.7 2023-05-15 10:13:28 +01:00
Will McGugan
d266e3685f snapshot update (#2555) 2023-05-12 18:57:53 +02:00
Will McGugan
d061065dcc optimization for divide 2023-05-12 18:29:51 +02:00
Will McGugan
c2e7b619f1 Revert "virtual size and docks"
This reverts commit 9a134b4920.
2023-05-12 15:53:47 +02:00
Will McGugan
4e069abd2e Revert "remove total region update"
This reverts commit 47970dd622.
2023-05-12 15:49:39 +02:00
Will McGugan
47970dd622 remove total region update 2023-05-12 15:45:25 +02:00
Will McGugan
9a134b4920 virtual size and docks 2023-05-12 15:36:49 +02:00
Will McGugan
4434b59982 spacing diagram 2023-05-12 14:03:53 +02:00
Dave Pearson
a065ff572e Correct spelling in a docstring (#2552) 2023-05-12 09:34:27 +02:00
Dave Pearson
e0ac60ce03 Initial framework for the SelectionList
Nothing here actually implements a selection list yet; this just sets out
the very basic framework of the widget, as it inherits form OptionList. The
key things here are:

1. It introduces a Selection class, which is an Option with a typed value.
2. The SelectionList is also typed and expects Selections of that type.
2023-05-11 16:19:13 +01:00
Dave Pearson
5f839da684 Merge branch 'main' into directory-tree-work-in-worker 2023-05-11 15:32:17 +01:00
Dave Pearson
4d225b8ebb Correct a comment typo 2023-05-11 15:22:19 +01:00
Rodrigo Girão Serrão
4fc56f6db8 Merge pull request #2547 from Textualize/footer-css
Changelog.
2023-05-11 15:12:58 +01:00
Rodrigo Girão Serrão
8dc801fec7 Changelog. 2023-05-11 15:03:21 +01:00
Rodrigo Girão Serrão
a9c38793de Merge pull request #2546 from Textualize/footer-css
Use footer--description component class.
2023-05-11 15:01:01 +01:00
Rodrigo Girão Serrão
58cf825eb4 Use footer--description component class.
Related issues: #2544.
2023-05-11 12:19:29 +01:00
Dave Pearson
c45126b21c Update the ChangeLog 2023-05-11 11:19:30 +01:00
Dave Pearson
9b41b743fe Remove the artificial slowdown 2023-05-11 11:13:19 +01:00
Dave Pearson
05eeaa7679 Tidy up _load_directory
Explain some about the decisions made, and also throw in a bit of
over-cautious worker cancellation checking.
2023-05-11 10:53:07 +01:00
Dave Pearson
82a08177af Cancel any loads when resetting the tree 2023-05-11 09:59:57 +01:00
Dave Pearson
9ae8e47c6c Add a method for cancelling all of the load jobs
This marks all current jobs as cancelled and also removes all pending jobs.
2023-05-11 09:59:18 +01:00
Dave Pearson
08246d84ac Don't post the finished message if we've been cancelled 2023-05-11 09:57:30 +01:00
Dave Pearson
791f2ea189 Ensure we don't create a job for a node that's already being loaded 2023-05-11 09:16:54 +01:00
Dave Pearson
ce7a78db69 Have the reset method take part in background loading
One instance of a call to _load_directory that I missed.
2023-05-11 09:12:10 +01:00
Dave Pearson
4ead43c149 Set up the job tracking before setting the path
Setting the path to anything other than "." is going to result in a reset
happening, so we need the tracking support in place first.
2023-05-11 09:10:55 +01:00
Dave Pearson
df0f73ba3b Remove debug logging 2023-05-11 08:35:36 +01:00
Dave Pearson
05dc877a24 Check for the worker being cancelled
So far this is working fine, but there was an issue where, if the load of a
very large directory was started, and then the application was cancelled
right away, the application would close down but there would be a long pause
until the shell prompt came back, the cause presumably being that we were
waiting for that particular thread to end.

So here I make sure I check the cancelled state of the worker. This would
also suggest that, while I turned the use of iterdir into a loop so I could
throw the sleep in to emulate a slow directory load, I *actually* want to do
this in a loop so I can test the cancelled state as we stream in the
directory content.
2023-05-11 08:31:01 +01:00
Will McGugan
0dc89dc2a8 wrong axis 2023-05-10 22:25:04 +02:00
Will McGugan
5a02f7335e fix docstrings 2023-05-10 22:21:30 +02:00
Dave Pearson
39971876d0 WiP: Throttle back the number of concurrent loads of a DirectoryTree
Having got the initial version of background loading of nodes in the
directory tree working, this moves to a gentler approach where only so many
loads run at once, and a queue of jobs that need to be completed is kept.

This is an end-of-coding-session WiP commit; there's more to come on this.
But at the moment I'm happy with the way it's going.
2023-05-10 16:26:36 +01:00
Dave Pearson
cd05d6cad6 Merge branch 'main' into directory-tree-work-in-worker 2023-05-10 14:22:36 +01:00
Dave Pearson
2d75ca0d77 Merge pull request #2536 from davep/expand-tree-expand-messages
Ensure that `TreeNode` messages are posted when via-API changes are made
2023-05-10 14:18:24 +01:00
Rodrigo Girão Serrão
70e97c6703 Merge pull request #2532 from Textualize/sub-title-str
Allow setting (sub)title of any type.
2023-05-10 13:20:47 +01:00
Rodrigo Girão Serrão
8dd627b0f4 Merge branch 'main' into sub-title-str 2023-05-10 13:10:48 +01:00
Dave Pearson
8b9a8e4174 Simplify _load_directory
Move the node population code into its own method, the idea here being that
the update happens in one call to call_from_thread rather than spawning lots
of calls to it.
2023-05-10 12:06:11 +01:00