Fix widescreen detection

This commit is contained in:
Kovid Goyal 2010-06-11 10:53:29 -06:00
parent ab9acc2b95
commit 6b12237e7f
2 changed files with 13 additions and 6 deletions

View File

@ -127,10 +127,16 @@ def available_width():
desktop = QCoreApplication.instance().desktop()
return desktop.availableGeometry().width()
_is_widescreen = None
def is_widescreen():
global _is_widescreen
if _is_widescreen is None:
try:
is_widescreen = float(available_width())/available_height() > 1.4
_is_widescreen = float(available_width())/available_height() > 1.4
except:
is_widescreen = True
_is_widescreen = False
return _is_widescreen
def extension(path):
return os.path.splitext(path)[1][1:].lower()

View File

@ -290,14 +290,15 @@ class LibraryWidget(Splitter): # {{{
def __init__(self, parent):
orientation = Qt.Vertical if config['gui_layout'] == 'narrow' and \
not is_widescreen else Qt.Horizontal
not is_widescreen() else Qt.Horizontal
#orientation = Qt.Vertical
idx = 0 if orientation == Qt.Vertical else 1
size = 300 if orientation == Qt.Vertical else 550
Splitter.__init__(self, 'cover_browser_splitter', _('Cover Browser'),
I('cover_flow.svg'),
orientation=orientation, parent=parent,
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.setObjectName('library_view')
self.addWidget(parent.library_view)