mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Add a shortcut ctrl+0 to restore default font size
Fixes #1925294 [[Enhancement] E-book viewer: there should be a tool bar icon/keyboard shortcut for setting font zoom to 100%](https://bugs.launchpad.net/calibre/+bug/1925294)
This commit is contained in:
parent
2ba9e9e8d1
commit
8965b8a940
@ -10,6 +10,7 @@ from book_list.theme import get_color
|
||||
from dom import add_extra_css, rule, unique_id
|
||||
from read_book.globals import ui_operations
|
||||
from widgets import create_button
|
||||
from session import defaults
|
||||
|
||||
CONTAINER = unique_id('font-size-prefs')
|
||||
MIN_FONT_SIZE = 8
|
||||
@ -56,6 +57,10 @@ def change_font_size_by(frac):
|
||||
change_font_size(nsz)
|
||||
|
||||
|
||||
def restore_default_font_size():
|
||||
change_font_size(defaults.base_font_size)
|
||||
|
||||
|
||||
def display_changed_font_size(sz):
|
||||
sz = max(MIN_FONT_SIZE, min(int(sz), MAX_FONT_SIZE))
|
||||
sz += ''
|
||||
|
@ -248,6 +248,12 @@ def common_shortcuts(): # {{{
|
||||
_('Decrease font size'),
|
||||
),
|
||||
|
||||
'default_font_size': desc(
|
||||
"Ctrl+0",
|
||||
'ui',
|
||||
_('Restore default font size'),
|
||||
),
|
||||
|
||||
'increase_number_of_columns': desc(
|
||||
v"['Ctrl+]']",
|
||||
'ui',
|
||||
|
@ -26,7 +26,7 @@ from read_book.hints import Hints
|
||||
from read_book.open_book import add_book_to_recently_viewed
|
||||
from read_book.overlay import Overlay
|
||||
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, restore_default_font_size
|
||||
from read_book.prefs.fonts import current_zoom_step_size
|
||||
from read_book.prefs.head_foot import render_head_foot
|
||||
from read_book.prefs.scrolling import (
|
||||
@ -521,6 +521,8 @@ class View:
|
||||
self.bump_font_size({'increase': True})
|
||||
elif data.name is 'decrease_font_size':
|
||||
self.bump_font_size({'increase': False})
|
||||
elif data.name is 'default_font_size':
|
||||
restore_default_font_size()
|
||||
elif data.name is 'toggle_full_screen':
|
||||
ui_operations.toggle_full_screen()
|
||||
elif data.name is 'toggle_reference_mode':
|
||||
|
Loading…
x
Reference in New Issue
Block a user