mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add config option to show cover browser in larger, separate window. Fixes #1437 (Bigger cover browser)
This commit is contained in:
parent
b3ac2ca6f3
commit
37c35128e4
@ -54,8 +54,12 @@ def _config():
|
|||||||
c.add_opt('autolaunch_server', default=False, help=_('Automatically launch content server on application startup'))
|
c.add_opt('autolaunch_server', default=False, help=_('Automatically launch content server on application startup'))
|
||||||
c.add_opt('oldest_news', default=60, help=_('Oldest news kept in database'))
|
c.add_opt('oldest_news', default=60, help=_('Oldest news kept in database'))
|
||||||
c.add_opt('systray_icon', default=True, help=_('Show system tray icon'))
|
c.add_opt('systray_icon', default=True, help=_('Show system tray icon'))
|
||||||
c.add_opt('upload_news_to_device', default=True, help=_('Upload downloaded news to device'))
|
c.add_opt('upload_news_to_device', default=True,
|
||||||
c.add_opt('delete_news_from_library_on_upload', default=False, help=_('Delete books from library after uploading to device'))
|
help=_('Upload downloaded news to device'))
|
||||||
|
c.add_opt('delete_news_from_library_on_upload', default=False,
|
||||||
|
help=_('Delete books from library after uploading to device'))
|
||||||
|
c.add_opt('separate_cover_flow', default=False,
|
||||||
|
help=_('Show the cover flow in a separate window instead of in the main calibre window'))
|
||||||
return ConfigProxy(c)
|
return ConfigProxy(c)
|
||||||
|
|
||||||
config = _config()
|
config = _config()
|
||||||
|
@ -69,11 +69,11 @@ if pictureflow is not None:
|
|||||||
|
|
||||||
class CoverFlow(pictureflow.PictureFlow):
|
class CoverFlow(pictureflow.PictureFlow):
|
||||||
|
|
||||||
def __init__(self, height=300, parent=None):
|
def __init__(self, height=300, parent=None, text_height=25):
|
||||||
pictureflow.PictureFlow.__init__(self, parent,
|
pictureflow.PictureFlow.__init__(self, parent,
|
||||||
config['cover_flow_queue_length']+1)
|
config['cover_flow_queue_length']+1)
|
||||||
self.setSlideSize(QSize(int(2/3. * height), height))
|
self.setSlideSize(QSize(int(2/3. * height), height))
|
||||||
self.setMinimumSize(QSize(int(2.35*0.67*height), (5/3.)*height+25))
|
self.setMinimumSize(QSize(int(2.35*0.67*height), (5/3.)*height+text_height))
|
||||||
self.setFocusPolicy(Qt.WheelFocus)
|
self.setFocusPolicy(Qt.WheelFocus)
|
||||||
self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))
|
self.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))
|
||||||
|
|
||||||
|
@ -244,6 +244,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
self.connect(self.remove_plugin, SIGNAL('clicked()'), lambda : self.modify_plugin(op='remove'))
|
self.connect(self.remove_plugin, SIGNAL('clicked()'), lambda : self.modify_plugin(op='remove'))
|
||||||
self.connect(self.button_plugin_browse, SIGNAL('clicked()'), self.find_plugin)
|
self.connect(self.button_plugin_browse, SIGNAL('clicked()'), self.find_plugin)
|
||||||
self.connect(self.button_plugin_add, SIGNAL('clicked()'), self.add_plugin)
|
self.connect(self.button_plugin_add, SIGNAL('clicked()'), self.add_plugin)
|
||||||
|
self.separate_cover_flow.setChecked(config['separate_cover_flow'])
|
||||||
|
|
||||||
def add_plugin(self):
|
def add_plugin(self):
|
||||||
path = unicode(self.plugin_path.text())
|
path = unicode(self.plugin_path.text())
|
||||||
@ -392,6 +393,7 @@ class ConfigDialog(QDialog, Ui_Dialog):
|
|||||||
config['column_map'] = cols
|
config['column_map'] = cols
|
||||||
config['toolbar_icon_size'] = self.ICON_SIZES[self.toolbar_button_size.currentIndex()]
|
config['toolbar_icon_size'] = self.ICON_SIZES[self.toolbar_button_size.currentIndex()]
|
||||||
config['show_text_in_toolbar'] = bool(self.show_toolbar_text.isChecked())
|
config['show_text_in_toolbar'] = bool(self.show_toolbar_text.isChecked())
|
||||||
|
config['separate_cover_flow'] = bool(self.separate_cover_flow.isChecked())
|
||||||
pattern = self.filename_pattern.commit()
|
pattern = self.filename_pattern.commit()
|
||||||
prefs['filename_pattern'] = pattern
|
prefs['filename_pattern'] = pattern
|
||||||
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
|
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>563</height>
|
<height>570</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
@ -356,7 +356,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" >
|
<item row="7" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox_2" >
|
<widget class="QGroupBox" name="groupBox_2" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Toolbar</string>
|
<string>Toolbar</string>
|
||||||
@ -404,7 +404,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" >
|
<item row="8" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Select visible &columns in library view</string>
|
<string>Select visible &columns in library view</string>
|
||||||
@ -492,20 +492,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="4" column="0" >
|
||||||
<widget class="QCheckBox" name="sync_news" >
|
<widget class="QCheckBox" name="sync_news" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Automatically send downloaded &news to ebook reader</string>
|
<string>Automatically send downloaded &news to ebook reader</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" >
|
<item row="5" column="0" >
|
||||||
<widget class="QCheckBox" name="delete_news" >
|
<widget class="QCheckBox" name="delete_news" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Delete news from library when it is sent to reader</string>
|
<string>&Delete news from library when it is sent to reader</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QCheckBox" name="separate_cover_flow" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Show cover &browser in a separate window (needs restart)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_2" >
|
<widget class="QWidget" name="page_2" >
|
||||||
|
@ -7,7 +7,7 @@ from PyQt4.Qt import Qt, SIGNAL, QObject, QCoreApplication, QUrl, QTimer, \
|
|||||||
QModelIndex, QPixmap, QColor, QPainter, QMenu, QIcon, \
|
QModelIndex, QPixmap, QColor, QPainter, QMenu, QIcon, \
|
||||||
QToolButton, QDialog, QDesktopServices, QFileDialog, \
|
QToolButton, QDialog, QDesktopServices, QFileDialog, \
|
||||||
QSystemTrayIcon, QApplication, QKeySequence, QAction, \
|
QSystemTrayIcon, QApplication, QKeySequence, QAction, \
|
||||||
QProgressDialog, QMessageBox
|
QProgressDialog, QMessageBox, QStackedLayout
|
||||||
from PyQt4.QtSvg import QSvgRenderer
|
from PyQt4.QtSvg import QSvgRenderer
|
||||||
|
|
||||||
from calibre import __version__, __appname__, islinux, sanitize_file_name, \
|
from calibre import __version__, __appname__, islinux, sanitize_file_name, \
|
||||||
@ -22,7 +22,8 @@ from calibre.gui2 import APP_UID, warning_dialog, choose_files, error_dialog, \
|
|||||||
pixmap_to_data, choose_dir, ORG_NAME, \
|
pixmap_to_data, choose_dir, ORG_NAME, \
|
||||||
set_sidebar_directories, Dispatcher, \
|
set_sidebar_directories, Dispatcher, \
|
||||||
SingleApplication, Application, available_height, \
|
SingleApplication, Application, available_height, \
|
||||||
max_available_height, config, info_dialog
|
max_available_height, config, info_dialog, \
|
||||||
|
available_width
|
||||||
from calibre.gui2.cover_flow import CoverFlow, DatabaseImages, pictureflowerror
|
from calibre.gui2.cover_flow import CoverFlow, DatabaseImages, pictureflowerror
|
||||||
from calibre.library.database import LibraryDatabase
|
from calibre.library.database import LibraryDatabase
|
||||||
from calibre.gui2.dialogs.scheduler import Scheduler
|
from calibre.gui2.dialogs.scheduler import Scheduler
|
||||||
@ -342,9 +343,16 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
########################### Cover Flow ################################
|
########################### Cover Flow ################################
|
||||||
self.cover_flow = None
|
self.cover_flow = None
|
||||||
if CoverFlow is not None:
|
if CoverFlow is not None:
|
||||||
self.cover_flow = CoverFlow(height=220 if available_height() > 950 else 170 if available_height() > 850 else 140)
|
text_height = 40 if config['separate_cover_flow'] else 25
|
||||||
|
ah = available_height()
|
||||||
|
cfh = ah-100
|
||||||
|
cfh = 3./5 * cfh - text_height
|
||||||
|
if not config['separate_cover_flow']:
|
||||||
|
cfh = 220 if ah > 950 else 170 if ah > 850 else 140
|
||||||
|
self.cover_flow = CoverFlow(height=cfh, text_height=text_height)
|
||||||
self.cover_flow.setVisible(False)
|
self.cover_flow.setVisible(False)
|
||||||
self.library.layout().addWidget(self.cover_flow)
|
if not config['separate_cover_flow']:
|
||||||
|
self.library.layout().addWidget(self.cover_flow)
|
||||||
self.connect(self.cover_flow, SIGNAL('currentChanged(int)'), self.sync_cf_to_listview)
|
self.connect(self.cover_flow, SIGNAL('currentChanged(int)'), self.sync_cf_to_listview)
|
||||||
self.connect(self.cover_flow, SIGNAL('itemActivated(int)'), self.show_book_info)
|
self.connect(self.cover_flow, SIGNAL('itemActivated(int)'), self.show_book_info)
|
||||||
self.connect(self.status_bar.cover_flow_button, SIGNAL('toggled(bool)'), self.toggle_cover_flow)
|
self.connect(self.status_bar.cover_flow_button, SIGNAL('toggled(bool)'), self.toggle_cover_flow)
|
||||||
@ -410,17 +418,40 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
|
|
||||||
def toggle_cover_flow(self, show):
|
def toggle_cover_flow(self, show):
|
||||||
if show:
|
if config['separate_cover_flow']:
|
||||||
self.library_view.setCurrentIndex(self.library_view.currentIndex())
|
if show:
|
||||||
self.cover_flow.setVisible(True)
|
d = QDialog(self)
|
||||||
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
ah, aw = available_height(), available_width()
|
||||||
#self.status_bar.book_info.book_data.setMaximumHeight(100)
|
d.resize(int(aw/2.), ah-60)
|
||||||
#self.status_bar.setMaximumHeight(120)
|
d._layout = QStackedLayout()
|
||||||
self.library_view.scrollTo(self.library_view.currentIndex())
|
d.setLayout(d._layout)
|
||||||
|
d.setWindowTitle(_('Browse by covers'))
|
||||||
|
d.layout().addWidget(self.cover_flow)
|
||||||
|
self.cover_flow.setVisible(True)
|
||||||
|
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
||||||
|
self.library_view.scrollTo(self.library_view.currentIndex())
|
||||||
|
d.show()
|
||||||
|
self.connect(d, SIGNAL('finished(int)'),
|
||||||
|
lambda x: self.status_bar.cover_flow_button.setChecked(False))
|
||||||
|
self.cf_dialog = d
|
||||||
|
else:
|
||||||
|
cfd = getattr(self, 'cf_dialog', None)
|
||||||
|
if cfd is not None:
|
||||||
|
self.cover_flow.setVisible(False)
|
||||||
|
cfd.hide()
|
||||||
|
self.cf_dialog = None
|
||||||
else:
|
else:
|
||||||
self.cover_flow.setVisible(False)
|
if show:
|
||||||
#self.status_bar.book_info.book_data.setMaximumHeight(1000)
|
self.library_view.setCurrentIndex(self.library_view.currentIndex())
|
||||||
self.setMaximumHeight(available_height())
|
self.cover_flow.setVisible(True)
|
||||||
|
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
||||||
|
#self.status_bar.book_info.book_data.setMaximumHeight(100)
|
||||||
|
#self.status_bar.setMaximumHeight(120)
|
||||||
|
self.library_view.scrollTo(self.library_view.currentIndex())
|
||||||
|
else:
|
||||||
|
self.cover_flow.setVisible(False)
|
||||||
|
#self.status_bar.book_info.book_data.setMaximumHeight(1000)
|
||||||
|
self.setMaximumHeight(available_height())
|
||||||
|
|
||||||
def toggle_tags_view(self, show):
|
def toggle_tags_view(self, show):
|
||||||
if show:
|
if show:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user