Add base class for TabPane messages.
Related review comment: https://github.com/Textualize/textual/pull/3152#discussion_r1302921959.
This commit is contained in:
parent
79f8ab05b7
commit
9ef644cd77
1 changed files with 8 additions and 16 deletions
|
|
@ -52,11 +52,11 @@ class TabPane(Widget):
|
|||
"""
|
||||
|
||||
@dataclass
|
||||
class Disabled(Message):
|
||||
"""Sent when a tab pane is disabled via its reactive `disabled`."""
|
||||
class TabPaneMessage(Message):
|
||||
"""Base class for `TabPane` messages."""
|
||||
|
||||
tab_pane: TabPane
|
||||
"""The `TabPane` that was disabled."""
|
||||
"""The `TabPane` that is he object of this message."""
|
||||
|
||||
@property
|
||||
def control(self) -> TabPane:
|
||||
|
|
@ -68,21 +68,13 @@ class TabPane(Widget):
|
|||
return self.tab_pane
|
||||
|
||||
@dataclass
|
||||
class Enabled(Message):
|
||||
class Disabled(TabPaneMessage):
|
||||
"""Sent when a tab pane is disabled via its reactive `disabled`."""
|
||||
|
||||
@dataclass
|
||||
class Enabled(TabPaneMessage):
|
||||
"""Sent when a tab pane is enabled via its reactive `disabled`."""
|
||||
|
||||
tab_pane: TabPane
|
||||
"""The `TabPane` that was enabled."""
|
||||
|
||||
@property
|
||||
def control(self) -> TabPane:
|
||||
"""The tab pane that is the object of this message.
|
||||
|
||||
This is an alias for the attribute `tab_pane` and is used by the
|
||||
[`on`][textual.on] decorator.
|
||||
"""
|
||||
return self.tab_pane
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
title: TextType,
|
||||
|
|
|
|||
Loading…
Reference in a new issue