Commit Graph

6232 Commits

Author SHA1 Message Date
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
Rodrigo Girão Serrão
4148b1d450 Implement a Progress Bar widget. (#2333)
* First prototype of PB.

* Repurpose UnderlineBar.

* Factor out 'Bar' widget.

* Revert "Factor out 'Bar' widget."

This reverts commit 0bb4871adf.

* Add Bar widget.

* Cap progress at 100%.

* Add skeleton for the ETA label.

[skip ci]

* Add ETA display.

* Improve docstrings.

* Directly compute percentage.

* Watch percentage changes directly.

[skip ci]

* Documentation.

* Make reactive percentage private.

Instead, we create a public read-only percentage property.

* Update griffe to fix documentation issue.

Related issues: #1572, https://github.com/mkdocstrings/griffe/issues/128.
Related PRs: https://github.com/mkdocstrings/griffe/pull/135.

* Add example and docs.

* Address review feedback.

[skip ci]

* More documentation.

* Add tests.

* Changelog.

* More tests.

* Fix/fake tests.

* Final tweaks.
2023-04-26 15:25:39 +01:00
Will McGugan
ee0d407067 fix changelog 2023-04-26 14:01:15 +01:00
Will McGugan
f20df9b075 Bump0210 (#2381)
* new version

* docstring
v0.21.0
2023-04-26 13:55:41 +01:00
Will McGugan
f53c3cd589 container refactor (#2377)
* container refactor

* Rearrange css

* changelog

* try timer updates

* force update

* sleep idle

* Restore updates
2023-04-26 13:36:08 +01:00
Will McGugan
ff703ad983 pass through unprocessed args (#2374)
* pass through unprocesses args

* omit symbols

* extract args

* posix exception

* timer updates

* another update

* just work on windows damn it

* remove updates
2023-04-26 11:09:04 +01:00
Will McGugan
ec09fb5afc force updates 2023-04-26 10:23:23 +01:00
Dave Pearson
441b98d7a7 Merge pull request #2372 from davep/radioset-redux 2023-04-25 17:21:07 +01:00
Dave Pearson
7a536c790c Demo snapshot test back up to a 250 wait
Waiting 100 resulted in a fail, so let's bump back up again.
2023-04-25 15:49:43 +01:00
Dave Pearson
db45287646 Lower the wait for the demo snapshot test
250 worked; so let's try it lower.
2023-04-25 15:41:02 +01:00
Dave Pearson
88926a4bb8 Force a wee wait when testing the demo
This keeps randomly failing in Windows in CI; multiple subsequent runs gets
it going in the end, normally one further fail at a time. So let's throw a
wee wait on the end and see if that helps.
2023-04-25 15:27:43 +01:00
Dave Pearson
f2c56e7cd5 Link the RadioSet CHANGELOG entry to the new PR 2023-04-25 15:17:02 +01:00
Dave Pearson
0d5db58692 Update the CHANGELOG 2023-04-25 15:09:35 +01:00
Dave Pearson
c45f9358ee Change RadioSet so it's less a container of widgets and more a widget
Initially we went with a RadioSet being a simple container of RadioButtons,
with the user navigating the RadioButtons like you would any other set of
widgets. This was fine but it became pretty clear pretty quickly that having
to tab through a non-trivial collection of buttons in a set to get to the
next widget wasn't ideal.

This commit, satisfying #2368, takes over the navigation of the buttons
within the container, makes the container itself a focusable widget, and
sets up some new bindings to allow a more natural and efficient interaction
with the set.
2023-04-25 15:00:44 +01:00
Dave Pearson
a6a373161f Add some unit testing of the new navigation 2023-04-25 12:06:46 +01:00
Dave Pearson
e16493bf81 Update the snapshot tests
This is necessary now that a focused RadioSet has acquired a border colour
similar to that if a focused Input.
2023-04-25 11:27:23 +01:00
Dave Pearson
59506f3292 Turn a RadioSet into a single focus switching site
With this commit a RadioSet becomes something you can tab into and out of
with just one keypress; navigation of the buttons within moves to being done
with the cursor keys instead.

See #2368.
2023-04-25 11:16:20 +01:00
Dave Pearson
b36afd80a7 Highlight a RadioSet when focus is within it 2023-04-25 10:13:30 +01:00
Dave Pearson
f1d70900cb Merge pull request #2367 from davep/tidy-builtin-actions
Tidy builtin actions
2023-04-24 16:13:35 +01:00
Dave Pearson
4047c83680 Update the CHANGELOG 2023-04-24 15:22:26 +01:00
Dave Pearson
b14b3b9e39 Expand the builtin action list in the docs 2023-04-24 15:12:51 +01:00