From cc7daedfeda4fe87208fe60d2ead3bb5157c844f Mon Sep 17 00:00:00 2001 From: cidoku Date: Tue, 8 Jul 2025 19:40:45 -0400 Subject: [PATCH] improve emote buttons when buttonN_on.png is not found and sizes are not 40x40 --- buttons.py | 5 ++++- gameview.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/buttons.py b/buttons.py index c9ba2a1..71be818 100644 --- a/buttons.py +++ b/buttons.py @@ -244,7 +244,10 @@ class EmoteButton(QtGui.QLabel): if self.pixmap().isNull(): button_img = QtGui.QPixmap(self.path + '_off.png') painter.setOpacity(0.5) - painter.drawPixmap(0, 0, button_img) + if not button_img.width() == 40: + painter.drawPixmap(0, 0, button_img.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) + else: + painter.drawPixmap(0, 0, button_img) else: painter.drawPixmap(0, 0, self.pixmap()) else: diff --git a/gameview.py b/gameview.py index 820a810..4203d86 100644 --- a/gameview.py +++ b/gameview.py @@ -2007,7 +2007,7 @@ class GUI(QtGui.QWidget): image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png') if not image.isNull() and not image.width() == 40: - self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation)) + self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) else: self.emotebuttons[n_emote].setPixmap(image) @@ -2343,8 +2343,8 @@ class GUI(QtGui.QWidget): else: image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_off.png') - if not image.isNull() and image.width() > 40: - button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation)) + if not image.isNull() and not image.width() == 40: + button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) else: button.setPixmap(image)