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

Added custom search engine input #2088 #2134

Merged
merged 4 commits into from
Oct 20, 2022
Merged

Conversation

PhantomLel
Copy link
Contributor

Added input on the general menu to add a custom search engine.

Copy link
Collaborator

@Davidy22 Davidy22 left a comment

Choose a reason for hiding this comment

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

Works great and mostly looks good, just one spot that could probably be adjusted for safety


selected = self.settings.general.get_int("search-engine")
# if custom search is selected, get the engine from the 'custom-search-engine' setting
if selected == 4:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The check for the custom option should be checking to see if it's the last index. Hardcoding to 4 can generate unexpected bugs if the list of preset search engines changes length in the future.

guake/prefs.py Outdated
self.get_widget("search_engine_select").set_active(value)
# if 'Custom' is selected make the search engine input editable
if value == 4:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar deal here

@PhantomLel
Copy link
Contributor Author

I can't find anyway to get the length of the ComboBox. Do you know of a method to do that?

@Davidy22
Copy link
Collaborator

You can query the length of a combobox if you already have a pointer to it, but to my knowledge it's a bit ugly getting that when the combobox is nestled deep in a glade layout because there's no get element by id equivalent, but we also have the ENGINES dict that you defined that should mirror the length of the available options pretty reliably that you can use.

@PhantomLel
Copy link
Contributor Author

Alright that's what I was thinking. Thanks!

Copy link
Collaborator

@Davidy22 Davidy22 left a comment

Choose a reason for hiding this comment

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

Looks good, merging. Thanks for the contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants