Fix font sizes and background colors in book details panel

This commit is contained in:
Kovid Goyal 2010-11-05 13:13:02 -06:00
parent 210c95daae
commit 46baa77c0a
2 changed files with 21 additions and 7 deletions

View File

@ -9,8 +9,8 @@ import os, collections, sys
from Queue import Queue
from PyQt4.Qt import QPixmap, QSize, QWidget, Qt, pyqtSignal, \
QPropertyAnimation, QEasingCurve, QThread, \
QSizePolicy, QPainter, QRect, pyqtProperty, QLayout
QPropertyAnimation, QEasingCurve, QThread, QApplication, QFontInfo, \
QSizePolicy, QPainter, QRect, pyqtProperty, QLayout, QPalette
from PyQt4.QtWebKit import QWebView
from calibre import fit_image, prepare_string_for_xml
@ -210,23 +210,37 @@ class BookInfo(QWebView):
def _show_data(self, rows, comments):
f = QFontInfo(QApplication.font(self.parent())).pixelSize()
p = unicode(QApplication.palette().color(QPalette.Normal,
QPalette.Base).name())
templ = u'''\
<html>
<head>
<style type="text/css">
body, td {background-color: %s; font-size: %dpx}
</style>
</head>
<body>
%%s
</body>
<html>
'''%(p, f)
if self.vertical:
if comments:
rows += u'<tr><td colspan="2">%s</td></tr>'%comments
self.setHtml(u'<table>%s</table>'%rows)
self.setHtml(templ%(u'<table>%s</table>'%rows))
else:
left_pane = u'<table>%s</table>'%rows
right_pane = u'<div>%s</div>'%comments
self.setHtml(u'<table><tr><td valign="top" '
self.setHtml(templ%(u'<table><tr><td valign="top" '
'style="padding-right:2em">%s</td><td valign="top">%s</td></tr></table>'
% (left_pane, right_pane))
% (left_pane, right_pane)))
def mouseDoubleClickEvent(self, ev):
ev.ignore()
# }}}
class DetailsLayout(QLayout): # {{{
def __init__(self, vertical, parent):

View File

@ -456,7 +456,7 @@ Using this button to create author sort will change author sort from red to gree
<property name="maximumSize">
<size>
<width>16777215</width>
<height>130</height>
<height>140</height>
</size>
</property>
<property name="dragDropMode">