Commit Graph

3031 Commits

Author SHA1 Message Date
Will McGugan
a46eda2fa0 Added blog 2022-11-06 15:41:12 +00:00
Will McGugan
ae61749a8d Merge pull request #1116 from davep/shebang-friendly
Let `textual run` run files that don't end in .py
2022-11-05 13:04:54 +00:00
Dave Pearson
76360204b5 Only cover the actual IO with the IOError
https://github.com/Textualize/textual/pull/1116#discussion_r1014606445
2022-11-05 09:57:31 +00:00
Dave Pearson
83de33f537 Add missing return type annotation
https://github.com/Textualize/textual/pull/1116#discussion_r1014606239

Don't try and cram "a quick change in before dinner", it never ends well.
2022-11-05 09:54:48 +00:00
Dave Pearson
90470d1098 Merge pull request #1114 from overflowy/refactor-block
Refactor by swapping if/else, remove unnecessary else, merge nested ifs
2022-11-04 17:42:14 +00:00
Dave Pearson
c0e00919aa Merge pull request #1113 from overflowy/replace-fstring-with-string
Replace f-string without interpolated values with string
2022-11-04 17:40:49 +00:00
Dave Pearson
20f20e3875 Let textual run run files that don't end in .py
It's not uncommon to create "standalone" commands in Python that don't end
in a .py and which:

  #!/usr/bin/ev python

or a variation on that theme. This commit makes it so that `textual run`
will treat a file that's named and set to run like that as if it were a file
that ends in .py.

See #1106.
2022-11-04 17:21:55 +00:00
overflowy
0cd699a523 Refactor by swapping if/else, remove unnecessary else, merge nested ifs 2022-11-04 12:08:47 +01:00
overflowy
c889a21f14 Replace f-string without interpolated values with string 2022-11-04 11:59:55 +01:00
Dave Pearson
686f27eb39 Merge pull request #1103 from davep/empty-yield
Empty yield
2022-11-03 16:42:04 +00:00
Dave Pearson
a16b6ecd23 Merge branch 'main' into empty-yield 2022-11-03 16:35:25 +00:00
Dave Pearson
9b85a433dd Tidy up some empty yields 2022-11-03 16:34:54 +00:00
Will McGugan
8cfff549f7 Merge pull request #1095 from davep/mount-relative
Add support for mounting widgets relative to other widgets
2022-11-03 16:20:30 +00:00
Dave Pearson
b0d2caf221 Add unit tests for mounting relative to -2
To satisfy https://github.com/Textualize/textual/pull/1095#discussion_r1013041338
2022-11-03 15:49:15 +00:00
Dave Pearson
3a771fb3b1 Drop the return type of App._register_child
Also add the docstring https://github.com/Textualize/textual/pull/1095#discussion_r1013034272
2022-11-03 15:43:57 +00:00
Dave Pearson
c5d8911d7d Make black happy again 2022-11-03 15:38:23 +00:00
Dave Pearson
e406df0740 Merge pull request #1102 from davep/there-can-only-be-one
Change query_one so that it raises an error on multiple hits
2022-11-03 15:36:05 +00:00
Dave Pearson
724a55a6a2 Merge branch 'mount-relative' of github.com:davep/textual into mount-relative 2022-11-03 15:24:06 +00:00
Dave Pearson
82674ad181 Merge branch 'Textualize:main' into mount-relative 2022-11-03 15:23:09 +00:00
Dave Pearson
9d5d0e6f5d Remove debug logging now we're close to happy with the new mount approach
As per https://github.com/Textualize/textual/pull/1095#discussion_r1013042951
2022-11-03 15:20:50 +00:00
Dave Pearson
0ff550c481 Improve text of an exceptrion
Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2022-11-03 15:17:56 +00:00
Dave Pearson
c1cfdffc96 Change query_one so that it raises an error on multiple hits
As part of this, add a only_one method to DOMQuery.

