From b30f58703bfcc9d972e105a8b4de446c915292a2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 19 Dec 2020 12:33:55 +0530 Subject: [PATCH] More stupid PyQt enums --- src/calibre/gui2/tag_browser/view.py | 4 ++-- src/calibre/gui2/throbber.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 59a84a7b59..42b601f2f8 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -55,13 +55,13 @@ class TagDelegate(QStyledItemDelegate): # {{{ painter.fillRect(r, bg) style.proxy().drawPrimitive(style.PE_PanelItemViewItem, option, painter, widget) painter.setOpacity(0.3) - icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.Mode.On) + icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On) painter.restore() def draw_icon(self, style, painter, option, widget): r = style.subElementRect(style.SE_ItemViewItemDecoration, option, widget) icon = option.icon - icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.Mode.On) + icon.paint(painter, r, option.decorationAlignment, QIcon.Mode.Normal, QIcon.State.On) def paint_text(self, painter, rect, flags, text, hover): set_color = hover and QApplication.instance().is_dark_theme diff --git a/src/calibre/gui2/throbber.py b/src/calibre/gui2/throbber.py index 07417e2f18..b09b4eafb1 100644 --- a/src/calibre/gui2/throbber.py +++ b/src/calibre/gui2/throbber.py @@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en' from PyQt5.Qt import ( QToolButton, QSize, QPropertyAnimation, Qt, QMetaObject, pyqtProperty, QSizePolicy, - QWidget, QIcon, QPainter, QStyleOptionToolButton) + QWidget, QIcon, QPainter, QStyleOptionToolButton, QStyle, QAbstractAnimation) from calibre.gui2 import config @@ -54,7 +54,7 @@ class ThrobbingButton(QToolButton): def start_animation(self): if config['disable_animations']: return - if self.animation.state() != self.animation.Stopped or not self.isVisible(): + if self.animation.state() != QAbstractAnimation.State.Stopped or not self.isVisible(): return size = self.iconSize().width() smaller = int(0.7 * size) @@ -73,7 +73,7 @@ class ThrobbingButton(QToolButton): self.initStyleOption(opt) s = self.style() opt.iconSize = QSize(size, size) - s.drawComplexControl(s.CC_ToolButton, opt, p, self) + s.drawComplexControl(QStyle.ComplexControl.CC_ToolButton, opt, p, self) if __name__ == '__main__':