Skip to content

Commit 61e53c5

Browse files
committed
get_line_filters
1 parent 46b9753 commit 61e53c5

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020
- Added `OptionList.set_options` https://github.com/Textualize/textual/pull/6048
2121
- Added `TextArea.suggestion` https://github.com/Textualize/textual/pull/6048
2222
- Added `TextArea.placeholder` https://github.com/Textualize/textual/pull/6048
23-
- Added `Widget.get_line_filters`
23+
- Added `Widget.get_line_filters` and `App.get_line_filters` https://github.com/Textualize/textual/pull/6057
2424

2525
### Changed
2626

src/textual/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,12 @@ def __init__(
842842
)
843843
)
844844

845-
@property
846-
def _enabled_filters(self) -> list[LineFilter]:
845+
def get_line_filters(self) -> Sequence[LineFilter]:
846+
"""Get currently enabled line filters.
847+
848+
Returns:
849+
A list of [LineFilter][textual.filters.LineFilter] instances.
850+
"""
847851
return [filter for filter in self._filters if filter.enabled]
848852

849853
@property

src/textual/dom.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,20 +1144,6 @@ def _get_subtitle_style_information(
11441144
VisualStyle.from_rich_style(styles.border_subtitle_style),
11451145
)
11461146

1147-
# @property
1148-
# def background_colors(self) -> tuple[Color, Color]:
1149-
# """The background color and the color of the parent's background.
1150-
1151-
# Returns:
1152-
# `(<background color>, <color>)`
1153-
# """
1154-
# base_background = background = BLACK
1155-
# for node in reversed(self.ancestors_with_self):
1156-
# styles = node.styles
1157-
# base_background = background
1158-
# background += styles.background.tint(styles.background_tint)
1159-
# return (base_background, background)
1160-
11611147
@property
11621148
def background_colors(self) -> tuple[Color, Color]:
11631149
"""Background colors adjusted for opacity.

src/textual/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,9 @@ def get_line_filters(self) -> Sequence[LineFilter]:
679679
"""Get the line filters enabled for this widget.
680680
681681
Returns:
682-
A sequence of LineFilter instances.
682+
A sequence of [LineFilter][textual.filters.LineFilter] instances.
683683
"""
684-
return self.app._enabled_filters
684+
return self.app.get_line_filters()
685685

686686
def preflight_checks(self) -> None:
687687
"""Called in debug mode to do preflight checks.

0 commit comments

Comments
 (0)