mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use buttons for the library chooser on the home page
This commit is contained in:
parent
f9329fe5b6
commit
52f04cb714
1
imgsrc/srv/library.svg
Normal file
1
imgsrc/srv/library.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 17 17" version="1.1" x="0px" y="0px"><path d="M1.7866,6.5 L15.9196,6.5 C16.8236,6.5 17.1906,5.336 16.4496,4.818 L11.5146,1.363 C9.9166,0.244 7.7896,0.244 6.1916,1.363 L1.2566,4.818 C0.5156,5.336 0.8826,6.5 1.7866,6.5"/><polygon points="1.853 12.5 3.853 12.5 3.853 7.5 1.853 7.5"/><polygon points="4.853 12.5 6.853 12.5 6.853 7.5 4.853 7.5"/><polygon points="7.853 12.5 9.853 12.5 9.853 7.5 7.853 7.5"/><polygon points="10.853 12.5 12.853 12.5 12.853 7.5 10.853 7.5"/><polygon points="13.853 12.5 15.853 12.5 15.853 7.5 13.853 7.5"/><polygon points="0.853 16.5 16.853 16.5 16.853 15.5 0.853 15.5"/><polygon points="1.853 14.5 15.853 14.5 15.853 13.5 1.853 13.5"/></svg>
|
After Width: | Height: | Size: 780 B |
@ -7,6 +7,7 @@ from elementmaker import E
|
||||
from session import get_interface_data
|
||||
from gettext import gettext as _
|
||||
from utils import conditional_timeout
|
||||
from widgets import create_button
|
||||
|
||||
from book_list.globals import get_db
|
||||
from book_list.cover_grid import BORDER_RADIUS
|
||||
@ -20,7 +21,7 @@ CLASS_NAME = 'home-page'
|
||||
add_extra_css(def():
|
||||
ans = ''
|
||||
sel = f'.{CLASS_NAME} '
|
||||
ans += build_rule(f'{sel} h2', padding='1em', font_size='1.5em')
|
||||
ans += build_rule(f'{sel} h2', padding='1rem', font_size='1.5em')
|
||||
sel += '.recently-read img'
|
||||
ans += build_rule(sel, max_width='25vw', height='auto', border_radius=f'{BORDER_RADIUS}px')
|
||||
ans += build_rule(f'{sel}:hover', transform='scale(1.2)')
|
||||
@ -91,18 +92,19 @@ def init(container_id):
|
||||
conditional_timeout(recent_container_id, 5, show_recent)
|
||||
|
||||
# Choose library
|
||||
cl = E.div(
|
||||
E.h2(_('Choose the calibre library to browse…'))
|
||||
)
|
||||
container.appendChild(cl)
|
||||
container.appendChild(E.h2(_('Choose the calibre library to browse…')))
|
||||
container.appendChild(E.div(style='display: flex'))
|
||||
cl = container.lastChild
|
||||
lids = sorted(interface_data.library_map, key=def(x): return interface_data.library_map[x];)
|
||||
for library_id in lids:
|
||||
library_name = interface_data.library_map[library_id]
|
||||
if library_name:
|
||||
cl.appendChild(E.div(E.a(library_name, href='javascript: void(0)', title=library_name, data_lid=library_id, onclick=def(ev):
|
||||
lib_id = ev.currentTarget.dataset.lid
|
||||
show_panel('book_list', {'library_id': lib_id})
|
||||
)))
|
||||
cl.appendChild(
|
||||
create_button(library_name, icon='library', action=def(ev):
|
||||
lib_id = ev.currentTarget.dataset.lid
|
||||
show_panel('book_list', {'library_id': lib_id})
|
||||
))
|
||||
cl.lastChild.style.margin = '1ex 1rem'
|
||||
|
||||
|
||||
set_default_panel_handler(init)
|
||||
|
Loading…
x
Reference in New Issue
Block a user