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,6 +244,9 @@ class EmoteButton(QtGui.QLabel):
if self.pixmap().isNull(): if self.pixmap().isNull():
button_img = QtGui.QPixmap(self.path + '_off.png') button_img = QtGui.QPixmap(self.path + '_off.png')
painter.setOpacity(0.5) painter.setOpacity(0.5)
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) painter.drawPixmap(0, 0, button_img)
else: else:
painter.drawPixmap(0, 0, self.pixmap()) painter.drawPixmap(0, 0, self.pixmap())

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') 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: 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: else:
self.emotebuttons[n_emote].setPixmap(image) self.emotebuttons[n_emote].setPixmap(image)
@ -2343,8 +2343,8 @@ class GUI(QtGui.QWidget):
else: 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') 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: if not image.isNull() and not image.width() == 40:
button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation)) button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
else: else:
button.setPixmap(image) button.setPixmap(image)