mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
The cover browser position option with the "auto" choice.
This commit is contained in:
parent
3f35571f8d
commit
9f2045c3ba
@ -426,6 +426,7 @@ def create_defs():
|
||||
defs['show_links_in_tag_browser'] = False
|
||||
defs['show_notes_in_tag_browser'] = False
|
||||
defs['icons_on_right_in_tag_browser'] = True
|
||||
defs['cover_browser_narrow_view_position'] = 'automatic'
|
||||
|
||||
def migrate_tweak(tweak_name, pref_name):
|
||||
# If the tweak has been changed then leave the tweak in the file so
|
||||
|
@ -365,12 +365,26 @@ class CentralContainer(QWidget):
|
||||
self.top_handle = h(Qt.Orientation.Horizontal)
|
||||
self.bottom_handle = h(Qt.Orientation.Horizontal)
|
||||
|
||||
_last_cb_position = None
|
||||
|
||||
@property
|
||||
def narrow_cb_on_top(self):
|
||||
from calibre.gui2.ui import get_gui
|
||||
gui = get_gui()
|
||||
ratio = self.width() / self.height() if gui is None else gui.width() / gui.height()
|
||||
return ratio <= 1.4
|
||||
from calibre.gui2 import gui_prefs
|
||||
prefs = gui_prefs()
|
||||
p = self._last_cb_position = prefs['cover_browser_narrow_view_position']
|
||||
if p == 'automatic':
|
||||
from calibre.gui2.ui import get_gui
|
||||
gui = get_gui()
|
||||
ratio = self.width() / self.height() if gui is None else gui.width() / gui.height()
|
||||
return ratio <= 1.4
|
||||
return bool(self._last_cb_position == 'on_top')
|
||||
|
||||
@property
|
||||
def cb_on_top_changed(self):
|
||||
from calibre.gui2 import gui_prefs
|
||||
prefs = gui_prefs()
|
||||
return (self._last_cb_position is None or
|
||||
prefs['cover_browser_narrow_view_position'] != self._last_cb_position)
|
||||
|
||||
@property
|
||||
def is_visible(self):
|
||||
@ -404,7 +418,7 @@ class CentralContainer(QWidget):
|
||||
|
||||
def change_layout(self, gui, is_wide):
|
||||
layout = Layout.wide if is_wide else Layout.narrow
|
||||
if layout is self.layout:
|
||||
if layout is self.layout and not self.cb_on_top_changed:
|
||||
return False
|
||||
ss = self.serialized_settings()
|
||||
before = ss[self.layout.name + '_visibility']
|
||||
|
@ -610,6 +610,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
|
||||
r('cover_flow_queue_length', config, restart_required=True)
|
||||
r('cover_browser_reflections', gprefs)
|
||||
r('cover_browser_narrow_view_position', gprefs,
|
||||
choices=[(_('Automatic'), 'automatic'), # Automatic must be first
|
||||
(_('On top'), 'on_top'),
|
||||
(_('On right'), 'on_right')])
|
||||
r('cover_browser_title_template', db.prefs)
|
||||
fm = db.field_metadata
|
||||
r('cover_browser_subtitle_field', db.prefs, choices=[(_('No subtitle'), 'none')] + sorted(
|
||||
@ -836,6 +840,15 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self.opt_gui_layout.addItem(_('Narrow'), 'narrow')
|
||||
self.opt_gui_layout.currentIndexChanged.connect(self.changed_signal)
|
||||
set_help_tips(self.opt_gui_layout, config.help('gui_layout'))
|
||||
self.opt_gui_layout.currentIndexChanged.connect(self.gui_layout_changed)
|
||||
|
||||
def set_cover_browser_position_enabled(self, is_wide):
|
||||
self.opt_cover_browser_narrow_view_position.setEnabled(not is_wide)
|
||||
if is_wide:
|
||||
self.opt_cover_browser_narrow_view_position.setCurrentIndex(0)
|
||||
|
||||
def gui_layout_changed(self, dex):
|
||||
self.set_cover_browser_position_enabled(dex == 0) #0 == wide
|
||||
|
||||
def initial_tab_changed(self):
|
||||
self.sections_view.setCurrentRow(self.tabWidget.currentIndex())
|
||||
@ -1044,6 +1057,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self.tb_focus_label.setVisible(self.opt_tag_browser_allow_keyboard_focus.isChecked())
|
||||
self.update_color_palette_state()
|
||||
self.opt_gui_layout.setCurrentIndex(0 if self.gui.layout_container.is_wide else 1)
|
||||
self.set_cover_browser_position_enabled(self.gui.layout_container.is_wide)
|
||||
|
||||
def open_cg_cache(self):
|
||||
open_local_file(self.gui.grid_view.thumbnail_cache.location)
|
||||
|
@ -1846,7 +1846,7 @@ that don't have children.</p></string>
|
||||
<string>Cover &browser</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_cb_fullscreen">
|
||||
<property name="text">
|
||||
<string>When showing in a separate window, show it &fullscreen</string>
|
||||
@ -1860,11 +1860,11 @@ that don't have children.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="opt_cover_flow_queue_length"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_61">
|
||||
<property name="text">
|
||||
<string>&Number of covers to show in browse mode (needs restart):</string>
|
||||
</property>
|
||||
@ -1873,7 +1873,7 @@ that don't have children.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<item row="8" column="2">
|
||||
<widget class="QPushButton" name="cover_browser_title_template_button">
|
||||
<property name="text">
|
||||
<string>Template &editor</string>
|
||||
@ -1893,7 +1893,7 @@ that don't have children.</p></string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLineEdit" name="opt_cover_browser_title_template">
|
||||
<property name="toolTip">
|
||||
<string><p>The template used to generate the text below the covers. This template uses
|
||||
@ -1904,14 +1904,14 @@ empty template for no text.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="opt_cover_browser_reflections">
|
||||
<property name="text">
|
||||
<string>Show &reflections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_cb_preserve_aspect_ratio">
|
||||
<property name="toolTip">
|
||||
<string>Show covers in their original aspect ratio instead of resizing
|
||||
@ -1922,10 +1922,31 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_987">
|
||||
<property name="text">
|
||||
<string>Cover browser &position in the narrow layout:</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><p>This option controls the position of the cover browser when
|
||||
using the Narrow user interface layout. "Automatic" will place the cover browser
|
||||
on top or on the right of the book list depending on the aspect ratio of the
|
||||
calibre window. "On top" places it over the book list, and "On right" places it
|
||||
to the right of the book list. This option cannot be changed when using the
|
||||
Wide user interface layout.</p></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>opt_cover_browser_narrow_view_position</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="opt_cover_browser_narrow_view_position"/>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="opt_cover_browser_subtitle_field"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>&Template for caption:</string>
|
||||
@ -1935,7 +1956,7 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_24">
|
||||
<property name="text">
|
||||
<string>Fie&ld for sub-title:</string>
|
||||
@ -1945,7 +1966,7 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fs_help_msg">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">margin-left: 1.5em</string>
|
||||
@ -1958,7 +1979,7 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="text">
|
||||
<string>Show ne&xt cover during auto scroll after:</string>
|
||||
@ -1968,7 +1989,7 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QDoubleSpinBox" name="opt_books_autoscroll_time">
|
||||
<property name="suffix">
|
||||
<string> seconds</string>
|
||||
@ -1984,7 +2005,7 @@ them to all have the same width and height</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_cb_double_click_to_activate">
|
||||
<property name="text">
|
||||
<string>&Double click to view the central book, instead of single click</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user