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 support for SimpleMenu to use custom select options #6480

Merged

Conversation

TrustyJAID
Copy link
Member

Description of the changes

Add the ability to customize the select options on SimpleMenu before sending. This Closes #6455.

Have the changes in this PR been tested?

Yes

@github-actions github-actions bot added the Category: Core - API - Utils Package This is related to stuff in `redbot.core.utils` label Nov 24, 2024
Copy link
Member

@Jackenmen Jackenmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't the remove_item + add_item change the item order, if use_select_only is True?

@TrustyJAID
Copy link
Member Author

Do you mean the order of the components, i.e. where the select menu appears in the grid? If so then we don't offer a guarantee on that with this view. They appear in order preferring buttons then the menu last. If someone were to add their own components those would usually come after but could now come before the select menu. This PR is largely just so what was asked can be achieved without accessing private attributes. If people want complete control on the order of the components they should make their own view.

@Jackenmen
Copy link
Member

Jackenmen commented Dec 24, 2024

I think the order we define in __init__:

if self.use_select_menu and self.source.is_paginating():
if self.use_select_only:
self.remove_item(self.stop_button)
self.add_item(self.select_menu)
self.add_item(self.stop_button)
else:
self.add_item(self.select_menu)

will no longer do anything since start()/start_dm() immediately changes it.

@TrustyJAID
Copy link
Member Author

Ah that order, that was a special case so that a close button appeared under the select menu when applied. I can fix the logic so that is accounted for.

@TrustyJAID
Copy link
Member Author

Actually upon testing it is working as expected. This is because when we initially define each of the components their row is set automatically and when removed that spot is now free to be refilled. So the order does not change when we define it in init.

@Jackenmen
Copy link
Member

I see. I don't really have any other complaints so...

Copy link
Member

@Jackenmen Jackenmen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jackenmen Jackenmen added this to the 3.5.14 milestone Dec 24, 2024
@Jackenmen Jackenmen added the Type: Enhancement Something meant to enhance existing Red features. label Dec 24, 2024
@Jackenmen Jackenmen merged commit f4ffc6b into Cog-Creators:V3/develop Dec 24, 2024
17 of 18 checks passed
@red-githubbot red-githubbot bot added the Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. label Dec 24, 2024
@Jackenmen Jackenmen added Type: Deprecation This intends to deprecate some functionality. Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. Changelog Entry: Added Changelog entry for this PR has already been added to changelog PR. and removed Changelog Entry: Pending Changelog entry for this PR hasn't been added by repo maintainers yet. labels Dec 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` Changelog Entry: Added Changelog entry for this PR has already been added to changelog PR. Type: Deprecation This intends to deprecate some functionality. Type: Enhancement Something meant to enhance existing Red features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow custom select options in SimpleMenu
2 participants