Lookup word should work on content server as well

This commit is contained in:
Kovid Goyal 2020-07-24 18:01:02 +05:30
parent 7d00a8cf12
commit de76fbbda2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 10 deletions

View File

@ -44,8 +44,7 @@ class SelectionBar:
if ui_operations.copy_selection: if ui_operations.copy_selection:
bar.appendChild(cb('copy', _('Copy to clipboard'), self.copy_to_clipboard)) bar.appendChild(cb('copy', _('Copy to clipboard'), self.copy_to_clipboard))
if ui_operations.toggle_lookup: bar.appendChild(cb('library', _('Lookup/search selected word'), self.lookup))
bar.appendChild(cb('library', _('Lookup/search selected word'), self.lookup))
bar.appendChild(cb('highlight', _('Highlight selection'), self.create_highlight)) bar.appendChild(cb('highlight', _('Highlight selection'), self.create_highlight))
bar.appendChild(cb('close', _('Clear the selection'), self.clear_selection)) bar.appendChild(cb('close', _('Clear the selection'), self.clear_selection))
self.show_notes(bar_container, notes) self.show_notes(bar_container, notes)
@ -79,7 +78,10 @@ class SelectionBar:
ui_operations.copy_selection(self.view.currently_showing.selection.text) ui_operations.copy_selection(self.view.currently_showing.selection.text)
def lookup(self): def lookup(self):
ui_operations.toggle_lookup(True) if ui_operations.toggle_lookup:
ui_operations.toggle_lookup(True)
else:
self.view.overlay.show_word_actions(self.view.currently_showing.selection.text)
def clear_selection(self): def clear_selection(self):
self.view.on_handle_shortcut({'name': 'clear_selection'}) self.view.on_handle_shortcut({'name': 'clear_selection'})

View File

@ -250,7 +250,6 @@ class View:
'handle_keypress': self.on_handle_keypress, 'handle_keypress': self.on_handle_keypress,
'handle_shortcut': self.on_handle_shortcut, 'handle_shortcut': self.on_handle_shortcut,
'human_scroll': self.on_human_scroll, 'human_scroll': self.on_human_scroll,
'lookup_word': self.on_lookup_word,
'next_section': self.on_next_section, 'next_section': self.on_next_section,
'next_spine_item': self.on_next_spine_item, 'next_spine_item': self.on_next_spine_item,
'print': self.on_print, 'print': self.on_print,
@ -316,12 +315,6 @@ class View:
sd = get_session_data() sd = get_session_data()
self.set_scrollbar_visibility(not sd.get('book_scrollbar')) self.set_scrollbar_visibility(not sd.get('book_scrollbar'))
def on_lookup_word(self, data):
if runtime.is_standalone_viewer:
ui_operations.selection_changed(data.word)
return
self.overlay.show_word_actions(data.word)
def on_annotations_message(self, data): def on_annotations_message(self, data):
self.create_annotation.handle_message(data) self.create_annotation.handle_message(data)