mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Clean up button box
This commit is contained in:
parent
16d241b9d2
commit
fa13ee5943
@ -137,6 +137,13 @@ class EditNotesAndColors: # {{{
|
|||||||
|
|
||||||
remove_button = create_button(_('Remove style'), 'trash', self.remove_custom_color, _('Remove this custom highlight style'))
|
remove_button = create_button(_('Remove style'), 'trash', self.remove_custom_color, _('Remove this custom highlight style'))
|
||||||
remove_button.classList.add('remove-custom-color')
|
remove_button.classList.add('remove-custom-color')
|
||||||
|
apply_button = create_button(
|
||||||
|
_('Apply') if self.annot_id else _('Create'),
|
||||||
|
'check', finish,
|
||||||
|
(_('Finish editing highlight') if self.annot_id else _('Create highlight')) + ' [Ctrl+Enter]',
|
||||||
|
True
|
||||||
|
)
|
||||||
|
apply_button.style.marginLeft = apply_button.style.marginTop = 'auto'
|
||||||
|
|
||||||
c = E.div(
|
c = E.div(
|
||||||
style=f'background: {get_color("window-background")}; margin: auto; text-align: center; padding: 1ex;',
|
style=f'background: {get_color("window-background")}; margin: auto; text-align: center; padding: 1ex;',
|
||||||
@ -154,18 +161,11 @@ class EditNotesAndColors: # {{{
|
|||||||
style=f'display: flex; flex-wrap: wrap; width: 100%; justify-content: center',
|
style=f'display: flex; flex-wrap: wrap; width: 100%; justify-content: center',
|
||||||
),
|
),
|
||||||
E.div(
|
E.div(
|
||||||
style='width: 100%; display: flex; justify-content: space-between',
|
style='width: 100%; display: flex; flex-wrap: wrap',
|
||||||
E.div(
|
create_button(_('Cancel'), 'close', abort, _('Abort') + ' [Esc]'),
|
||||||
create_button(_('Cancel'), 'close', abort, _('Abort') + ' [Esc]'),
|
E.span('\xa0'),
|
||||||
E.span('\xa0'),
|
remove_button, apply_button
|
||||||
remove_button
|
),
|
||||||
),
|
|
||||||
create_button(
|
|
||||||
_('Apply') if self.annot_id else _('Create'),
|
|
||||||
'check', finish,
|
|
||||||
(_('Finish editing highlight') if self.annot_id else _('Create highlight')) + ' [Ctrl+Enter]', True),
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
self.container_id = c.id
|
self.container_id = c.id
|
||||||
container.appendChild(c)
|
container.appendChild(c)
|
||||||
@ -186,8 +186,7 @@ class EditNotesAndColors: # {{{
|
|||||||
def set_visibility_of_remove_button(self):
|
def set_visibility_of_remove_button(self):
|
||||||
c = self.container
|
c = self.container
|
||||||
item = c.querySelector('.current-swatch.custom-style')
|
item = c.querySelector('.current-swatch.custom-style')
|
||||||
visibility = 'unset' if item else 'hidden'
|
c.querySelector('.remove-custom-color').style.display = 'block' if item else 'none'
|
||||||
c.querySelector('.remove-custom-color').style.visibility = visibility
|
|
||||||
|
|
||||||
def add_color(self, hs, at_start):
|
def add_color(self, hs, at_start):
|
||||||
if self.seen_colors[hs.key]:
|
if self.seen_colors[hs.key]:
|
||||||
|
@ -743,7 +743,7 @@ class SelectionBar:
|
|||||||
_('Failed to apply highlighting, try adjusting extent of highlight')
|
_('Failed to apply highlighting, try adjusting extent of highlight')
|
||||||
)
|
)
|
||||||
self.annotations_manager.add_highlight(msg, self.current_highlight_style.style, notes)
|
self.annotations_manager.add_highlight(msg, self.current_highlight_style.style, notes)
|
||||||
if msg.type is 'edit-highlight':
|
elif msg.type is 'edit-highlight':
|
||||||
if self.state is WAITING:
|
if self.state is WAITING:
|
||||||
self.create_highlight()
|
self.create_highlight()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user