Add control to TabbedContent message.

This commit is contained in:
Rodrigo Girão Serrão
2023-05-04 19:04:10 +01:00
parent 9d1f0283b2
commit a30cd159c4
2 changed files with 27 additions and 4 deletions

View File

@@ -21,12 +21,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Markdown document sub-widgets now reference the container document
- Table of contents of a markdown document now references the document
- Added the `control` property to messages
- `OptionList.OptionHighlighted` and `OptionList.OptionSelected`
- `Tree.NodeSelected`, `Tree.NodeHighlighted`, `Tree.NodeExpanded`, and `Tree.NodeCollapsed`
- `DirectoryTree.FileSelected`
- `ListView.Highlighted` and `ListView.Selected`
- `Markdown.TableOfContentsUpdated`, `Markdown.TableOfContentsSelected`, and `Markdown.LinkClicked`
- `ListView`
- `Highlighted`
- `Selected`
- `Markdown`
- `TableOfContentsUpdated`
- `TableOfContentsSelected`
- `LinkClicked`
- `OptionList`
- `OptionHighlighted`
- `OptionSelected`
- `RadioSet.Changed`
- `TabContent.TabActivated`
- `Tree`
- `NodeSelected`
- `NodeHighlighted`
- `NodeExpanded`
- `NodeCollapsed`
## [0.23.0] - 2023-05-03

View File

@@ -96,9 +96,20 @@ class TabbedContent(Widget):
tab: The Tab widget that was selected (contains the tab label).
"""
self.tabbed_content = tabbed_content
"""The `TabbedContent` widget that contains the tab activated."""
self.tab = tab
"""The `Tab` widget that was selected (contains the tab label)."""
super().__init__()
@property
def control(self) -> TabbedContent:
"""The `TabbedContent` widget that contains the tab activated.
This is an alias for [`TabActivated.tabbed_content`][textual.widgets.TabbedContent.TabActivated.tabbed_content]
and is used by the [`on`][textual.on] decorator.
"""
return self.tabbed_content
def __rich_repr__(self) -> Result:
yield self.tabbed_content
yield self.tab