Commit Graph

6052 Commits

Author SHA1 Message Date
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
Dave Pearson
730f78757a Merge pull request #2409 from TomJGooding/fix-switch-correct-attribute-name-in-changed-docstring
fix(switch): correct attribute in changed docstring
2023-04-27 18:59:19 +01:00
TomJGooding
c063c3ecdf fix(switch): correct attribute in Changed docstring 2023-04-27 18:42:46 +01:00
Sebastian Pipping
eab1328ccc Fix demo example CSS (fixes #2389) (#2393)
* demo.py: Stop cutting of demo.css content after 50 lines

* demo.py: Drop unused variable EXAMPLE_CSS

* demo.py: Simplify derivation of example_css
2023-04-27 15:27:43 +01:00
Will McGugan
124c45e68c Bump0220 (#2405)
* Version bump

* upate version

* fix domain name

* wrong project

* skip on Windows

* disable demo snapshot

* 37 fix
v0.22.0
2023-04-27 15:01:46 +01:00
Will McGugan
dd70a7a2dc fix for min and max with fr unints (#2390)
* fix for min and max with fr unints

* snapshit

* forgot snapshit tests

* fix resolve

* added unit tests

* Windoze fix
2023-04-27 13:35:16 +01:00
Dave Pearson
fe99df95fc Fix light mode plain text in non-syntax code blocks in Markdown (#2402)
Bit of a workaround at the moment; ideally longer-term we'll go with
something less hard-coded.

See #2400
2023-04-27 12:03:05 +01:00
Will McGugan
55e198767f Add progress bar to gallery (#2399)
* Add progress bar to gallery

* table fix
2023-04-27 11:37:53 +01:00
Dave Pearson
01df8b0726 Make textual.containers 1fr in meaningful dimensions by default (#2386)
* Make all containers 1fr

An unintended consequence of changes made to containers in v0.21.0 (#2377)
is something like #2385 so this commit sort of rolls that change back, and
solidifies how containers are styled by default in respect to their width
and height. Where appropriate the dimensions will be 1fr.

* Make the DEFAULT_CSS of ProgressBar less greedy

It was attempting to style a Vertical that is uses, but in doing so was
styling all Verticals rather than a Vertical within a ProgressBar.

This fixes that.

* Update the CHANGELOG for the container changes

* Move the ProgressBar CHANGELOG entry into the next release section

* Link the container change entry in the CHANGELOG to its PR

Now that the PR is PRd and we have a PR
2023-04-26 17:07:30 +01:00