Commit Graph

6060 Commits

Author SHA1 Message Date
Dave Pearson
23d6c3611a Add DirectoryTree.reload
This is a general reload; reloading the whole tree.
2023-05-03 09:34:55 +01:00
Dave Pearson
3d6fd7ef4c Add a docstring to _load_directory 2023-05-03 09:13:42 +01:00
Dave Pearson
f509767141 Don't cast a DirEntry.path to a Path any more
It's always a Path now.
2023-05-03 09:13:11 +01:00
Dave Pearson
8311f837b8 Add a docstring to render_label
Well, okay, borrow the same from Tree.
2023-05-03 09:08:21 +01:00
Dave Pearson
d1d435d68b Flesh out the docstring for validate_path 2023-05-03 09:02:49 +01:00
Dave Pearson
e4c0517cc6 Add the node to the FileSelected message
Until now it wasn't really possible to know *which* DirectoryTree widget had
sent a given message; this makes it available by providing the `node`, which
in turn will provide the `tree`.
2023-05-03 08:58:11 +01:00
Dave Pearson
465f522ef3 Add a reminder to add the node to the FileSelected message 2023-05-02 16:48:06 +01:00
Dave Pearson
5f22cf8e7b Remove empty rule from DirectoryTree.DEFAULT_CSS 2023-05-02 16:46:07 +01:00
Dave Pearson
40e042d7e3 Make _load_directory private 2023-05-02 16:45:18 +01:00
Dave Pearson
d4af9d239f Add a path reactive to DirectoryTree so the path it views can be changed
A couple of things come with this, at least one being a breaking change of
sorts:

- DirectoryTree now has a path attribute
- DirectoryTree.path is a reactive
- When DirectoryTree.path is assigned to it rebuilds the tree content
- DirectoryTree.path can be assigned a str or Path but always evaluates to a Path
- DirEntry.path is now typed as a Path
- DirEntry drops is_dir (Directory.path.is_dir() does that job)
- DirectoryTree.FileSelected.path is now always a Path

