mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix widescreen detection
This commit is contained in:
parent
ab9acc2b95
commit
6b12237e7f
@ -127,10 +127,16 @@ def available_width():
|
|||||||
desktop = QCoreApplication.instance().desktop()
|
desktop = QCoreApplication.instance().desktop()
|
||||||
return desktop.availableGeometry().width()
|
return desktop.availableGeometry().width()
|
||||||
|
|
||||||
|
_is_widescreen = None
|
||||||
|
|
||||||
|
def is_widescreen():
|
||||||
|
global _is_widescreen
|
||||||
|
if _is_widescreen is None:
|
||||||
try:
|
try:
|
||||||
is_widescreen = float(available_width())/available_height() > 1.4
|
_is_widescreen = float(available_width())/available_height() > 1.4
|
||||||
except:
|
except:
|
||||||
is_widescreen = True
|
_is_widescreen = False
|
||||||
|
return _is_widescreen
|
||||||
|
|
||||||
def extension(path):
|
def extension(path):
|
||||||
return os.path.splitext(path)[1][1:].lower()
|
return os.path.splitext(path)[1][1:].lower()
|
||||||
|
@ -290,14 +290,15 @@ class LibraryWidget(Splitter): # {{{
|
|||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
orientation = Qt.Vertical if config['gui_layout'] == 'narrow' and \
|
orientation = Qt.Vertical if config['gui_layout'] == 'narrow' and \
|
||||||
not is_widescreen else Qt.Horizontal
|
not is_widescreen() else Qt.Horizontal
|
||||||
#orientation = Qt.Vertical
|
#orientation = Qt.Vertical
|
||||||
idx = 0 if orientation == Qt.Vertical else 1
|
idx = 0 if orientation == Qt.Vertical else 1
|
||||||
|
size = 300 if orientation == Qt.Vertical else 550
|
||||||
Splitter.__init__(self, 'cover_browser_splitter', _('Cover Browser'),
|
Splitter.__init__(self, 'cover_browser_splitter', _('Cover Browser'),
|
||||||
I('cover_flow.svg'),
|
I('cover_flow.svg'),
|
||||||
orientation=orientation, parent=parent,
|
orientation=orientation, parent=parent,
|
||||||
connect_button=not config['separate_cover_flow'],
|
connect_button=not config['separate_cover_flow'],
|
||||||
side_index=idx, initial_side_size=400, initial_show=False)
|
side_index=idx, initial_side_size=size, initial_show=False)
|
||||||
parent.library_view = BooksView(parent)
|
parent.library_view = BooksView(parent)
|
||||||
parent.library_view.setObjectName('library_view')
|
parent.library_view.setObjectName('library_view')
|
||||||
self.addWidget(parent.library_view)
|
self.addWidget(parent.library_view)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user