mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Add a button to enter full screen mode to the viewer controls
This commit is contained in:
parent
fdb98fdb4e
commit
cccd5e8f1a
@ -11,6 +11,7 @@ from book_list.router import home
|
|||||||
from book_list.theme import get_color
|
from book_list.theme import get_color
|
||||||
from dom import add_extra_css, build_rule, clear, set_css, svgicon, unique_id
|
from dom import add_extra_css, build_rule, clear, set_css, svgicon, unique_id
|
||||||
from modals import error_dialog
|
from modals import error_dialog
|
||||||
|
from utils import full_screen_element, request_full_screen
|
||||||
from read_book.goto import create_goto_panel
|
from read_book.goto import create_goto_panel
|
||||||
from read_book.prefs.font_size import create_font_size_panel
|
from read_book.prefs.font_size import create_font_size_panel
|
||||||
from read_book.prefs.main import create_prefs_panel
|
from read_book.prefs.main import create_prefs_panel
|
||||||
@ -202,15 +203,7 @@ class MainOverlay:
|
|||||||
|
|
||||||
return E.li(icon, '\xa0', text, onclick=action, title=tooltip)
|
return E.li(icon, '\xa0', text, onclick=action, title=tooltip)
|
||||||
|
|
||||||
container.appendChild(set_css(E.div(class_=MAIN_OVERLAY_TS_CLASS, # top section
|
actions_div = E.div( # actions
|
||||||
onclick=def (evt):evt.stopPropagation();,
|
|
||||||
|
|
||||||
set_css(E.div( # top row
|
|
||||||
E.div(self.overlay.view.book.metadata.title, style='max-width: 90%; text-overflow: ellipsis; font-weight: bold'),
|
|
||||||
E.div(self.date_formatter.format(Date()), id=self.timer_id, style='max-width: 9%; text-overflow: ellipsis'),
|
|
||||||
), display='flex', justify_content='space-between', align_items='baseline', font_size='smaller', padding='0.5ex 1rem', border_bottom='solid 1px currentColor'),
|
|
||||||
|
|
||||||
E.div( # actions
|
|
||||||
E.ul(
|
E.ul(
|
||||||
ac(_('Home'), _('Return to list of books'), def(): home();, 'home'),
|
ac(_('Home'), _('Return to list of books'), def(): home();, 'home'),
|
||||||
ac(_('Back'), None, self.back, 'arrow-left'),
|
ac(_('Back'), None, self.back, 'arrow-left'),
|
||||||
@ -237,9 +230,24 @@ class MainOverlay:
|
|||||||
ac(_('Font size'), _('Change text size'), self.overlay.show_font_size_chooser, 'Aa', True),
|
ac(_('Font size'), _('Change text size'), self.overlay.show_font_size_chooser, 'Aa', True),
|
||||||
ac(_('Preferences'), _('Configure the book reader'), self.overlay.show_prefs, 'cogs'),
|
ac(_('Preferences'), _('Configure the book reader'), self.overlay.show_prefs, 'cogs'),
|
||||||
),
|
),
|
||||||
class_=MAIN_OVERLAY_ACTIONS_CLASS
|
|
||||||
),
|
|
||||||
|
|
||||||
|
class_=MAIN_OVERLAY_ACTIONS_CLASS
|
||||||
|
)
|
||||||
|
if not full_screen_element():
|
||||||
|
actions_div.appendChild(
|
||||||
|
E.ul(
|
||||||
|
ac(_('Full screen'), _('Enter full screen mode'), def(): request_full_screen(), self.overlay.hide();, 'full-screen'),
|
||||||
|
))
|
||||||
|
|
||||||
|
container.appendChild(set_css(E.div(class_=MAIN_OVERLAY_TS_CLASS, # top section
|
||||||
|
onclick=def (evt):evt.stopPropagation();,
|
||||||
|
|
||||||
|
set_css(E.div( # top row
|
||||||
|
E.div(self.overlay.view.book.metadata.title, style='max-width: 90%; text-overflow: ellipsis; font-weight: bold'),
|
||||||
|
E.div(self.date_formatter.format(Date()), id=self.timer_id, style='max-width: 9%; text-overflow: ellipsis'),
|
||||||
|
), display='flex', justify_content='space-between', align_items='baseline', font_size='smaller', padding='0.5ex 1rem', border_bottom='solid 1px currentColor'
|
||||||
|
),
|
||||||
|
actions_div,
|
||||||
), user_select='none', background_color=get_color('window-background')))
|
), user_select='none', background_color=get_color('window-background')))
|
||||||
|
|
||||||
container.appendChild(
|
container.appendChild(
|
||||||
|
@ -69,6 +69,10 @@ def request_full_screen(elem):
|
|||||||
elem.mozRequestFullScreen()
|
elem.mozRequestFullScreen()
|
||||||
|
|
||||||
|
|
||||||
|
def full_screen_element():
|
||||||
|
return document.fullscreenElement or document.webkitFullscreenElement or document.mozFullScreenElement or document.msFullscreenElement
|
||||||
|
|
||||||
|
|
||||||
_roman = list(zip(
|
_roman = list(zip(
|
||||||
[1000,900,500,400,100,90,50,40,10,9,5,4,1],
|
[1000,900,500,400,100,90,50,40,10,9,5,4,1],
|
||||||
["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]
|
["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user