This is the first of what might be a few changes here; the main thrust of
this commit being to allow changing a DirectoryTree to view a different
directory, and also to move to a Path-first approach.
2023-05-02 16:33:22 +01:00
Dave Pearson
922934597d Sort the component classes to match the docs 2023-05-02 16:30:16 +01:00
Dave Pearson
83c09b3cfd Add a missing type hint
Looks like this has been missing since DirectoryTree was first written.
2023-05-02 15:51:18 +01:00
Dave Pearson
d0639a0cc1 Correct the type of the TreeExpanded event
This looks to have been a slight typing bug all along.
2023-05-02 15:29:36 +01:00
Dave Pearson
16931a8563 Move DirectoryTree.FileSelected.path's doc to inline style
This brings it in line with the documentation for other widgets and their
messages.
2023-05-02 14:19:55 +01:00
Dave Pearson
8a29c7ea2c Merge pull request #2452 from davep/outline-top-bottom-colour-glitch
Fix outline-top and outline-bottom not handling colour alpha
2023-05-02 11:45:26 +01:00
Dave Pearson
16ca3e10d1 Merge branch 'main' into outline-top-bottom-colour-glitch 2023-05-02 11:34:14 +01:00
Dave Pearson
d34d1b19b2 Merge pull request #2444 from davep/overall-important
Make `!important` apply to rules that have "sub-rules"
2023-05-02 11:33:05 +01:00
Dave Pearson
9c26c6ef32 Merge branch 'main' into outline-top-bottom-colour-glitch 2023-05-02 11:05:52 +01:00
Dave Pearson
7e570df4f4 Fix outline-top and outline-bottom not handling colour alpha
See #2371.
2023-05-02 11:03:54 +01:00
Dave Pearson
87847cea4c Update the CHANGELOG 2023-05-02 10:16:45 +01:00
Dave Pearson
16d62dfb20 Distribute !important on scrollbar size 2023-05-02 10:13:24 +01:00
Dave Pearson
cbe418de18 Distribute !important on overflow 2023-05-02 10:12:18 +01:00
Will McGugan
e1a8f28f8d update to log docs (#2451) 2023-05-02 10:09:32 +01:00
Dave Pearson
ad37b6809a Distribute !important on content-align 2023-05-02 10:08:33 +01:00
Dave Pearson
763f9b012f Distribute !important on align 2023-05-02 10:06:17 +01:00
Dave Pearson
8fc6e195e1 Change the importance distribution method to be more generic 2023-05-02 09:49:06 +01:00
Dave Pearson
27ca4969a8 Add tests for styles that have "sub-styles" and !important
This is a series of tests for checking styles that have sub-styles, or
sub-parts, or whatever the correct name would be; the testing being that if
!important is applied to the whole, that it works.

Starting with #2420 it became apparent that this didn't work as intended,
and once that work started it became obvious that it affected more than just
border.

So these tests test all of the styles that can be specified as a single
whole, or as a set of parts (sides, directions, etc).
2023-05-02 09:36:08 +01:00
Dave Pearson
4ab9ba9268 Merge branch 'main' into overall-important 2023-05-02 08:46:52 +01:00
Will McGugan
83b1fcc102 raise attribute error (#2443)
* raise attribute error

* fix compute defaults
2023-05-01 16:57:40 +01:00
Will McGugan
ba90657559 update changelog 2023-05-01 16:36:05 +01:00
Will McGugan
20a1612361 Invalid pseudo selectors (#2445)
* token error

* error on bad pseudo selectors
2023-05-01 16:22:35 +01:00
Dave Pearson
60dc38c5cd Merge branch 'main' into overall-important 2023-05-01 16:22:09 +01:00
Dave Pearson
08de9a0fca Merge pull request #2442 from davep/private-watcher
Add support for private watch methods
2023-05-01 16:19:24 +01:00
Will McGugan
832d191bd3 bump poetry (#2447) 2023-05-01 15:35:58 +01:00
Dave Pearson
d6eb44bd19 Fix outline-right not being recognised
See #2446.
2023-05-01 15:21:12 +01:00
Dave Pearson
d6f304f5d1 Update the CHANGELOG 2023-05-01 15:19:24 +01:00
Dave Pearson
7a69c037b8 Distribute importance amongst all sides of an outline 2023-05-01 15:00:54 +01:00
Dave Pearson
883e293e1f Move the important distribution code into its own method
Border isn't the only place we're going to want to do this, so let's now
turn this into a more general body of code and have border use it.
2023-05-01 15:00:07 +01:00
Dave Pearson
5a355da78b Fixed !important not applying to border 2023-05-01 14:17:29 +01:00
Dave Pearson
54db445dd7 Change private watcher support call public and private if available
See https://github.com/Textualize/textual/pull/2442#issuecomment-1529512891

This changes the original PR so that, rather than calling a private watcher
instead of a public, as originally issued, we now call public and private,
if they're both there.

If they are both there private is called first.
2023-05-01 10:28:55 +01:00
Dave Pearson
847fd6e69e Add support for private watch methods
This change allows for private watch methods. By convention they start with
an underscore. If a reactive or var has a private watch method, it will be
used in preference to a public watch method.

With this change it becomes easier to have a private reactive/var whose
watcher is also private. For example:

    _counter = var(0)
    """This is a private counter, it won't appear in the docs."

    ...

    def _watch__counter(self) -> None:
        """Watch _counter, but don't appear in the docs either."
        ...

See #2382.
2023-05-01 10:01:50 +01:00
Will McGugan
8fac2c7d2a Bump0223 (#2424)
* button tweak

* fix for windows

* changelog
v0.22.3
2023-04-28 20:56:28 +01:00
Will McGugan
ecee8ef837 fix run on Windows 2023-04-28 20:29:21 -07:00
Will McGugan
c5053eca81 faster focus within (#2423) v0.22.2 2023-04-28 18:08:57 +01:00
Dave Pearson
32c74d9535 Merge pull request #2415 from davep/expose-node-tree
Add `TreeNode.tree`
2023-04-28 14:23:28 +01:00
Dave Pearson
40f7c97500 Merge branch 'main' into expose-node-tree 2023-04-28 13:58:04 +01:00
Will McGugan
e15df80a8c Version bump (#2418) v0.22.1 2023-04-28 12:38:02 +01:00
Will McGugan
16a1645671 revert timer change (#2417)
* revert timer change

* changelog
2023-04-28 11:47:28 +01:00
Will McGugan
7c696ce378 Updated docs for app.run (#2414)
* fix run app from python

* updated run

* remove function

* update help

* doc update
2023-04-28 10:47:24 +01:00
Dave Pearson
02ed90c633 Add TreeNode.tree
Currently, in the various TreeNode messages, and the handlers you'd write to
handle them, there's no way to easily know *which* tree sent the message and
so which tree the node belongs to.

This commit adds public access to the tree reference to the nodes, so that
in an event handler the developer can check the tree involved in the event.

See #2413.
2023-04-28 10:23:38 +01:00