mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Add option in viewer preferences to control how much the font size is changed when you click the make fonts bigger/smaller buttons. Fixes #908980 (Allow user to specify his own magnification step size)
This commit is contained in:
parent
4e30b394c8
commit
7cf5bfeb73
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>479</width>
|
<width>479</width>
|
||||||
<height>591</height>
|
<height>630</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -277,6 +277,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Font &magnification step size:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>opt_font_mag_step</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="opt_font_mag_step">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The amount by which the font size is increased/decreased
|
||||||
|
when you click the font size larger/smaller buttons</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>%</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -62,6 +62,10 @@ def config(defaults=None):
|
|||||||
c.add_opt('page_flip_duration', default=0.5,
|
c.add_opt('page_flip_duration', default=0.5,
|
||||||
help=_('The time, in seconds, for the page flip animation. Default'
|
help=_('The time, in seconds, for the page flip animation. Default'
|
||||||
' is half a second.'))
|
' is half a second.'))
|
||||||
|
c.add_opt('font_magnification_step', default=0.2,
|
||||||
|
help=_('The amount by which to change the font size when clicking'
|
||||||
|
' the font larger/smaller buttons. Should be a number between '
|
||||||
|
'0 and 1.'))
|
||||||
|
|
||||||
fonts = c.add_group('FONTS', _('Font options'))
|
fonts = c.add_group('FONTS', _('Font options'))
|
||||||
fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif',
|
fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif',
|
||||||
@ -87,6 +91,10 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.opt_remember_current_page.setChecked(opts.remember_current_page)
|
self.opt_remember_current_page.setChecked(opts.remember_current_page)
|
||||||
self.opt_wheel_flips_pages.setChecked(opts.wheel_flips_pages)
|
self.opt_wheel_flips_pages.setChecked(opts.wheel_flips_pages)
|
||||||
self.opt_page_flip_duration.setValue(opts.page_flip_duration)
|
self.opt_page_flip_duration.setValue(opts.page_flip_duration)
|
||||||
|
fms = opts.font_magnification_step
|
||||||
|
if fms < 0.01 or fms > 1:
|
||||||
|
fms = 0.2
|
||||||
|
self.opt_font_mag_step.setValue(int(fms*100))
|
||||||
self.serif_family.setCurrentFont(QFont(opts.serif_family))
|
self.serif_family.setCurrentFont(QFont(opts.serif_family))
|
||||||
self.sans_family.setCurrentFont(QFont(opts.sans_family))
|
self.sans_family.setCurrentFont(QFont(opts.sans_family))
|
||||||
self.mono_family.setCurrentFont(QFont(opts.mono_family))
|
self.mono_family.setCurrentFont(QFont(opts.mono_family))
|
||||||
@ -143,6 +151,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
c.set('remember_current_page', self.opt_remember_current_page.isChecked())
|
c.set('remember_current_page', self.opt_remember_current_page.isChecked())
|
||||||
c.set('wheel_flips_pages', self.opt_wheel_flips_pages.isChecked())
|
c.set('wheel_flips_pages', self.opt_wheel_flips_pages.isChecked())
|
||||||
c.set('page_flip_duration', self.opt_page_flip_duration.value())
|
c.set('page_flip_duration', self.opt_page_flip_duration.value())
|
||||||
|
c.set('font_magnification_step',
|
||||||
|
float(self.opt_font_mag_step.value())/100.)
|
||||||
idx = self.hyphenate_default_lang.currentIndex()
|
idx = self.hyphenate_default_lang.currentIndex()
|
||||||
c.set('hyphenate_default_lang',
|
c.set('hyphenate_default_lang',
|
||||||
str(self.hyphenate_default_lang.itemData(idx).toString()))
|
str(self.hyphenate_default_lang.itemData(idx).toString()))
|
||||||
@ -223,6 +233,7 @@ class Document(QWebPage): # {{{
|
|||||||
self.do_fit_images = opts.fit_images
|
self.do_fit_images = opts.fit_images
|
||||||
self.page_flip_duration = opts.page_flip_duration
|
self.page_flip_duration = opts.page_flip_duration
|
||||||
self.enable_page_flip = self.page_flip_duration > 0.1
|
self.enable_page_flip = self.page_flip_duration > 0.1
|
||||||
|
self.font_magnification_step = opts.font_magnification_step
|
||||||
self.wheel_flips_pages = opts.wheel_flips_pages
|
self.wheel_flips_pages = opts.wheel_flips_pages
|
||||||
|
|
||||||
def fit_images(self):
|
def fit_images(self):
|
||||||
@ -932,13 +943,17 @@ class DocumentView(QWebView): # {{{
|
|||||||
self.magnification_changed.emit(val)
|
self.magnification_changed.emit(val)
|
||||||
return property(fget=fget, fset=fset)
|
return property(fget=fget, fset=fset)
|
||||||
|
|
||||||
def magnify_fonts(self):
|
def magnify_fonts(self, amount=None):
|
||||||
self.multiplier += 0.2
|
if amount is None:
|
||||||
|
amount = self.document.font_magnification_step
|
||||||
|
self.multiplier += amount
|
||||||
return self.document.scroll_fraction
|
return self.document.scroll_fraction
|
||||||
|
|
||||||
def shrink_fonts(self):
|
def shrink_fonts(self, amount=None):
|
||||||
if self.multiplier >= 0.2:
|
if amount is None:
|
||||||
self.multiplier -= 0.2
|
amount = self.document.font_magnification_step
|
||||||
|
if self.multiplier >= amount:
|
||||||
|
self.multiplier -= amount
|
||||||
return self.document.scroll_fraction
|
return self.document.scroll_fraction
|
||||||
|
|
||||||
def changeEvent(self, event):
|
def changeEvent(self, event):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user