Partition create_annotations.pyj

This commit is contained in:
Kovid Goyal 2020-07-26 10:24:10 +05:30
parent 8cbb068b04
commit 12d1b31e98
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -16,11 +16,7 @@ from read_book.shortcuts import shortcut_for_key_event
from widgets import create_button from widgets import create_button
# TODO: class AnnotationsManager: # {{{
# Export all annots as plain text/JSON
class AnnotationsManager:
def __init__(self, view): def __init__(self, view):
self.view = view self.view = view
@ -131,6 +127,7 @@ class AnnotationsManager:
if h.spine_name is name and not h.removed and h.start_cfi: if h.spine_name is name and not h.removed and h.start_cfi:
ans.push(h) ans.push(h)
return ans return ans
# }}}
WAITING_FOR_CLICK = 1 WAITING_FOR_CLICK = 1
@ -206,7 +203,7 @@ def create_bar():
return ans return ans
class EditNotesAndColors: class EditNotesAndColors: # {{{
def __init__(self, container, hide_middle, accept, current_notes, current_style): def __init__(self, container, hide_middle, accept, current_notes, current_style):
self.initial_style = current_style self.initial_style = current_style
@ -365,9 +362,10 @@ class EditNotesAndColors:
is_dark = max(rgba[0], rgba[1], rgba[2]) < 115 is_dark = max(rgba[0], rgba[1], rgba[2]) < 115
fg = light_fg if is_dark else dark_fg fg = light_fg if is_dark else dark_fg
return {'background-color': bg, 'color': fg} return {'background-color': bg, 'color': fg}
# }}}
class CreateAnnotation: class CreateAnnotation: # {{{
container_id = 'create-annotation-overlay' container_id = 'create-annotation-overlay'
@ -811,3 +809,4 @@ class CreateAnnotation:
else: else:
self.place_single_handle(self.left_handle, extents.start) self.place_single_handle(self.left_handle, extents.start)
self.place_single_handle(self.right_handle, extents.end) self.place_single_handle(self.right_handle, extents.end)
# }}}