add multiselect option type and allow mods to open their own settings #62
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
Jameson
joke
options window
question
Split!
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
sparkle-devs/sparkle!62
Loading…
Reference in a new issue
No description provided.
Delete branch "better-options"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Self explantory. Multiselect options follow a format like this:
Options is a dictionary similar to a dropdown menu, and default is just the values that should e enabled. It looks like this:

And for the second part, a mod can open their own settings by calling
this.api.openSettings(). I have added documentation for that function, and example.js has a menu option for it.Upon an initial review, it looks good to me, but I'll need some more time to test it out before I approve anything.
Is there any chance that you can add a feature to open a dialog with the options API's style of layout specification and have it return the resulting values without saving them anywhere?
So something that takes in a option format and options and returns (probably via callback, like how DialogBoxMorph works) the new options?
Precisely, but just to be very clear: I don't want this mechanism to change or read from the addon's settings. I want it to be independent from that altogether.
@codingisfun2831t Why does each option have an inherent value assigned to it? Wouldn't it be better to just make each one produce a Boolean and then have the addon handle the rest?
What do you mean?
Nevermind, I wasn't thinking too clearly yesterday. What do the values in the options dictionary do?
Basically, it's like the
display=valuething in Snap! Menus. The display is what gets displays to the user (nice, human readable string), and the value is what actually gets stored.Why are we storing string values like that though? Wouldn't it be easier to just do booleans (true/false) and let the addon do the rest?
A dictionary of { value=selected}?
Yes.
I just think it's a bit easier for the program. For example, if you need to check if something belongs in the list.
What's wrong with the expression
this.options.validHellos["Hi"]instead ofthis.options.validHellos.includes("hi")? The former is much clearer in intent because you're getting the Boolean value for a string key, instead of checking for a string in a list.Hmmm.. actually, yeah. Let me change it real quick. And can the custom options dialog be postponed to another PR?
Yes.
Can this be merged soon?
I'll see what I can do.
@codingisfun2831t Looks good to me! Merging now. Thanks for the contribution!