Use standard titlebar for lookup panel

Also fix cancel button for adding a custom lookup not working. Fixes #1967459 [[Enhancement - Content server] Make the Lookup page layout more similar to other pages](https://bugs.launchpad.net/calibre/+bug/1967459)
This commit is contained in:
Kovid Goyal 2022-04-01 10:49:05 +05:30
parent 228c3c90bd
commit d02988d466
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 9 deletions

View File

@ -522,13 +522,7 @@ class WordActionsOverlay: # {{{
pass # Dont allow panel to be closed by a click
def show(self, container):
container.style.backgroundColor = get_color('window-background')
container.appendChild(E.div(
style='padding: 1ex 1em; border-bottom: solid 1px currentColor; display:flex; justify-content: space-between',
E.h2(_('Lookup: {}').format(self.word)),
E.div(svgicon('close'), style='cursor:pointer', onclick=def(event):event.preventDefault(), event.stopPropagation(), self.overlay.hide_current_panel(event);, class_='simple-link'),
))
container.appendChild(E.div())
simple_overlay_title(_('Lookup: {}').format(self.word), self.overlay, container)
create_word_actions_panel(container, self.word, self.overlay.hide)
# }}}

View File

@ -63,10 +63,10 @@ def add_custom(container_id):
E.tr(E.td('\xa0'), E.td('\xa0')),
E.tr(E.td(_('URL:') + '\xa0'), E.td(E.input(type='url', name='url'))),
)))
container.append(E.div(style='margin: 1rem',
container.append(E.div(style='margin: 1rem; display: flex',
create_button(_('Add'), 'plus', add.bind(None, container_id), highlight=True),
'\xa0',
create_button(_('Cancel'), toggle_custom_container.bind(None, container_id, False)),
create_button(_('Cancel'), action=toggle_custom_container.bind(None, container_id, False)),
))
container.querySelector('input').focus()
@ -135,6 +135,7 @@ def create_word_actions_panel(container, word, close_panel_func):
nonlocal current_data
word = str.replace(word, '\u00ad', '')
current_data = word, close_panel_func
container.appendChild(E.div())
container.appendChild(E.div(style='display:none'))
populate_list(container)