mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More stupid PyQt enums
This commit is contained in:
parent
9a4cef4b5d
commit
b30f58703b
@ -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
|
||||
|
@ -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__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user