From f97bcfb1a8799d685722c56f76b6b659836c8810 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 May 2011 10:46:50 -0600 Subject: [PATCH 1/4] Try harder to recover on systems where people run temp file cleaners that delete the temp files of running programs --- src/calibre/ptempfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ptempfile.py b/src/calibre/ptempfile.py index bff13dd248..01e8f18339 100644 --- a/src/calibre/ptempfile.py +++ b/src/calibre/ptempfile.py @@ -29,6 +29,10 @@ def remove_dir(x): def base_dir(): global _base_dir + if _base_dir is not None and not os.path.exists(_base_dir): + # Some people seem to think that running temp file cleaners that + # delete the temp dirs of running programs is a good idea! + _base_dir = None if _base_dir is None: td = os.environ.get('CALIBRE_WORKER_TEMP_DIR', None) if td is not None: From 8336bd6e4986effa3a184a410d885f95989c4d29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 May 2011 10:48:45 -0600 Subject: [PATCH 2/4] Update Washington Post. Fixes #786609 (Updated recipe for The Washington Post) --- recipes/icons/wash_post.png | Bin 0 -> 1158 bytes recipes/wash_post.recipe | 119 ++++++++++++++++++++---------------- 2 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 recipes/icons/wash_post.png diff --git a/recipes/icons/wash_post.png b/recipes/icons/wash_post.png new file mode 100644 index 0000000000000000000000000000000000000000..e392e4c3ff7b37e4106fb51359242e524fd80413 GIT binary patch literal 1158 zcmV;11bO?3P)000C{Nklx)Fm$tUHn1T`pB@Ttt(^HNa$8s*_kt_87BKouTIfwzs!0FE4{^j5W{W#bFs^Z;zT_ZyXZCJZLmrU0w0j zSh7mSkA^Uoi({0u6+Aj+Y7Z9EpgicPifQm2DiQfXt5x!c7O{l@*avq)a4=tkhW8JH zpoW-3O@SRt2}`BjOf?D~9v*N(j0Nv1d`)P^(jOko)QVFg)7wEy@C0MqXvhn|3xmDC zzsH7D`0`;ooxZ%h#59=XGOd)VWU{Xj(=v&;*CH-qsZQJk_qqD~MdGzf=> zhw?N2MbPH!>x;j*k^zsz+~x%wA0L~~Xb6_52r%9mQi2zl0S+j$vor?mWB*U^|+4{1moQ9d{{v}EeboxQU>u->~!YsiL0n};OsC12){Sjcl{yI?m zL>-Yt-e5?3xlBXA0e;f#ZJ3t_rwUX?cmGF*Q@^`rL!6kBL{*GJMh))Tjd-uhK%3ZU z%Q_$|)oXD>Nbwq*WA>t6>e-RVh=n!mxf^7!=}a&y0aIhbGO!0=Ih{`ZgzxlxV!^$U z>>#y#{ZQE0Qxo3Ava?C(ibL0ziUC&=Z9{Vgu+->G)I~&rlYjV1<>p+BosxKL2 zZ-!BAY|Ijz)U3yhIMf6s&Q^IgZ74fzY~+6{;Wx>GU|EroHdC|K7Fm*sdCFf6gQDJO zNdb(2teH-Ty5%$k5{ Date: Sun, 22 May 2011 12:29:31 -0600 Subject: [PATCH 3/4] ... --- src/calibre/gui2/actions/copy_to_library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index 2e4d0380be..7190d1486f 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -16,7 +16,7 @@ from calibre.gui2 import error_dialog, Dispatcher, warning_dialog from calibre.gui2.dialogs.progress import ProgressDialog from calibre.utils.config import prefs, tweaks -class Worker(Thread): +class Worker(Thread): # {{{ def __init__(self, ids, db, loc, progress, done, delete_after): Thread.__init__(self) @@ -75,7 +75,7 @@ class Worker(Thread): if co is not None: newdb.set_conversion_options(x, 'PIPE', co) self.processed.add(x) - +# }}} class CopyToLibraryAction(InterfaceAction): From 8a4ceb206d57b8e133cefec77736930c1d94e418 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 May 2011 12:43:25 -0600 Subject: [PATCH 4/4] Fix ratings deleegate to use model supplied color --- src/calibre/gui2/library/delegates.py | 20 +++++++++++++------- src/calibre/gui2/library/models.py | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index e2234f6df5..b3012a7211 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -40,10 +40,7 @@ class RatingDelegate(QStyledItemDelegate): # {{{ 50 + 40 * sin(0.8 * i * pi)) self.star_path.closeSubpath() self.star_path.setFillRule(Qt.WindingFill) - gradient = QLinearGradient(0, 0, 0, 100) - gradient.setColorAt(0.0, self.COLOR) - gradient.setColorAt(1.0, self.COLOR) - self.brush = QBrush(gradient) + self.gradient = QLinearGradient(0, 0, 0, 100) self.factor = self.SIZE/100. def sizeHint(self, option, index): @@ -53,7 +50,8 @@ class RatingDelegate(QStyledItemDelegate): # {{{ def paint(self, painter, option, index): style = self._parent.style() option = QStyleOptionViewItemV4(option) - self.initStyleOption(option, self.dummy) + self.initStyleOption(option, index) + option.text = u'' num = index.model().data(index, Qt.DisplayRole).toInt()[0] def draw_star(): painter.save() @@ -65,6 +63,7 @@ class RatingDelegate(QStyledItemDelegate): # {{{ painter.restore() painter.save() + if hasattr(QStyle, 'CE_ItemViewItem'): style.drawControl(QStyle.CE_ItemViewItem, option, painter, self._parent) @@ -75,8 +74,15 @@ class RatingDelegate(QStyledItemDelegate): # {{{ painter.setClipRect(option.rect) y = option.rect.center().y()-self.SIZE/2. x = option.rect.left() - painter.setPen(self.PEN) - painter.setBrush(self.brush) + color = index.data(Qt.ForegroundRole) + if color.isNull() or not color.isValid(): + color = self.COLOR + else: + color = QColor(color) + painter.setPen(QPen(color, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)) + self.gradient.setColorAt(0.0, color) + self.gradient.setColorAt(1.0, color) + painter.setBrush(QBrush(self.gradient)) painter.translate(x, y) i = 0 while i < num: diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index fc1117167d..0baf98ecdd 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -693,9 +693,9 @@ class BooksModel(QAbstractTableModel): # {{{ return NONE if role in (Qt.DisplayRole, Qt.EditRole): return self.column_to_dc_map[col](index.row()) - elif role == Qt.BackgroundColorRole: + elif role == Qt.BackgroundRole: if self.id(index) in self.ids_to_highlight_set: - return QColor('lightgreen') + return QVariant(QColor('lightgreen')) elif role == Qt.DecorationRole: if self.column_to_dc_decorator_map[col] is not None: return self.column_to_dc_decorator_map[index.column()](index.row())