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

Allow custom select options in SimpleMenu #6455

Closed
CattoFace opened this issue Sep 21, 2024 · 1 comment · Fixed by #6480
Closed

Allow custom select options in SimpleMenu #6455

CattoFace opened this issue Sep 21, 2024 · 1 comment · Fixed by #6480
Labels
Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` Status: PRs Welcome No one is currently assigned to this issue, but we'd be grateful if anyone made a PR. Type: Enhancement Something meant to enhance existing Red features.

Comments

@CattoFace
Copy link

CattoFace commented Sep 21, 2024

Type of feature request

API functionality

Description of the feature you're suggesting

SimpleMenu should allow custom names for the pages instead of the hardcoded "Page X".
The most straight forward solution I can see is to take an optional list of names when creating the menu and if its given, use it instead of generating the "Page X" list.
My cog currently "hacks" the existing behavior using

menu.select_options = [discord.SelectOption(label=n, value=num) for num, (n,_) in enumerate(menu_items)]
menu.select_menu = menu._get_select_menu()
menu.add_item(menu.select_menu)

(menu_items is a list of tuples of (name,content) in this case)

Anything else?

I can write a pull request myself if needed.

@CattoFace CattoFace added the Type: Feature New feature or request. label Sep 21, 2024
@github-actions github-actions bot added the Status: Needs Triage This has not been labeled or discussed for handling yet. label Sep 21, 2024
@TrustyJAID
Copy link
Member

TrustyJAID commented Sep 21, 2024

SimpleMenu is meant to be a quick easy way to create a menu by providing the list of pages. It's an evolution on Red's original menu system adding some quality of life with the select menu picker to jump to specific pages. Generally I would recommend making your own view and menu if you want to customize the select pages. Alternatively since SimpleMenu is a view you can just write your own select menu to add to it with the add_item method.

The only complex part of SimpleMenu is how it handles when there's more than 25 options in your list.

In order to support this I would suggest moving self.select_menu = self._get_select_menu() into the start and start_dm methods so that the select options can be modified using menu.select_options = <list of SelectOption> without needing to call the internal method _get_select_menu.

@Flame442 Flame442 added Type: Enhancement Something meant to enhance existing Red features. Closed: Won't Fix It's supposed to be this way or we're not interested in fixing this. There's probably a good reason. and removed Type: Feature New feature or request. Status: Needs Triage This has not been labeled or discussed for handling yet. labels Nov 24, 2024
@Flame442 Flame442 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2024
@Flame442 Flame442 reopened this Nov 24, 2024
@Flame442 Flame442 added Status: PRs Welcome No one is currently assigned to this issue, but we'd be grateful if anyone made a PR. Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` and removed Closed: Won't Fix It's supposed to be this way or we're not interested in fixing this. There's probably a good reason. labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` Status: PRs Welcome No one is currently assigned to this issue, but we'd be grateful if anyone made a PR. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants