mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix a regression that broke adding of new lookup sources. Fixes #1992278 [Could not add extra lookup sources](https://bugs.launchpad.net/calibre/+bug/1992278)
This commit is contained in:
parent
a1d2209fc7
commit
25c0b827c4
@ -32,6 +32,15 @@ def lookup_lang():
|
||||
return ans
|
||||
|
||||
|
||||
special_processors = {}
|
||||
|
||||
|
||||
def special_processor(func):
|
||||
special_processors[func.__name__] = func
|
||||
return func
|
||||
|
||||
|
||||
@special_processor
|
||||
def google_dictionary(word):
|
||||
ans = f'https://www.google.com/search?q=define:{word}'
|
||||
lang = lookup_lang()
|
||||
@ -44,7 +53,7 @@ vprefs.defaults['lookup_locations'] = [
|
||||
{
|
||||
'name': 'Google dictionary',
|
||||
'url': 'https://www.google.com/search?q=define:{word}',
|
||||
'special_processor': google_dictionary,
|
||||
'special_processor': 'google_dictionary',
|
||||
'langs': [],
|
||||
},
|
||||
|
||||
@ -393,7 +402,7 @@ class Lookup(QWidget):
|
||||
def special_processor(self):
|
||||
idx = self.source_box.currentIndex()
|
||||
if idx > -1:
|
||||
return self.source_box.itemData(idx).get('special_processor')
|
||||
return special_processors.get(self.source_box.itemData(idx).get('special_processor'))
|
||||
|
||||
@property
|
||||
def query_is_up_to_date(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user