Start work on viewer search

This commit is contained in:
Kovid Goyal 2017-01-02 20:54:49 +05:30
parent a952cdd548
commit 0cf7ab6a2b
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,15 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import hash_literals, bound_methods
class SearchOverlay:
def __init__(self, view):
self.view = view
@property
def container(self):
return document.getElementById('book-search-overlay')
def hide(self):
self.container.style.display = 'none'

View File

@ -11,6 +11,7 @@ from book_list.globals import get_session_data, get_boss
from read_book.globals import messenger, iframe_id, current_book, set_current_spine_item from read_book.globals import messenger, iframe_id, current_book, set_current_spine_item
from read_book.resources import load_resources from read_book.resources import load_resources
from read_book.overlay import Overlay from read_book.overlay import Overlay
from read_book.search import SearchOverlay
from read_book.prefs.colors import resolve_color_scheme from read_book.prefs.colors import resolve_color_scheme
from read_book.prefs.font_size import change_font_size_by from read_book.prefs.font_size import change_font_size_by
from read_book.touch import set_left_margin_handler, set_right_margin_handler from read_book.touch import set_left_margin_handler, set_right_margin_handler
@ -67,11 +68,13 @@ class View:
E.div(style='height:{}px; width:100%; padding: 0'.format(sd.get('margin_bottom', 20)), id='book-bottom-margin'), E.div(style='height:{}px; width:100%; padding: 0'.format(sd.get('margin_bottom', 20)), id='book-bottom-margin'),
), ),
right_margin, right_margin,
E.div(style='position: absolute; top:0; left:0; width: 100%; height: 100%; display:none', id='book-overlay'), # overlay E.div(style='position: absolute; top:0; left:0; width: 100%; display:none', id='book-search-overlay'), # search overlay
E.div(style='position: absolute; top:0; left:0; width: 100%; height: 100%; display:none', id='book-overlay'), # main overlay
) )
) )
) )
) )
self.search_overlay = SearchOverlay(self)
self.overlay = Overlay(self) self.overlay = Overlay(self)
self.src_doc = None self.src_doc = None
self.iframe_ready = False self.iframe_ready = False
@ -121,6 +124,7 @@ class View:
change_font_size_by(delta) change_font_size_by(delta)
def show_chrome(self): def show_chrome(self):
self.search_overlay.hide()
self.overlay.show() self.overlay.show()
def set_margins(self): def set_margins(self):