mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Specialize accept button text based on whether we are editing a current annotation or not
This commit is contained in:
parent
5d63ddfc03
commit
b8e04661b7
@ -117,9 +117,10 @@ def custom_styles_equal(a, b):
|
|||||||
|
|
||||||
class EditNotesAndColors: # {{{
|
class EditNotesAndColors: # {{{
|
||||||
|
|
||||||
def __init__(self, container, is_dark_theme, current_notes, current_style, close_editor):
|
def __init__(self, container, is_dark_theme, current_notes, current_style, annot_id, close_editor):
|
||||||
self.initial_style = current_style
|
self.initial_style = current_style
|
||||||
self.is_dark_theme = is_dark_theme
|
self.is_dark_theme = is_dark_theme
|
||||||
|
self.annot_id = annot_id
|
||||||
|
|
||||||
def finish():
|
def finish():
|
||||||
close_editor(True)
|
close_editor(True)
|
||||||
@ -159,7 +160,10 @@ class EditNotesAndColors: # {{{
|
|||||||
E.span('\xa0'),
|
E.span('\xa0'),
|
||||||
remove_button
|
remove_button
|
||||||
),
|
),
|
||||||
create_button(_('Finish'), 'check', finish, _('Finish editing highlight') + ' [Ctrl+Enter]', True),
|
create_button(
|
||||||
|
_('Apply') if self.annot_id else _('Create'),
|
||||||
|
'check', finish,
|
||||||
|
(_('Finish editing highlight') if self.annot_id else _('Create highlight')) + ' [Ctrl+Enter]', True),
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -607,8 +607,9 @@ class SelectionBar:
|
|||||||
clear(container)
|
clear(container)
|
||||||
container.style.display = 'block'
|
container.style.display = 'block'
|
||||||
self.state = EDITING
|
self.state = EDITING
|
||||||
|
cs = self.view.currently_showing.selection
|
||||||
self.current_editor = EditNotesAndColors(
|
self.current_editor = EditNotesAndColors(
|
||||||
container, self.view.current_color_scheme.is_dark_theme, notes, highlight_style, self.hide_editor)
|
container, self.view.current_color_scheme.is_dark_theme, notes, highlight_style, cs.annot_id, self.hide_editor)
|
||||||
self.place_editor()
|
self.place_editor()
|
||||||
|
|
||||||
def place_editor(self):
|
def place_editor(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user