Current implementation of MenuPages.show_checked_page() is the following:
async def show_checked_page(self, page_number):
max_pages = self._source.get_max_pages()
try:
if max_pages is None:
# If it doesn't give maximum pages, it cannot be checked
await self.show_page(page_number)
elif max_pages > page_number >= 0:
await self.show_page(page_number)
except IndexError:
# An error happened that can be handled, so ignore it.
pass
Before making a PR I wanted to check if the following implementation is something you would like to see implemented Danny.
async def show_checked_page(self, page_number: int) -> None:
max_pages = self._source.get_max_pages()
try:
if max_pages is None:
# If it doesn't give maximum pages, it cannot be checked
await self.show_page(page_number)
elif page_number >= max_pages:
await self.show_page(0)
elif page_number < 0:
await self.show_page(max_pages - 1)
elif max_pages > page_number >= 0:
await self.show_page(page_number)
except IndexError:
# An error happened that can be handled, so ignore it.
pass
This implementation would allow the menu to go to the last page when pressing back on Page 0, and go to first page when pressing Next on Page -1
Current implementation of
MenuPages.show_checked_page()
is the following:Before making a PR I wanted to check if the following implementation is something you would like to see implemented Danny.
This implementation would allow the menu to go to the last page when pressing back on Page 0, and go to first page when pressing Next on Page -1