improve emote buttons when buttonN_on.png is not found and sizes are not 40x40

This commit is contained in:
cidoku 2025-07-08 19:40:45 -04:00
parent b51eed6c03
commit cc7daedfed
2 changed files with 7 additions and 4 deletions

View File

@ -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:

View File

@ -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)