mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Forgot to use standard titlebar for viewer preferences
This commit is contained in:
parent
786e738b1a
commit
29f798a94a
@ -3,19 +3,20 @@
|
|||||||
from __python__ import bound_methods, hash_literals
|
from __python__ import bound_methods, hash_literals
|
||||||
|
|
||||||
from elementmaker import E
|
from elementmaker import E
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from book_list.item_list import build_list, create_item
|
from book_list.item_list import build_list, create_item
|
||||||
from dom import clear, ensure_id, svgicon
|
from book_list.top_bar import create_top_bar, set_title
|
||||||
|
from dom import clear, ensure_id
|
||||||
|
from gettext import gettext as _
|
||||||
from read_book.globals import runtime
|
from read_book.globals import runtime
|
||||||
from read_book.prefs.colors import commit_colors, create_colors_panel
|
from read_book.prefs.colors import commit_colors, create_colors_panel
|
||||||
from read_book.prefs.fonts import commit_fonts, create_fonts_panel
|
from read_book.prefs.fonts import commit_fonts, create_fonts_panel
|
||||||
from read_book.prefs.head_foot import commit_head_foot, create_head_foot_panel
|
from read_book.prefs.head_foot import commit_head_foot, create_head_foot_panel
|
||||||
from read_book.prefs.keyboard import commit_keyboard, create_keyboard_panel
|
from read_book.prefs.keyboard import commit_keyboard, create_keyboard_panel
|
||||||
from read_book.prefs.selection import commit_selection, create_selection_panel
|
|
||||||
from read_book.prefs.scrolling import commit_scrolling, create_scrolling_panel
|
|
||||||
from read_book.prefs.layout import commit_layout, create_layout_panel
|
from read_book.prefs.layout import commit_layout, create_layout_panel
|
||||||
from read_book.prefs.misc import commit_misc, create_misc_panel
|
from read_book.prefs.misc import commit_misc, create_misc_panel
|
||||||
|
from read_book.prefs.scrolling import commit_scrolling, create_scrolling_panel
|
||||||
|
from read_book.prefs.selection import commit_selection, create_selection_panel
|
||||||
from read_book.prefs.user_stylesheet import (
|
from read_book.prefs.user_stylesheet import (
|
||||||
commit_user_stylesheet, create_user_stylesheet_panel
|
commit_user_stylesheet, create_user_stylesheet_panel
|
||||||
)
|
)
|
||||||
@ -26,18 +27,20 @@ class Prefs:
|
|||||||
def __init__(self, container, close_func, on_change):
|
def __init__(self, container, close_func, on_change):
|
||||||
self.close_func = close_func
|
self.close_func = close_func
|
||||||
self.on_change = on_change
|
self.on_change = on_change
|
||||||
title = E.h2()
|
self.main_title = _('Configure book reader')
|
||||||
self.title_id = ensure_id(title)
|
|
||||||
container.appendChild(E.div(
|
container.appendChild(E.div(
|
||||||
style='display: flex; justify-content: flex-start; padding: 1ex 1em; border-bottom: solid 1px currentColor',
|
style='contain: paint; width: 100%; height: 100%; display: flex; flex-direction: column',
|
||||||
E.div(svgicon('close'), onclick=self.onclose, style='cursor:pointer; margin-right: 1ex'),
|
E.div(), E.div(style='flex-grow: 100; overflow: auto')
|
||||||
title,
|
|
||||||
))
|
))
|
||||||
container.appendChild(E.div())
|
container = container.firstChild
|
||||||
|
create_top_bar(container.firstChild, title=self.main_title, icon='close', action=self.onclose)
|
||||||
self.container_id = ensure_id(container.lastChild)
|
self.container_id = ensure_id(container.lastChild)
|
||||||
self.stack = v'["top"]'
|
self.stack = v'["top"]'
|
||||||
self.display_top(container.lastChild)
|
self.display_top(container.lastChild)
|
||||||
|
|
||||||
|
def set_top_title(self, val):
|
||||||
|
set_title(self.container.parentNode, val)
|
||||||
|
|
||||||
def onchange(self):
|
def onchange(self):
|
||||||
self.on_change()
|
self.on_change()
|
||||||
|
|
||||||
@ -57,7 +60,7 @@ class Prefs:
|
|||||||
self.close_func()
|
self.close_func()
|
||||||
|
|
||||||
def create_panel(self, container, which, create_func, needs_onchange):
|
def create_panel(self, container, which, create_func, needs_onchange):
|
||||||
document.getElementById(self.title_id).textContent = self.title_map[which] or which
|
self.set_top_title(self.title_map[which] or which)
|
||||||
if needs_onchange:
|
if needs_onchange:
|
||||||
create_func(container, self.onclose, self.cancel, self.onchange)
|
create_func(container, self.onclose, self.cancel, self.onchange)
|
||||||
else:
|
else:
|
||||||
@ -77,7 +80,7 @@ class Prefs:
|
|||||||
self.display_panel(which)
|
self.display_panel(which)
|
||||||
|
|
||||||
def display_top(self, container):
|
def display_top(self, container):
|
||||||
document.getElementById(self.title_id).textContent = _('Configure book reader')
|
self.set_top_title(self.main_title)
|
||||||
c = E.div()
|
c = E.div()
|
||||||
container.appendChild(c)
|
container.appendChild(c)
|
||||||
self.title_map = {}
|
self.title_map = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user