Addresses #1096.
2022-11-03 13:44:51 +00:00
Will McGugan
530212fd4b Merge pull request #1100 from Textualize/fix-watchers
replace weaksets in reactive
2022-11-03 12:04:25 +00:00
Will McGugan
2cd7e47380 don't call watchers multiple times 2022-11-03 10:59:20 +00:00
Will McGugan
5bf612d0f6 whitespace 2022-11-03 10:51:37 +00:00
Will McGugan
a9352cd0ba replace weaksets in reactive 2022-11-03 10:49:12 +00:00
Will McGugan
d528e00915 Merge pull request #1097 from sayandipdutta/patch-1
chore(docs): Fix typo
2022-11-02 17:16:06 +00:00
Sayandip Dutta
e2935af8d6 chore(docs): Fixed typo
follow by -> followed by
2022-11-02 21:56:38 +05:30
Dave Pearson
abad0a311a Make NodeList._index "public"
See https://github.com/Textualize/textual/pull/1095#discussion_r1011988160
2022-11-02 16:10:34 +00:00
Dave Pearson
6c88c3c7f8 Remove hangover import of Union 2022-11-02 16:07:09 +00:00
Dave Pearson
f29015f70a Add a reminder to the mount tests about query_one
See https://github.com/Textualize/textual/issues/1096
2022-11-02 15:57:09 +00:00
Dave Pearson
b925fb6b19 Start unit tests for mounting 2022-11-02 15:18:49 +00:00
Dave Pearson
7bb39ef75b Always clean up when coming out of the Pilot 2022-11-02 14:35:21 +00:00
Dave Pearson
355ed008af Ensure the app is active before yielding the pilot 2022-11-02 14:23:21 +00:00
Dave Pearson
8d815f6dde Don't the widgets parameter with a different type 2022-11-02 13:33:07 +00:00
Dave Pearson
2df0144902 Remove the old _find_dom_spot tests
This set of tests got left over from the great renaming.
2022-11-02 11:39:58 +00:00
Dave Pearson
627486a42a Lots of reworking of the mount-before/after work
Lots of things going on here, mainly narrowing in on the final form.
2022-11-02 11:35:22 +00:00
Dave Pearson
016f7be83a Add an insert method to the NodeList 2022-11-01 22:26:38 +00:00
Dave Pearson
e35d146445 Tidy up and extend the DOM spot tests 2022-11-01 21:33:25 +00:00
Dave Pearson
3ed406f13f Tidy the flow through _find_spot
While it was mostly working okay, I felt it needed a wee bit more
protection, and also could stand to have some of the more extreme
type-checking complaints handled. At this point I feel the code is about as
tidy as it can get -- until I fully test it live and find other issues I
guess.

But this does pass the unit tests I've made for it so far.
2022-11-01 21:14:38 +00:00
Will McGugan
cc376a7cd5 Merge pull request #1089 from bryophyta/patch-1
Change `edit_uri` base path to `main` branch
2022-11-01 20:31:48 +00:00
Pete F
e56b4a1598 Change edit_uri base path to main branch
The existing path points to a `css` branch, which no longer exists.
2022-11-01 20:25:30 +00:00
darrenburns
5e64a9fb90 Introduce _typing module for version-dependent typing imports (#1088)
* Introduce _typing module for version-dependent typing imports

* Remove unused import
2022-11-01 17:13:42 +00:00
darrenburns
bbd811d671 Support multiple CSS files (#1079)
* Support multiple CSS paths

* Update a type to match docstring

* Ensure the demo app still works

* Use absolute paths in tests to (hopefully) appease Windows

* Notes about CSS changes in guide/docstrings, small grammar/typos fixes

* Move snapshot apps into snapshot_tests dir, improve messaging in snapshot output, add test for multiple css files interacting with classvar CSS

* Ensure consistent snapshot naming cross-platform

* Use rpartition instead of partition in import_app

* Fix handling of import_app when colon in arg

* Support paths containing Windows drive names in import_app

* Add note on new relative paths in snap_compare

* Update docs/guide/CSS.md

Co-authored-by: Will McGugan <willmcgugan@gmail.com>

* Fix formatting

* Update CHANGELOG to mention CSS_PATH supporting a list

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2022-11-01 17:13:25 +00:00
Dave Pearson
39b23e1f51 WIP: Starting work on adding before/after mount directions
This is still a work-in-progress, but this feels like a good point to commit
for safe keeping. This is a non-working WIP.
2022-11-01 17:01:56 +00:00
Dave Pearson
cee69fbc32 Add an _index method to NodeList
This maps on to a normal List.index.
2022-11-01 10:55:15 +00:00
Dave Pearson
0403cfdc98 Merge pull request #1087 from davep/add-node-list-tests
Add unit tests for the NodeList class
2022-11-01 10:23:57 +00:00
Dave Pearson
294166cfec Add unit tests for the NodeList class 2022-11-01 09:58:32 +00:00
Dave Pearson
3f3ba3279a Merge pull request #1086 from davep/drop-prenamed-mount
Drop support for anonymous vs named widget mounting
2022-11-01 09:50:01 +00:00
Dave Pearson
637732ee59 Merge branch 'main' into drop-prenamed-mount 2022-11-01 09:36:19 +00:00