Commit Graph

5752 Commits

Author SHA1 Message Date
Rodrigo Girão Serrão
b9c6aec2e6 Add clarifications. 2023-03-28 15:07:39 +01:00
Rodrigo Girão Serrão
3a6967341c Remove dead import. 2023-03-28 15:03:30 +01:00
Rodrigo Girão Serrão
e2a16b5696 Add snapshot test for hot reloading. 2023-03-28 15:01:51 +01:00
Rodrigo Girão Serrão
474d5bc784 Add mechanism to run arbitrary code before screenshot. 2023-03-28 14:59:43 +01:00
Will McGugan
c7103faae4 Merge branch 'main' into fix-2063 2023-03-28 10:35:06 +01:00
Rodrigo Girão Serrão
d787f61090 State version of widget addition in docs. (#2144)
* State version of widget addition in docs.

Related issues: #2133

* Fix ListX version info.

* Retroactively update changelog.
2023-03-27 22:32:18 +01:00
Will McGugan
a69b863005 fix for active message pump (#2148)
* fix for active message pump

* Add log file

* changelog
2023-03-27 22:31:30 +01:00
Rodrigo Girão Serrão
977698c99d Merge pull request #2145 from Textualize/drop-uvloop
Drop implicit uvloop support.
2023-03-27 18:45:25 +01:00
Rodrigo Girão Serrão
11971446de Drop implicit uvloop support.
Related issues: #2051.
2023-03-27 18:37:21 +01:00
Rodrigo Girão Serrão
054c2f34d6 Merge pull request #2142 from Textualize/update-border-docs
Update docs with new border type.
2023-03-27 17:42:42 +01:00
Rodrigo Girão Serrão
f6f80249ee Snapshot update. 2023-03-27 17:31:47 +01:00
Will McGugan
e8c40410ee check full map first (#2143) 2023-03-27 17:31:11 +01:00
Rodrigo Girão Serrão
9fa7de13dc Update docs with new border type.
Related PRs: #2139.
Related comments: https://github.com/Textualize/textual/pull/2139\#discussion_r1149249378
2023-03-27 16:55:26 +01:00
Will McGugan
0940546aab compositor refactor and transparent screens (#2139)
* compositor refactor and trasparent screens

* multuple layers

* catch screen stack error

* refinement

* error messages

* capture screen stack

* new border type

* Background screen

* borders and bindings

* snapshot

* screen docs

* fix for missing screens

* screens docs

* fix for non updating transparent screens

* fix background resize

* changelog

* copy

* superfluous function

* update diagram

* inline code

* Update CHANGELOG.md

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

* Update docs/guide/screens.md

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

* Apply suggestions from code review

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

* superfluous file

* Explicit None

* Apply suggestions from code review

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

* docstring

* update docstring

* docstring make property private

* Apply suggestions from code review

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

* docstring

* update docstring

* Apply suggestions from code review

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

* docstrings

* remove comment, add docstring

* Apply suggestions from code review

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

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-27 16:44:58 +01:00
Roy Attias
d0035b4d4b examples: json_tree: Use public attributes (#2138) 2023-03-27 14:26:55 +01:00
darrenburns
5cbc9277da Loosen importlib-metadata dependency specifier (#2140) 2023-03-27 11:14:45 +01:00
Will McGugan
844c6a006e fix post message 2023-03-24 21:33:40 +00:00
Will McGugan
32dc14e484 Fix scrollbar thumb (#2134)
* scrollbar tweak

* scrolbar rounding

* snapshot
2023-03-24 21:15:02 +00:00
Will McGugan
472b5cd946 snapshot test 2023-03-23 21:00:26 +00:00
Will McGugan
1e4dd1cee4 fix scrollbar thumb height 2023-03-23 20:59:44 +00:00
Will McGugan
11cf1f1d28 Fix map invalidation (#2129)
* Invalidation logic

* comment and docstring

* changelog

* snapshot
2023-03-23 18:36:46 +00:00
Rodrigo Girão Serrão
ac826e56bd Update changelog. 2023-03-23 17:39:42 +00:00
Rodrigo Girão Serrão
dce49cbefe Merge branch 'main' into fix-2063 2023-03-23 17:39:18 +00:00
Rodrigo Girão Serrão
676d93c80c Fix #2063.
Related issues: #2063. [skip ci]
2023-03-23 17:34:15 +00:00
Will McGugan
3fe04f7b2d Text log scroll end (#2127)
* added switches

* snapshot

* changelog

* tweak docstrings

* Update src/textual/widgets/_text_log.py

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

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-23 17:21:13 +00:00
Rodrigo Girão Serrão
8fd3ccb32c Add tests for action parsing. (#2112)
* Add tests for action parsing.

[skip ci]

* Fix action parsing issues.

Related issues: #2088.

* Simplify action parsing.

Turns out that we can just wrap the string that we want to parse as the arguments in '({string_here},)', as per @willmcgugan's comment in the PR review.

Related review comments: https://github.com/Textualize/textual/pull/2112\#issuecomment-1481015988

---------

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2023-03-23 15:54:06 +00:00
Will McGugan
a4252a5760 auto table (#2123)
* auto table

* ws

* debug
2023-03-23 15:47:14 +00:00
Rodrigo Girão Serrão
700481129e Merge pull request #2124 from Textualize/rodrigogiraoserrao-patch-1
Update CHANGELOG.md
2023-03-23 15:44:01 +00:00
Rodrigo Girão Serrão
8708f7b8bb Update CHANGELOG.md 2023-03-23 15:01:50 +00:00
Rodrigo Girão Serrão
139896260b Merge pull request #2102 from Textualize/verb-methods-return-self
Return 'self' in some widget verb methods.
2023-03-23 15:00:18 +00:00
Will McGugan
461db5dcd6 enable console markup (#2122)
* enable console markup

* changelog

* snapshot
2023-03-23 14:56:35 +00:00
Will McGugan
5a00dcdeff comment in diagnose 2023-03-23 13:34:23 +00:00
Rodrigo Girão Serrão
b3e6f7a9a6 Merge pull request #2119 from Textualize/fix-2107
Use consistent phrasing in styles reference
2023-03-23 12:05:12 +00:00
Rodrigo Girão Serrão
48d0547d86 Merge branch 'main' into fix-2107 2023-03-23 11:04:21 +00:00
Rodrigo Girão Serrão
559f976f78 Add more consistent phrasing.
Related issues: #2107
2023-03-23 11:04:17 +00:00
Rodrigo Girão Serrão
65e005cffe Return 'self' explicitly.
Related review comment: https://github.com/Textualize/textual/pull/2102\#pullrequestreview-1354201387
2023-03-23 10:07:33 +00:00
Rodrigo Girão Serrão
e15805b93b Fix #1540. (#2097) 2023-03-23 09:38:50 +00:00
Rodrigo Girão Serrão
7316b5b6b0 Merge pull request #2113 from Textualize/fix-border-example
Improve subsection titles.
2023-03-23 09:13:51 +00:00
Rodrigo Girão Serrão
f9922ebe29 Improve subsection titles.
Related issues: #2108
Related PRs: #2110, #2064
2023-03-22 23:00:13 +00:00
Rodrigo Girão Serrão
a935a632fa Merge pull request #2110 from Textualize/fix-2108
Fix missing border example.
2023-03-22 22:48:37 +00:00
Rodrigo Girão Serrão
9c672e69f0 Fix missing border example.
Related issues: #2108
Related PRs: #2064
2023-03-22 21:05:10 +00:00
Will McGugan
e758514ff3 word 2023-03-22 13:52:31 +00:00
Will McGugan
9529cac352 Version 0.16.0 (#2106)
* snapshot

* words

* word update
v0.16.0
2023-03-22 13:38:23 +00:00
Rodrigo Girão Serrão
2a810f8c87 Implement border (sub)title. (#2064)
* Add Widget.border_title and border_subtitle.

Related issues: #1864

* Test setting border_(sub)title.

* Add border (sub)title references to StylesCache.

These internal references will make it easier for the instance of 'StylesCache' to know which border (sub)title to use, if/when needed.

* Add method to render border label.

* Add styles to align border (sub)title.

* Render border labels.

* Update styles template.

* Make new 'render_row' parameters optional.

* Add (sub)title border snapshot tests.

* Document border (sub)title and styles.

* Pass (sub)title directly as arguments.

Get rid of the watchers to make data flow easier to follow.
Related comment: https://github.com/Textualize/textual/pull/2064/files\#r1137746697

* Tweak example.

* Fix render_border_label.

This was wrong because border labels can be composed of multiple segments if they contain multiple styles. Additionally, we want to render a single blank space of padding around the title.

* Ensure we get no label when there's no space.

* Add tests for border label rendering.

* 'render_border_label' now returns iterable of segments.

* Add label to render_row.

* Fix calling signature in tests.

* Add padding to snapshot tests.

* Fix changelog.

* Update snapshot tests.

* Update snapshot tests.

* Border labels expand if there's no corners.

* Update CHANGELOG.md

* Fix docs.

* Remove irrelevant line.

* Fix snapshot tests.

* Don't share Console among tests.

* Simplify example in styles guide.

* Avoid expensive function call when possible.

* rewording

* positive branch first

* remove wasteful indirection

* fix changelog

---------

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2023-03-22 11:07:38 +00:00
Rodrigo Girão Serrão
b4c2afe789 Remove fat-finger deletion. 2023-03-22 09:53:54 +00:00
Rodrigo Girão Serrão
d32694f176 Update docstrings. 2023-03-22 09:39:40 +00:00
Rodrigo Girão Serrão
16bdcf8f1d Return 'self' in some widget verb methods.
I compiled a list of all widget methods that return 'None' and for which it _could_ make sense to make this change.
(I filtered out some methods, like watch and action methods.)

I tried choosing a subset of those methods, trying to only pick methods for which there weren't two things that could be returned (e.g., 'Widget.move_child' _could_ return either the widget or the child that was moved) and I also tried to only pick methods that have little or no parameters (e.g., 'Widget.animate' has many parameters and is typically called with quite a few.

These are all the 'Widget' methods for which this could make sense:
- 'move_child' (either return 'self' or the actual 'child' that was moved…)
- 'animate'
- 'scroll_to' / 'scroll_relate' / 'scroll_home' / 'scroll_end' / 'scroll_left' / 'scroll_right' / 'scroll_down' / 'scroll_up' / 'scroll_page_up' / 'scroll_page_down' / 'scroll_page_left' / 'scroll_page_right' / 'scroll_visible'
- 'refresh'
- 'focus' / 'reset_focus'
- 'capture_mouse' / 'release_mouse'

Additionally, I looked at each widget, and found these methods:
- 'Tree'
    - 'TreeNode'
        - 'expand' / 'expand_all' / 'collapse' / 'collapse_all' / 'toggle' / 'toggle_all'
        - 'set_label'
    - 'clear' / 'reset'
    - 'select_node' (either return 'self' or the actual 'node' that was selected)
    - 'scroll_to_line' / 'scroll_to_node'
    - 'refresh_line'
- 'ToggleButton'
    - 'toggle' (and 'action_toggle'?)
- 'TextLog'
    - 'write'
    - 'clear'
- 'Tabs'
    - 'add_tab' / 'remove_tab'
    - 'clear'
- 'Switch'
    - 'toggle' (and 'action_toggle'?)
- 'Static'
    - 'update'
- 'Pretty'
    - 'update'
- 'Placeholder'
    - 'cycle_variant'
- '_markdown.py'
    - 'MarkdownBlock'
        - 'set_content'
    - 'MarkdownTableOfContents'
        - 'set_table_of_contents'
- 'Input'
    - 'insert_text_at_cursor'
- 'DirectoryTree'
    - 'load_directory'
- 'DataTable'
    - 'update_cell' / 'update_cell_at'
    - 'clear'
    - 'refresh_coordinate' / 'refresh_row' / 'refresh_column'
    - 'sort'
- 'Button'
    - 'press'

Related issues: #1908
Related discussions: #1817
2023-03-22 08:17:00 +00:00
Rodrigo Girão Serrão
29692736d0 Merge pull request #2095 from Textualize/fix-1438
Allow paths when creating 'DirectoryTree'.
2023-03-21 14:35:28 +00:00
Rodrigo Girão Serrão
f92c939511 Rename variable. 2023-03-21 14:27:03 +00:00
Rodrigo Girão Serrão
2d70172b8e Allow paths when creating 'DirectoryTree'.
Related issues: #1438.
2023-03-21 14:18:49 +00:00