mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanup previous PR
We dont disable the preference as now the layout is dynamically switchable via keyboard shortcut, so it is conceivable the user might want to set that preference even when the current layout is Wide.
This commit is contained in:
parent
fb3e6c4c3b
commit
140ea63f8c
@ -365,26 +365,21 @@ class CentralContainer(QWidget):
|
|||||||
self.top_handle = h(Qt.Orientation.Horizontal)
|
self.top_handle = h(Qt.Orientation.Horizontal)
|
||||||
self.bottom_handle = h(Qt.Orientation.Horizontal)
|
self.bottom_handle = h(Qt.Orientation.Horizontal)
|
||||||
|
|
||||||
_last_cb_position = None
|
_last_cb_position = gui = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def narrow_cb_on_top(self):
|
def narrow_cb_on_top(self):
|
||||||
from calibre.gui2 import gui_prefs
|
p = self._last_cb_position = gprefs['cover_browser_narrow_view_position']
|
||||||
prefs = gui_prefs()
|
|
||||||
p = self._last_cb_position = prefs['cover_browser_narrow_view_position']
|
|
||||||
if p == 'automatic':
|
if p == 'automatic':
|
||||||
from calibre.gui2.ui import get_gui
|
gui = self.gui or self
|
||||||
gui = get_gui()
|
ratio = gui.width() / gui.height()
|
||||||
ratio = self.width() / self.height() if gui is None else gui.width() / gui.height()
|
|
||||||
return ratio <= 1.4
|
return ratio <= 1.4
|
||||||
return bool(self._last_cb_position == 'on_top')
|
return p == 'on_top'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cb_on_top_changed(self):
|
def cb_on_top_changed(self):
|
||||||
from calibre.gui2 import gui_prefs
|
|
||||||
prefs = gui_prefs()
|
|
||||||
return (self._last_cb_position is None or
|
return (self._last_cb_position is None or
|
||||||
prefs['cover_browser_narrow_view_position'] != self._last_cb_position)
|
gprefs['cover_browser_narrow_view_position'] != self._last_cb_position)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_visible(self):
|
def is_visible(self):
|
||||||
@ -398,6 +393,7 @@ class CentralContainer(QWidget):
|
|||||||
w.setParent(self)
|
w.setParent(self)
|
||||||
|
|
||||||
def initialize_with_gui(self, gui, book_list_widget):
|
def initialize_with_gui(self, gui, book_list_widget):
|
||||||
|
self.gui = gui
|
||||||
self.tag_browser_button.initialize_with_gui(gui)
|
self.tag_browser_button.initialize_with_gui(gui)
|
||||||
self.book_details_button.initialize_with_gui(gui)
|
self.book_details_button.initialize_with_gui(gui)
|
||||||
self.cover_browser_button.initialize_with_gui(gui)
|
self.cover_browser_button.initialize_with_gui(gui)
|
||||||
@ -597,10 +593,8 @@ class CentralContainer(QWidget):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def toggle_layout(self):
|
def toggle_layout(self):
|
||||||
from calibre.gui2.ui import get_gui
|
if self.gui:
|
||||||
gui = get_gui()
|
self.change_layout(self.gui, self.layout is Layout.narrow)
|
||||||
if gui:
|
|
||||||
self.change_layout(gui, self.layout is Layout.narrow)
|
|
||||||
else:
|
else:
|
||||||
self.layout = Layout.narrow if self.layout is Layout.wide else Layout.wide
|
self.layout = Layout.narrow if self.layout is Layout.wide else Layout.wide
|
||||||
self.relayout()
|
self.relayout()
|
||||||
|
@ -840,15 +840,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.opt_gui_layout.addItem(_('Narrow'), 'narrow')
|
self.opt_gui_layout.addItem(_('Narrow'), 'narrow')
|
||||||
self.opt_gui_layout.currentIndexChanged.connect(self.changed_signal)
|
self.opt_gui_layout.currentIndexChanged.connect(self.changed_signal)
|
||||||
set_help_tips(self.opt_gui_layout, config.help('gui_layout'))
|
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):
|
def initial_tab_changed(self):
|
||||||
self.sections_view.setCurrentRow(self.tabWidget.currentIndex())
|
self.sections_view.setCurrentRow(self.tabWidget.currentIndex())
|
||||||
@ -1057,7 +1048,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
self.tb_focus_label.setVisible(self.opt_tag_browser_allow_keyboard_focus.isChecked())
|
self.tb_focus_label.setVisible(self.opt_tag_browser_allow_keyboard_focus.isChecked())
|
||||||
self.update_color_palette_state()
|
self.update_color_palette_state()
|
||||||
self.opt_gui_layout.setCurrentIndex(0 if self.gui.layout_container.is_wide else 1)
|
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)
|
set_help_tips(self.opt_cover_browser_narrow_view_position, _(
|
||||||
|
'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.'))
|
||||||
|
|
||||||
def open_cg_cache(self):
|
def open_cg_cache(self):
|
||||||
open_local_file(self.gui.grid_view.thumbnail_cache.location)
|
open_local_file(self.gui.grid_view.thumbnail_cache.location)
|
||||||
|
@ -1927,14 +1927,6 @@ them to all have the same width and height</string>
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Cover browser &position in the narrow layout:</string>
|
<string>Cover browser &position in the narrow layout:</string>
|
||||||
</property>
|
</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">
|
<property name="buddy">
|
||||||
<cstring>opt_cover_browser_narrow_view_position</cstring>
|
<cstring>opt_cover_browser_narrow_view_position</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user