From 3a152fe2b21d0d7b68e0509586584a9d6f59731f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 26 Jun 2022 11:26:19 +0530 Subject: [PATCH] Fix donate button being rendered as a blank when toolbar icons are turned off This does mean that there will be one icon on the toolbar always (unless the donate button is removed). --- src/calibre/gui2/bars.py | 2 +- src/calibre/gui2/throbber.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/bars.py b/src/calibre/gui2/bars.py index 0f03d9e029..14909aeb36 100644 --- a/src/calibre/gui2/bars.py +++ b/src/calibre/gui2/bars.py @@ -704,6 +704,6 @@ class BarsManager(QObject): for bar in self.bars: bar.setIconSize(QSize(sz, sz)) bar.setToolButtonStyle(style) - if bar.showing_donate: + if bar.donate_button: bar.donate_button.setIconSize(bar.iconSize()) bar.donate_button.setToolButtonStyle(style) diff --git a/src/calibre/gui2/throbber.py b/src/calibre/gui2/throbber.py index 9540d06d77..f890d21f99 100644 --- a/src/calibre/gui2/throbber.py +++ b/src/calibre/gui2/throbber.py @@ -56,6 +56,8 @@ class ThrobbingButton(QToolButton): if self.animation.state() != QAbstractAnimation.State.Stopped or not self.isVisible(): return size = self.iconSize().width() + if size < 1: + size = max(0, self.width() - 4) smaller = int(0.7 * size) self.animation.setStartValue(smaller) self.animation.setEndValue(size) @@ -67,6 +69,7 @@ class ThrobbingButton(QToolButton): def paintEvent(self, ev): size = self._icon_size if self._icon_size > 10 else self.iconSize().width() + size = size or max(0, self.width() - 4) p = QPainter(self) opt = QStyleOptionToolButton() self.initStyleOption(opt)