Skip to content

Added custom search engine input #2088 - #2134

Merged
Davidy22 merged 4 commits into
Guake:masterfrom
PhantomLel:master
Oct 20, 2022
Merged

Added custom search engine input #2088#2134
Davidy22 merged 4 commits into
Guake:masterfrom
PhantomLel:master

Conversation

@PhantomLel

Copy link
Copy Markdown
Contributor

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

@Davidy22 Davidy22 left a comment

Copy link
Copy Markdown
Collaborator

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

Comment thread guake/callbacks.py Outdated

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
Copy Markdown
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.

Comment thread guake/prefs.py Outdated
custom_search.set_text(self.settings.general.get_string("custom-search-engine"))
self.get_widget("search_engine_select").set_active(value)
# if 'Custom' is selected make the search engine input editable
if value == 4:

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Alright that's what I was thinking. Thanks!

@Davidy22 Davidy22 left a comment

Copy link
Copy Markdown
Collaborator

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.

2 participants