* 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>
* 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>
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