mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
7760f53a70
commit
534e378abb
@ -20,7 +20,7 @@ def create_toc_panel(book, container, onclick, onclose):
|
|||||||
container.appendChild(E.div(
|
container.appendChild(E.div(
|
||||||
style='display: flex; justify-content: space-between; padding: 1ex 1em; border-bottom: solid 1px currentColor',
|
style='display: flex; justify-content: space-between; padding: 1ex 1em; border-bottom: solid 1px currentColor',
|
||||||
E.h2(_('Table of Contents')),
|
E.h2(_('Table of Contents')),
|
||||||
E.div(svgicon('close'), onclick=def(event):event.preventDefault(), event.stopPropagation(), onclose(event);, style='cursor: pointer', class_='simple-link'),
|
E.div(svgicon('close'), onclick=def(event):event.preventDefault(), event.stopPropagation(), onclose(event);, class_='simple-link'),
|
||||||
))
|
))
|
||||||
def handle_click(event, li):
|
def handle_click(event, li):
|
||||||
if event.button is 0:
|
if event.button is 0:
|
||||||
|
@ -7,6 +7,7 @@ from elementmaker import E
|
|||||||
|
|
||||||
from book_list.theme import get_color
|
from book_list.theme import get_color
|
||||||
|
|
||||||
|
# Button {{{
|
||||||
BUTTON_VPADDING = '0.5ex'
|
BUTTON_VPADDING = '0.5ex'
|
||||||
|
|
||||||
def create_button(text, icon=None, action=None, tooltip=None, highlight=False):
|
def create_button(text, icon=None, action=None, tooltip=None, highlight=False):
|
||||||
@ -28,7 +29,9 @@ create_button.style = build_rule('button.calibre-push-button',
|
|||||||
)
|
)
|
||||||
create_button.style += build_rule('button.calibre-push-button:hover', transform='scale(1.2)')
|
create_button.style += build_rule('button.calibre-push-button:hover', transform='scale(1.2)')
|
||||||
create_button.style += build_rule('button.calibre-push-button:active', transform='scale(2)')
|
create_button.style += build_rule('button.calibre-push-button:active', transform='scale(2)')
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# Spinner {{{
|
||||||
def create_spinner(height, width):
|
def create_spinner(height, width):
|
||||||
ans = svgicon('cog', height, width)
|
ans = svgicon('cog', height, width)
|
||||||
ans.classList.add('spin')
|
ans.classList.add('spin')
|
||||||
@ -37,6 +40,10 @@ def create_spinner(height, width):
|
|||||||
create_spinner.style = build_rule('.spin', animation='spin 2s infinite linear')
|
create_spinner.style = build_rule('.spin', animation='spin 2s infinite linear')
|
||||||
create_spinner.style += create_keyframes('spin', 'from { transform: rotate(0deg); } to { transform: rotate(359deg);}')
|
create_spinner.style += create_keyframes('spin', 'from { transform: rotate(0deg); } to { transform: rotate(359deg);}')
|
||||||
|
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# Breadcrumbs {{{
|
||||||
|
|
||||||
id_counter = 0
|
id_counter = 0
|
||||||
|
|
||||||
class Breadcrumbs:
|
class Breadcrumbs:
|
||||||
@ -93,6 +100,9 @@ class Breadcrumbs:
|
|||||||
li.addEventListener('click', callback)
|
li.addEventListener('click', callback)
|
||||||
self.container.appendChild(li)
|
self.container.appendChild(li)
|
||||||
return li
|
return li
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# Simple Tree {{{
|
||||||
|
|
||||||
def create_tree(root, populate_data, onclick):
|
def create_tree(root, populate_data, onclick):
|
||||||
container = E.div(class_='simple-tree')
|
container = E.div(class_='simple-tree')
|
||||||
@ -123,6 +133,8 @@ def create_tree(root, populate_data, onclick):
|
|||||||
class_='simple-link',
|
class_='simple-link',
|
||||||
onclick=def (event):
|
onclick=def (event):
|
||||||
if onclick:
|
if onclick:
|
||||||
|
if event.button is 0:
|
||||||
|
event.preventDefault(), event.stopPropagation()
|
||||||
onclick(event, event.currentTarget.parentNode.parentNode)
|
onclick(event, event.currentTarget.parentNode.parentNode)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -141,10 +153,11 @@ def create_tree(root, populate_data, onclick):
|
|||||||
if root:
|
if root:
|
||||||
process_node(root, container, 0)
|
process_node(root, container, 0)
|
||||||
return container
|
return container
|
||||||
|
# }}}
|
||||||
|
|
||||||
def get_widget_css():
|
def get_widget_css():
|
||||||
ans = 'a, button:focus { outline: none }; a, button::-moz-focus-inner { border: 0 }\n'
|
ans = 'a, button:focus { outline: none }; a, button::-moz-focus-inner { border: 0 }\n'
|
||||||
ans += '.simple-link:hover { color: red; } .simple-tree:active { transform: scale(1.5) }\n'
|
ans += '.simple-link { cursor: pointer } .simple-link:hover { color: red } .simple-tree:active { transform: scale(1.5) }\n'
|
||||||
ans += create_button.style
|
ans += create_button.style
|
||||||
ans += create_spinner.style
|
ans += create_spinner.style
|
||||||
ans += Breadcrumbs.STYLE_RULES
|
ans += Breadcrumbs.STYLE_RULES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user