Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add View.enable_all_items #1319

Merged
merged 2 commits into from
May 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions discord/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,19 @@ def disable_all_items(self, *, exclusions: Optional[List[Item]] = None) -> None:
for child in self.children:
if exclusions is None or child not in exclusions:
child.disabled = True

def enable_all_items(self, *, exclusions: Optional[List[Item]] = None) -> None:
"""
Enables all items in the view.

Parameters
-----------
exclusions: Optional[List[:class:`ui.Item`]]
A list of items in `self.children` to not enable from the view.
"""
for child in self.children:
if exclusions is None or child not in exclusions:
child.disabled = False


class ViewStore:
Expand Down