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 disable_all_items in View #1199

Merged
merged 23 commits into from Apr 29, 2022
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5005ec1
Add `disable_all_items` in `View`
27Saumya Mar 26, 2022
72a820d
Update view.py
27Saumya Mar 26, 2022
fc284e0
add suggested changes
27Saumya Mar 28, 2022
64f5d94
fix: add suggested changes
27Saumya Apr 11, 2022
981a326
Merge branch 'master' into disable-view
Lulalaby Apr 11, 2022
be46a6e
Merge branch 'Pycord-Development:master' into disable-view
27Saumya Apr 12, 2022
cbef3fc
feat: add supporr for Item object in `exclusions`
27Saumya Apr 12, 2022
91d7a1d
fix: typehint
27Saumya Apr 12, 2022
faa2143
fix: parenthesis
27Saumya Apr 12, 2022
b410845
Merge branch 'master' into disable-view
Lulalaby Apr 12, 2022
c7b58d4
Merge branch 'Pycord-Development:master' into disable-view
27Saumya Apr 12, 2022
85c9b58
feat: add more checks in `View.disable_all_items`
27Saumya Apr 12, 2022
78d6349
fix: typehint
27Saumya Apr 12, 2022
2ed6f3d
Merge branch 'master' into disable-view
27Saumya Apr 19, 2022
d7e859b
Merge branch 'Pycord-Development:master' into disable-view
27Saumya Apr 21, 2022
e63cf16
feat: remove `int` from `exclusions`
27Saumya Apr 21, 2022
630e7c0
fix: code fixes
27Saumya Apr 21, 2022
0a69fe8
Update discord/ui/view.py
Lulalaby Apr 21, 2022
f31e2fe
Merge branch 'master' into disable-view
27Saumya Apr 24, 2022
e76acfe
Merge branch 'Pycord-Development:master' into disable-view
27Saumya Apr 26, 2022
667a9e1
fix: `exclusions` param -> optional
27Saumya Apr 26, 2022
58a8827
Update discord/ui/view.py
Lulalaby Apr 28, 2022
295298b
Merge branch 'master' into disable-view
Lulalaby Apr 28, 2022
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
Expand Up @@ -465,6 +465,19 @@ async def wait(self) -> bool:
"""
return await self.__stopped

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

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


class ViewStore:
def __init__(self, state: ConnectionState):
Expand Down