mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to pluginize
This commit is contained in:
commit
02c7fb0209
@ -392,13 +392,6 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.toolbar_button_size.setCurrentIndex(0 if icons == self.ICON_SIZES[0] else 1 if icons == self.ICON_SIZES[1] else 2)
|
self.toolbar_button_size.setCurrentIndex(0 if icons == self.ICON_SIZES[0] else 1 if icons == self.ICON_SIZES[1] else 2)
|
||||||
self.show_toolbar_text.setChecked(config['show_text_in_toolbar'])
|
self.show_toolbar_text.setChecked(config['show_text_in_toolbar'])
|
||||||
|
|
||||||
output_formats = sorted(available_output_formats())
|
|
||||||
output_formats.remove('oeb')
|
|
||||||
for f in output_formats:
|
|
||||||
self.output_format.addItem(f)
|
|
||||||
default_index = self.output_format.findText(prefs['output_format'])
|
|
||||||
self.output_format.setCurrentIndex(default_index if default_index != -1 else 0)
|
|
||||||
|
|
||||||
output_formats = sorted(available_output_formats())
|
output_formats = sorted(available_output_formats())
|
||||||
output_formats.remove('oeb')
|
output_formats.remove('oeb')
|
||||||
for f in output_formats:
|
for f in output_formats:
|
||||||
|
@ -220,7 +220,10 @@
|
|||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_23">
|
<widget class="QLabel" name="label_23">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Output Format:</string>
|
<string>Preferred &output format:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>output_format</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>Dialog</class>
|
<class>Dialog</class>
|
||||||
<widget class="QDialog" name="Dialog" >
|
<widget class="QDialog" name="Dialog">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
@ -9,150 +10,157 @@
|
|||||||
<height>574</height>
|
<height>574</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Configure Ebook viewer</string>
|
<string>Configure Ebook viewer</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon" >
|
<property name="windowIcon">
|
||||||
<iconset resource="../images.qrc" >
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
<normaloff>:/images/config.svg</normaloff>:/images/config.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4" >
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>&Font options</string>
|
<string>&Font options</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3" >
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Se&rif family:</string>
|
<string>Se&rif family:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>serif_family</cstring>
|
<cstring>serif_family</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1">
|
||||||
<widget class="QFontComboBox" name="serif_family" />
|
<widget class="QFontComboBox" name="serif_family"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>&Sans family:</string>
|
<string>&Sans family:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>sans_family</cstring>
|
<cstring>sans_family</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QFontComboBox" name="sans_family" />
|
<widget class="QFontComboBox" name="sans_family"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>&Monospace family:</string>
|
<string>&Monospace family:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>mono_family</cstring>
|
<cstring>mono_family</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1">
|
||||||
<widget class="QFontComboBox" name="mono_family" />
|
<widget class="QFontComboBox" name="mono_family"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout_2" >
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>&Default font size:</string>
|
<string>&Default font size:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>default_font_size</cstring>
|
<cstring>default_font_size</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="default_font_size" >
|
<widget class="QSpinBox" name="default_font_size">
|
||||||
<property name="suffix" >
|
<property name="suffix">
|
||||||
<string> px</string>
|
<string> px</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum" >
|
<property name="minimum">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum" >
|
<property name="maximum">
|
||||||
<number>40</number>
|
<number>40</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_5" >
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Monospace &font size:</string>
|
<string>Monospace &font size:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>mono_font_size</cstring>
|
<cstring>mono_font_size</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="mono_font_size" >
|
<widget class="QSpinBox" name="mono_font_size">
|
||||||
<property name="suffix" >
|
<property name="suffix">
|
||||||
<string> px</string>
|
<string> px</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum" >
|
<property name="minimum">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum" >
|
<property name="maximum">
|
||||||
<number>50</number>
|
<number>50</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_6" >
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>S&tandard font:</string>
|
<string>S&tandard font:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy">
|
||||||
<cstring>standard_font</cstring>
|
<cstring>standard_font</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="standard_font" >
|
<widget class="QComboBox" name="standard_font">
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Serif</string>
|
<string>Serif</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Sans-serif</string>
|
<string>Sans-serif</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Monospace</string>
|
<string>Monospace</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="opt_remember_window_size">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remember last used &window size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox_2" >
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title" >
|
<property name="title">
|
||||||
<string>&User stylesheet</string>
|
<string>&User stylesheet</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5" >
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0">
|
||||||
<widget class="QPlainTextEdit" name="css" />
|
<widget class="QPlainTextEdit" name="css"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -160,12 +168,12 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -173,7 +181,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc" />
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
@ -182,11 +190,11 @@
|
|||||||
<receiver>Dialog</receiver>
|
<receiver>Dialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>248</x>
|
<x>248</x>
|
||||||
<y>254</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
@ -198,11 +206,11 @@
|
|||||||
<receiver>Dialog</receiver>
|
<receiver>Dialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>316</x>
|
||||||
<y>260</y>
|
<y>260</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
@ -53,6 +53,8 @@ def config(defaults=None):
|
|||||||
else:
|
else:
|
||||||
c = StringConfig(defaults, desc)
|
c = StringConfig(defaults, desc)
|
||||||
|
|
||||||
|
c.add_opt('remember_window_size', default=False,
|
||||||
|
help=_('Remember last used window size'))
|
||||||
c.add_opt('user_css', default='',
|
c.add_opt('user_css', default='',
|
||||||
help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.'))
|
help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.'))
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
opts = config().parse()
|
opts = config().parse()
|
||||||
|
self.opt_remember_window_size.setChecked(opts.remember_window_size)
|
||||||
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))
|
||||||
@ -94,6 +97,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
c.set('mono_font_size', self.mono_font_size.value())
|
c.set('mono_font_size', self.mono_font_size.value())
|
||||||
c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[self.standard_font.currentIndex()])
|
c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[self.standard_font.currentIndex()])
|
||||||
c.set('user_css', unicode(self.css.toPlainText()))
|
c.set('user_css', unicode(self.css.toPlainText()))
|
||||||
|
c.set('remember_window_size', self.opt_remember_window_size.isChecked())
|
||||||
return QDialog.accept(self, *args)
|
return QDialog.accept(self, *args)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from calibre.gui2 import Application, ORG_NAME, APP_UID, choose_files, \
|
|||||||
from calibre.ebooks.oeb.iterator import EbookIterator
|
from calibre.ebooks.oeb.iterator import EbookIterator
|
||||||
from calibre.ebooks import DRMError
|
from calibre.ebooks import DRMError
|
||||||
from calibre.constants import islinux
|
from calibre.constants import islinux
|
||||||
from calibre.utils.config import Config, ConfigProxy, StringConfig
|
from calibre.utils.config import Config, StringConfig, dynamic
|
||||||
from calibre.gui2.library import SearchBox
|
from calibre.gui2.library import SearchBox
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
from calibre.customize.ui import available_input_formats
|
from calibre.customize.ui import available_input_formats
|
||||||
@ -598,29 +598,21 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
|
self.write_settings()
|
||||||
if self.iterator is not None:
|
if self.iterator is not None:
|
||||||
self.save_current_position()
|
self.save_current_position()
|
||||||
self.iterator.__exit__(*args)
|
self.iterator.__exit__(*args)
|
||||||
|
|
||||||
def closeEvent(self, e):
|
def write_settings(self):
|
||||||
self.write_settings()
|
dynamic.set('viewer_window_geometry', self.saveGeometry())
|
||||||
|
|
||||||
def read_settings(self):
|
def read_settings(self):
|
||||||
geometry = settings['viewer_window_geometry']
|
c = config().parse()
|
||||||
if geometry is not None:
|
wg = dynamic['viewer_window_geometry']
|
||||||
self.restoreGeometry(geometry)
|
if wg is not None and c.remember_window_size:
|
||||||
|
self.restoreGeometry(wg)
|
||||||
def write_settings(self):
|
|
||||||
settings.set('viewer_window_geometry', self.saveGeometry())
|
|
||||||
|
|
||||||
|
|
||||||
def _settings():
|
|
||||||
c = Config('viewer_gui', 'preferences for the calibre viewer GUI')
|
|
||||||
c.add_opt('viewer_window_geometry', default=None,
|
|
||||||
help=_('Viewer window geometry')) # value QVariant.toByteArray
|
|
||||||
return ConfigProxy(c)
|
|
||||||
|
|
||||||
settings = _settings()
|
|
||||||
|
|
||||||
|
|
||||||
def config(defaults=None):
|
def config(defaults=None):
|
||||||
@ -633,6 +625,9 @@ def config(defaults=None):
|
|||||||
c.add_opt('raise_window', ['--raise-window'], default=False,
|
c.add_opt('raise_window', ['--raise-window'], default=False,
|
||||||
help=_('If specified, viewer window will try to come to the '
|
help=_('If specified, viewer window will try to come to the '
|
||||||
'front when started.'))
|
'front when started.'))
|
||||||
|
c.add_opt('remember_window_size', default=False,
|
||||||
|
help=_('Remember last used window size'))
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def option_parser():
|
def option_parser():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user