Commit Graph

5829 Commits

Author SHA1 Message Date
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
Will McGugan
5cd1263875 Simplify driver (#2091)
* simplify driver

* fix headless driver

* docstrings and simplify

* tidy

* docstrings

* docstring

* docstring

* more docstrings

* import

* Update src/textual/app.py

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

* Update src/textual/driver.py

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

* docstring

* Update src/textual/drivers/linux_driver.py

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

* Update src/textual/drivers/linux_driver.py

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

* Update src/textual/drivers/linux_driver.py

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

* docstring

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-21 10:17:51 +00:00
Will McGugan
a08d8e417b full map optimization fix (#2092) 2023-03-20 15:30:52 +00:00
Will McGugan
7185e2930d Driver class environ (#2036)
* Driver class environment variable

* comments
2023-03-20 11:21:56 +00:00
Will McGugan
2a6368754a fix screenshot 2023-03-18 17:02:46 +00:00
Will McGugan
50f4bd5f46 remove fonts 2023-03-18 16:47:51 +00:00
Will McGugan
8fca0852d4 fix for scrollbar issue (#2086)
* fix for scrollbar issue

* pause between mouse messages
2023-03-18 13:55:24 +00:00
Jeff Epler
d999c69261 Allow customizing the markdown parser (#2075)
* Allow customizing the markdown parser

For instance, code using Markdown might wish to create a markdown
parser that does not parse embedded HTML:
```py
def parser_factory():
    parser = MarkdownIt("gfm-like")
    parser.options["html"] = False
    return parser
```

* blacken

* Implement requested changes

* fix AttributeError
2023-03-18 11:19:05 +00:00
Will McGugan
f5e779c4c4 tabbed content widget (#2059)
* tabbed content widget

* TabbedContent widget and docs

* missing docs

* fix active

* doc fix

* test fix

* additional test

* test for render_str

* docstring

* changelog

* doc update

* changelog

* fix bad optimization

* Update docs/widgets/tabbed_content.md

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

* fix for empty initial

* docstrings

* Update src/textual/widgets/_content_switcher.py

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

* docstring

* remove log

* permit nested tabs

* renamed TabsCleared to Cleared

* added tests, fix types on click

* tests

* fix broken test

* fix for nested tabs

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-18 10:38:41 +00:00
Will McGugan
2c120c0983 Replace markdown table (#2055)
* Replace markdown table

* snapshots

* fix markdown snapshot

* snapshot update

* imports and docstrings

* remove reference to DataTable

* typing fix
2023-03-18 10:38:26 +00:00
Will McGugan
45520f2da1 color tests to 100% (#2078)
* color tests to 100%

* tweak

* remove overly complex code
2023-03-16 11:42:51 +00:00
Will McGugan
de692aaf07 fix for remove nodes (#2080)
* fix for remove nodes

* added test
2023-03-16 11:36:10 +00:00
Will McGugan
a404ee5e01 add app to active message pump (#2071)
* add app to active message pump

* made sender private

* changelog
2023-03-16 11:26:08 +00:00
Will McGugan
43253f5d80 fix border issue (#2074)
* fix border issue

* add PR to changelog
2023-03-16 09:03:02 +00:00
Will McGugan
9b191914cb copy change 2023-03-15 20:28:02 +00:00
TomJGooding
111233f1b4 fix(markdown): handle hard line breaks (#2060) 2023-03-15 20:24:15 +00:00
Will McGugan
04340bd0ba new post (#2069)
* new post

* Update docs/blog/posts/await-me-maybe.md

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

* Update docs/blog/posts/await-me-maybe.md

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

* Update docs/blog/posts/await-me-maybe.md

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

* Update docs/blog/posts/await-me-maybe.md

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

* words

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-15 16:49:12 +00:00
Will McGugan
8d17ad39fd copy edit 2023-03-15 16:39:05 +00:00
Will McGugan
c889b4bfe9 words 2023-03-15 16:35:18 +00:00
Will McGugan
d64e9a7e67 Update docs/blog/posts/await-me-maybe.md
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-15 16:15:47 +00:00
Will McGugan
66535e9c07 Update docs/blog/posts/await-me-maybe.md
Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-15 16:01:11 +00:00
Will McGugan
01045e6b7f Update docs/blog/posts/await-me-maybe.md
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-15 16:00:55 +00:00
Will McGugan
dab39c719b Update docs/blog/posts/await-me-maybe.md
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-03-15 15:51:30 +00:00
Will McGugan
31be9e059e new post 2023-03-15 15:34:39 +00:00