-
-
Notifications
You must be signed in to change notification settings - Fork 483
feat: General enhancements for views #3093
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
Draft
NeloBlivion
wants to merge
82
commits into
Pycord-Development:master
Choose a base branch
from
NeloBlivion:view_additions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+447
−20
Draft
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
c68ede8
introduce replace_item and some additional patches
NeloBlivion f757ac0
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 56b5b46
cls
NeloBlivion ec0ddfa
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] deeed74
rework underlying
NeloBlivion c085789
Merge branch 'master' into cv2_fixes
NeloBlivion 130fab8
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 45da8fe
maybe fixed
NeloBlivion aadf0ed
,
NeloBlivion 3289505
or
NeloBlivion d984274
spacing
NeloBlivion 97db5d4
replace and remove on gallery
NeloBlivion 3775262
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a5d076c
index
NeloBlivion 22aaeb1
select_type
NeloBlivion d06f364
row
NeloBlivion 6906ae5
type
NeloBlivion d993efe
cl
NeloBlivion 3fc8b2a
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cb403d2
fix(actions): rework release workflow (#3034)
Lulalaby 7d65cf4
Merge branch 'master' into cv2_fixes
Paillat-dev 5bfee91
Merge branch 'master' into cv2_fixes
Lulalaby d16f857
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8f048e1
Merge branch 'master' into cv2_fixes
Lulalaby 1074d51
Merge branch 'master' into cv2_fixes
Lulalaby 91390cb
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2f48c7b
revert cl
NeloBlivion ea33a62
files
NeloBlivion 2ba67c3
file again
NeloBlivion 3c49f09
one more
NeloBlivion 738b6ee
Merge branch 'master' into cv2_fixes
NeloBlivion 1ae6835
cl
NeloBlivion eb9fa92
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2488e63
buildout for new features & items aliases
NeloBlivion 5ebdeaa
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 050f639
fix
NeloBlivion d831318
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6eb6086
6496c4c
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] de61d8e
fix modal typing
NeloBlivion 718fe73
Merge branch 'master' into cv2_fixes
NeloBlivion bc785f4
Merge branch 'master' into cv2_fixes
NeloBlivion 66a4db6
correct return types
NeloBlivion de42bb6
fix modal error docs
NeloBlivion c4000cb
remove incorrect release script
NeloBlivion 2f3da73
Merge branch 'master' into cv2_fixes
NeloBlivion c7a3983
fix paginator
NeloBlivion 5e02950
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 572fe5a
doc fix
NeloBlivion d9b9c1f
add convenience methods to DesignerView
NeloBlivion a054102
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9adf32d
Merge branch 'master' into cv2_fixes
Dorukyum 2728982
adjust underlying order
NeloBlivion 534f743
fix fileupload
NeloBlivion 7cf34bd
Merge branch 'master' into cv2_fixes
NeloBlivion 9db2632
misc
NeloBlivion d6e287d
view.add_row
NeloBlivion eba1d9e
Merge branch 'master' into cv2_fixes
NeloBlivion 4dccef7
Merge branch 'Pycord-Development:master' into cv2_fixes
NeloBlivion 6e5507a
misc fixes
NeloBlivion 01e95f8
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0678073
fix
NeloBlivion 2a4e4d5
adjust legacy item attributes
NeloBlivion 71a0e81
Merge branch 'master' into cv2_fixes
NeloBlivion 99ecd2c
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 23b7743
width docs adjustment
NeloBlivion fb2e439
Merge branch 'master' into cv2_fixes
NeloBlivion 23be55b
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7c69fb0
Merge branch 'master' into view_additions
NeloBlivion 12caf98
Update CHANGELOG.md
NeloBlivion 4b71a77
Merge branch 'master' into view_additions
NeloBlivion 5d8609c
Merge branch 'master' into view_additions
NeloBlivion f12147d
Merge branch 'master' into view_additions
NeloBlivion db9a63c
Message.get_view
NeloBlivion 66054a0
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a985986
Merge branch 'master' into view_additions
Lulalaby 2fb1ac5
Merge branch 'master' into view_additions
Paillat-dev d46f6e8
Merge branch 'master' into view_additions
NeloBlivion 6d30016
adjust imports
NeloBlivion 065e1a1
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 68e8252
sure whatever i hate this
NeloBlivion 4c89957
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,6 +186,39 @@ def remove_item(self, item: ViewItem | str | int) -> Self: | |
| pass | ||
| return self | ||
|
|
||
| def replace_item( | ||
| self, original_item: ViewItem | str | int, new_item: ViewItem | ||
| ) -> Self: | ||
| """Directly replace an item in this section. | ||
| If an :class:`int` is provided, the item will be replaced by ``id``, otherwise by ``custom_id``. | ||
| Parameters | ||
| ---------- | ||
| original_item: Union[:class:`ViewItem`, :class:`int`, :class:`str`] | ||
| The item, item ``id``, or item ``custom_id`` to replace in the section. | ||
| new_item: :class:`ViewItem` | ||
| The new item to insert into the section. | ||
| """ | ||
|
|
||
| if not isinstance(new_item, ViewItem): | ||
| raise TypeError(f"expected ViewItem not {new_item.__class__!r}") | ||
|
|
||
| if isinstance(original_item, (str, int)): | ||
| original_item = self.get_item(original_item) | ||
| if not original_item: | ||
| raise ValueError(f"Could not find original_item in section.") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Albeit a bit weird, this error would also raise if a user (incorrectly) passes None or another falsy value as |
||
| try: | ||
| if original_item is self.accessory: | ||
| self.accessory = new_item | ||
| else: | ||
| i = self.items.index(original_item) | ||
| self.items[i] = new_item | ||
| original_item.parent = None | ||
| new_item.parent = self | ||
| except ValueError: | ||
| raise ValueError(f"Could not find original_item in section.") | ||
| return self | ||
|
|
||
| def get_item(self, id: int | str) -> ViewItem | None: | ||
| """Get an item from this section. Alias for `utils.get(section.walk_items(), ...)`. | ||
| If an ``int`` is provided, it will be retrieved by ``id``, otherwise it will check the accessory's ``custom_id``. | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be if, elif, else : return None and would be clearer I think ?