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

[ext.pages] General fixes and enhancements #1227

Merged
merged 15 commits into from
Apr 6, 2022
Merged

[ext.pages] General fixes and enhancements #1227

merged 15 commits into from
Apr 6, 2022

Conversation

krittick
Copy link
Contributor

@krittick krittick commented Apr 4, 2022

Summary

This PR makes the following changes:

  • Paginator.update_custom_view() - New method used to easily change the custom view shown with the paginator without needing to use Paginator.update() to do so.
  • Page.custom_view - New parameter, represents a custom view assigned to a Page object, which will be displayed when that page is being displayed. Overrides any defined Paginator.custom_view while the page is being displayed.
  • Paginator.goto_page() now accepts a keyword argument interaction. If provided, the message associated to the paginator will be edited via that interaction's response path. If not, the discord.Message object assigned to Paginator.message will be used to edit the message instead.
  • Added Page.callback() method, which can be used to assign a callback to a specific page.
    • Added Paginator.page_action() method which triggers the callback of the currently displayed page, if one is defined.
    • Added Paginator.trigger_on_display parameter which makes goto_page automatically call Paginator.page_action() whenever a Page with a defined callback is displayed.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

krittick added 4 commits April 3, 2022 17:05
… edit the message (used by default), otherwise fall back to message attr edit path

adds `custom_view` parameter to `Page` object, which overrides the custom view for the paginator when that page is being shown

to better accommodate the above item, a new method `update_custom_view` has been added which will change the `custom_view` of a paginator when called.

various other docstring fixes and cleanup
@krittick krittick added bug Something isn't working priority: high High Priority status: awaiting review Awaiting review from a maintainer feature Implements a feature Merge with squash ext.pages Relating to ext.pages labels Apr 4, 2022
@krittick krittick added this to the v2.0 milestone Apr 4, 2022
@krittick krittick self-assigned this Apr 4, 2022
@krittick
Copy link
Contributor Author

krittick commented Apr 5, 2022

Added Page.callback() and Paginator.page_action() methods to provide an easy way to trigger an action for the currently displayed page.

@krittick krittick enabled auto-merge (squash) April 5, 2022 05:22
@krittick krittick marked this pull request as draft April 5, 2022 08:22
auto-merge was automatically disabled April 5, 2022 08:22

Pull request was converted to draft

@krittick
Copy link
Contributor Author

krittick commented Apr 5, 2022

Moving to draft status while I work on polishing a couple of the newer items added.

@krittick krittick marked this pull request as ready for review April 5, 2022 19:16
@krittick
Copy link
Contributor Author

krittick commented Apr 5, 2022

This is ready for review (again). Slight breaking change introduced by the removal of a return value for Paginator.goto_page() to accommodate the use of interaction as a possible route for editing the page message (i.e. less ambiguity).

@Lulalaby
Copy link
Member

Lulalaby commented Apr 5, 2022

LGTM for me. Not approving tho

@Lulalaby Lulalaby enabled auto-merge (squash) April 6, 2022 13:53
@Lulalaby Lulalaby merged commit e06af8c into Pycord-Development:master Apr 6, 2022
krittick added a commit that referenced this pull request Apr 15, 2022
…dating messages, matching the recent changes made by #1227 (#1267)

fixes #1265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ext.pages Relating to ext.pages feature Implements a feature priority: high High Priority status: awaiting review Awaiting review from a maintainer
Projects
Status: No status
4 participants