diff --git a/src/calibre/gui2/tweak_book/__init__.py b/src/calibre/gui2/tweak_book/__init__.py index 45e80f6fe2..7bcb058ab3 100644 --- a/src/calibre/gui2/tweak_book/__init__.py +++ b/src/calibre/gui2/tweak_book/__init__.py @@ -20,6 +20,11 @@ tprefs.defaults['choose_tweak_fmt'] = True tprefs.defaults['tweak_fmt_order'] = ['EPUB', 'AZW3'] tprefs.defaults['update_metadata_from_calibre'] = True +tprefs.defaults['nestable_dock_widgets'] = False +tprefs.defaults['dock_top_left'] = 'horizontal' +tprefs.defaults['dock_top_right'] = 'horizontal' +tprefs.defaults['dock_bottom_left'] = 'horizontal' +tprefs.defaults['dock_bottom_right'] = 'horizontal' ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)} def capitalize(x): diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 16480369f2..951cbb3ded 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -111,8 +111,8 @@ def preferences(self): if p.exec_() == p.Accepted: for ed in editors.itervalues(): ed.apply_settings() - self.gui.keyboard.finalize() setup_cssutils_serialization() + self.gui.apply_settings() def mark_requested(self, name, action): self.commit_dirty_opf() diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index 432b7eacd0..323c60b154 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -9,11 +9,12 @@ from operator import attrgetter, methodcaller from collections import namedtuple from future_builtins import map +from itertools import product from PyQt4.Qt import ( QDialog, QGridLayout, QStackedWidget, QDialogButtonBox, QListWidget, QListWidgetItem, QIcon, QWidget, QSize, QFormLayout, Qt, QSpinBox, - QCheckBox, pyqtSignal, QDoubleSpinBox, QComboBox) + QCheckBox, pyqtSignal, QDoubleSpinBox, QComboBox, QLabel) from calibre.gui2.keyboard import ShortcutConfig from calibre.gui2.tweak_book import tprefs @@ -194,6 +195,30 @@ def __init__(self, parent=None): ' multiple formats, this is the preference order.')) l.addRow(_('Preferred format order (drag and drop to change)'), order) +class MainWindowSettings(BasicSettings): + + def __init__(self, parent=None): + BasicSettings.__init__(self, parent) + self.l = l = QFormLayout(self) + self.setLayout(l) + + nd = self('nestable_dock_widgets') + nd.setText(_('Allow dockable windows to be nested inside the dock areas')) + nd.setToolTip('
' + _(
+ 'By default, you can have only a single row or column of windows in the dock'
+ ' areas (the areas around the central editors). This option allows'
+ ' for more flexible window layout, but is a little more complex to use.'))
+ l.addRow(nd)
+
+ l.addRow(QLabel(_('Choose which windows will occupy the corners of the dockable areas')))
+ for v, h in product(('top', 'bottom'), ('left', 'right')):
+ choices = {'vertical':{'left':_('Left'), 'right':_('Right')}[h],
+ 'horizontal':{'top':_('Top'), 'bottom':_('Bottom')}[v]}
+ name = 'dock_%s_%s' % (v, h)
+ w = self.choices_widget(name, choices, 'vertical', 'vertical')
+ cn = {('top', 'left'): _('The top-left corner'), ('top', 'right'):_('The top-right corner'),
+ ('bottom', 'left'):_('The bottom-left corner'), ('bottom', 'right'):_('The bottom-right corner')}[(v, h)]
+ l.addRow(cn + ':', w)
class Preferences(QDialog):
@@ -238,8 +263,10 @@ def __init__(self, gui, initial_panel=None):
self.keyboard_panel.initialize(gui.keyboard)
self.editor_panel = EditorSettings(self)
self.integration_panel = IntegrationSettings(self)
+ self.main_window_panel = MainWindowSettings(self)
for name, icon, panel in [
+ (_('Main window'), 'page.png', 'main_window'),
(_('Editor settings'), 'modified.png', 'editor'),
(_('Keyboard shortcuts'), 'keyboard-prefs.png', 'keyboard'),
(_('Integration with calibre'), 'lt.png', 'integration'),
diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py
index 005ecac80e..c157bd05cd 100644
--- a/src/calibre/gui2/tweak_book/ui.py
+++ b/src/calibre/gui2/tweak_book/ui.py
@@ -7,6 +7,8 @@
__copyright__ = '2013, Kovid Goyal