mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1378 (Info pane not big enough)
This commit is contained in:
parent
b74ece53a2
commit
dbf47cbc1e
@ -346,12 +346,12 @@ class Main(MainWindow, Ui_MainWindow):
|
|||||||
self.library_view.setCurrentIndex(self.library_view.currentIndex())
|
self.library_view.setCurrentIndex(self.library_view.currentIndex())
|
||||||
self.cover_flow.setVisible(True)
|
self.cover_flow.setVisible(True)
|
||||||
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
self.cover_flow.setFocus(Qt.OtherFocusReason)
|
||||||
self.status_bar.book_info.book_data.setMaximumHeight(100)
|
#self.status_bar.book_info.book_data.setMaximumHeight(100)
|
||||||
self.status_bar.setMaximumHeight(120)
|
#self.status_bar.setMaximumHeight(120)
|
||||||
self.library_view.scrollTo(self.library_view.currentIndex())
|
self.library_view.scrollTo(self.library_view.currentIndex())
|
||||||
else:
|
else:
|
||||||
self.cover_flow.setVisible(False)
|
self.cover_flow.setVisible(False)
|
||||||
self.status_bar.book_info.book_data.setMaximumHeight(1000)
|
#self.status_bar.book_info.book_data.setMaximumHeight(1000)
|
||||||
self.setMaximumHeight(available_height())
|
self.setMaximumHeight(available_height())
|
||||||
|
|
||||||
def toggle_tags_view(self, show):
|
def toggle_tags_view(self, show):
|
||||||
|
@ -2,16 +2,18 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
import re, collections
|
import re, collections
|
||||||
|
|
||||||
from PyQt4.QtGui import QStatusBar, QMovie, QLabel, QFrame, QHBoxLayout, QPixmap, \
|
from PyQt4.QtGui import QStatusBar, QMovie, QLabel, QWidget, QHBoxLayout, QPixmap, \
|
||||||
QVBoxLayout, QSizePolicy, QToolButton, QIcon
|
QVBoxLayout, QSizePolicy, QToolButton, QIcon, QScrollArea, QFrame
|
||||||
from PyQt4.QtCore import Qt, QSize, SIGNAL, QCoreApplication
|
from PyQt4.QtCore import Qt, QSize, SIGNAL, QCoreApplication
|
||||||
from calibre import fit_image, preferred_encoding
|
from calibre import fit_image, preferred_encoding
|
||||||
from calibre.gui2 import qstring_to_unicode
|
from calibre.gui2 import qstring_to_unicode
|
||||||
|
|
||||||
class BookInfoDisplay(QFrame):
|
class BookInfoDisplay(QWidget):
|
||||||
class BookCoverDisplay(QLabel):
|
class BookCoverDisplay(QLabel):
|
||||||
WIDTH = 80
|
|
||||||
HEIGHT = 100
|
WIDTH = 81
|
||||||
|
HEIGHT = 108
|
||||||
|
|
||||||
def __init__(self, coverpath=':/images/book.svg'):
|
def __init__(self, coverpath=':/images/book.svg'):
|
||||||
QLabel.__init__(self)
|
QLabel.__init__(self)
|
||||||
self.default_pixmap = QPixmap(coverpath).scaled(self.__class__.WIDTH,
|
self.default_pixmap = QPixmap(coverpath).scaled(self.__class__.WIDTH,
|
||||||
@ -19,6 +21,7 @@ class BookInfoDisplay(QFrame):
|
|||||||
Qt.IgnoreAspectRatio,
|
Qt.IgnoreAspectRatio,
|
||||||
Qt.SmoothTransformation)
|
Qt.SmoothTransformation)
|
||||||
self.setScaledContents(True)
|
self.setScaledContents(True)
|
||||||
|
self.setMaximumHeight(self.HEIGHT)
|
||||||
self.setPixmap(self.default_pixmap)
|
self.setPixmap(self.default_pixmap)
|
||||||
|
|
||||||
|
|
||||||
@ -39,11 +42,9 @@ class BookInfoDisplay(QFrame):
|
|||||||
class BookDataDisplay(QLabel):
|
class BookDataDisplay(QLabel):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
QLabel.__init__(self)
|
QLabel.__init__(self)
|
||||||
#self.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
|
||||||
self.setText('')
|
self.setText('')
|
||||||
self.setWordWrap(True)
|
self.setWordWrap(True)
|
||||||
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum))
|
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
|
||||||
self.setMaximumHeight(100)
|
|
||||||
|
|
||||||
def mouseReleaseEvent(self, ev):
|
def mouseReleaseEvent(self, ev):
|
||||||
self.emit(SIGNAL('mr(int)'), 1)
|
self.emit(SIGNAL('mr(int)'), 1)
|
||||||
@ -56,18 +57,20 @@ class BookInfoDisplay(QFrame):
|
|||||||
WEIGHTS[_('Tags')] = 4
|
WEIGHTS[_('Tags')] = 4
|
||||||
|
|
||||||
def __init__(self, clear_message):
|
def __init__(self, clear_message):
|
||||||
QFrame.__init__(self)
|
QWidget.__init__(self)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
|
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
|
||||||
|
self._layout = QHBoxLayout()
|
||||||
|
self.setLayout(self._layout)
|
||||||
self.clear_message = clear_message
|
self.clear_message = clear_message
|
||||||
self.layout = QHBoxLayout()
|
|
||||||
self.setLayout(self.layout)
|
|
||||||
self.cover_display = BookInfoDisplay.BookCoverDisplay()
|
self.cover_display = BookInfoDisplay.BookCoverDisplay()
|
||||||
self.layout.addWidget(self.cover_display)
|
self._layout.addWidget(self.cover_display)
|
||||||
self.book_data = BookInfoDisplay.BookDataDisplay()
|
self.book_data = BookInfoDisplay.BookDataDisplay()
|
||||||
self.connect(self.book_data, SIGNAL('mr(int)'), self.mouseReleaseEvent)
|
self.connect(self.book_data, SIGNAL('mr(int)'), self.mouseReleaseEvent)
|
||||||
self.layout.addWidget(self.book_data)
|
self._layout.addWidget(self.book_data)
|
||||||
self.data = {}
|
self.data = {}
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
|
self._layout.setAlignment(self.cover_display, Qt.AlignTop|Qt.AlignLeft)
|
||||||
|
|
||||||
def mouseReleaseEvent(self, ev):
|
def mouseReleaseEvent(self, ev):
|
||||||
self.emit(SIGNAL('show_book_info()'))
|
self.emit(SIGNAL('show_book_info()'))
|
||||||
@ -85,7 +88,6 @@ class BookInfoDisplay(QFrame):
|
|||||||
keys.sort(cmp=lambda x, y: cmp(self.WEIGHTS[x], self.WEIGHTS[y]))
|
keys.sort(cmp=lambda x, y: cmp(self.WEIGHTS[x], self.WEIGHTS[y]))
|
||||||
for key in keys:
|
for key in keys:
|
||||||
txt = data[key]
|
txt = data[key]
|
||||||
#txt = '<br />\n'.join(textwrap.wrap(txt, 120))
|
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
key = key.decode(preferred_encoding, 'replace')
|
key = key.decode(preferred_encoding, 'replace')
|
||||||
if isinstance(txt, str):
|
if isinstance(txt, str):
|
||||||
@ -94,6 +96,8 @@ class BookInfoDisplay(QFrame):
|
|||||||
self.book_data.setText(u'<table>'+rows+u'</table>')
|
self.book_data.setText(u'<table>'+rows+u'</table>')
|
||||||
|
|
||||||
self.clear_message()
|
self.clear_message()
|
||||||
|
self.book_data.updateGeometry()
|
||||||
|
self.updateGeometry()
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
|
|
||||||
class MovieButton(QFrame):
|
class MovieButton(QFrame):
|
||||||
@ -164,6 +168,7 @@ class TagViewButton(QToolButton):
|
|||||||
|
|
||||||
|
|
||||||
class StatusBar(QStatusBar):
|
class StatusBar(QStatusBar):
|
||||||
|
|
||||||
def __init__(self, jobs_dialog, systray=None):
|
def __init__(self, jobs_dialog, systray=None):
|
||||||
QStatusBar.__init__(self)
|
QStatusBar.__init__(self)
|
||||||
self.systray = systray
|
self.systray = systray
|
||||||
@ -174,9 +179,15 @@ class StatusBar(QStatusBar):
|
|||||||
self.addPermanentWidget(self.tag_view_button)
|
self.addPermanentWidget(self.tag_view_button)
|
||||||
self.addPermanentWidget(self.movie_button)
|
self.addPermanentWidget(self.movie_button)
|
||||||
self.book_info = BookInfoDisplay(self.clearMessage)
|
self.book_info = BookInfoDisplay(self.clearMessage)
|
||||||
|
self.scroll_area = QScrollArea()
|
||||||
|
self.scroll_area.setWidget(self.book_info)
|
||||||
|
self.scroll_area.setMaximumHeight(120)
|
||||||
|
self.scroll_area.setWidgetResizable(True)
|
||||||
self.connect(self.book_info, SIGNAL('show_book_info()'), self.show_book_info)
|
self.connect(self.book_info, SIGNAL('show_book_info()'), self.show_book_info)
|
||||||
self.addWidget(self.book_info)
|
self.addWidget(self.scroll_area, 100)
|
||||||
self.setMinimumHeight(120)
|
self.setMinimumHeight(120)
|
||||||
|
self.setMaximumHeight(120)
|
||||||
|
|
||||||
|
|
||||||
def reset_info(self):
|
def reset_info(self):
|
||||||
self.book_info.show_data({})
|
self.book_info.show_data({})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user