fix broken emote buttons, whatever...

This commit is contained in:
cidoku 2026-02-08 20:01:04 -03:00
parent 84f1af7ac1
commit cd51a065c9
2 changed files with 21 additions and 41 deletions

View File

@ -322,7 +322,7 @@ class EmoteButton(QtGui.QLabel):
if self.pixmap().isNull(): if self.pixmap().isNull():
buttonImg = QtGui.QPixmap(self.path + '_off.png') buttonImg = QtGui.QPixmap(self.path + '_off.png')
painter.setOpacity(0.5) painter.setOpacity(0.5)
if buttonImg and not buttonImg.isNull() and not buttonImg.width() == 40: if not buttonImg.width() == 40:
painter.drawPixmap(0, 0, buttonImg.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) painter.drawPixmap(0, 0, buttonImg.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
else: else:
painter.drawPixmap(0, 0, buttonImg) painter.drawPixmap(0, 0, buttonImg)

View File

@ -478,7 +478,7 @@ class AOCharMovie(QtGui.QLabel):
return QtCore.Qt.KeepAspectRatio return QtCore.Qt.KeepAspectRatio
def getScaledImage(self, f_img): def getScaledImage(self, f_img):
if f_img and not f_img.isNull(): if not f_img.isNull():
transform = self.getTransform(f_img.size().height() > self.size().height()) transform = self.getTransform(f_img.size().height() > self.size().height())
aspect = self.getAspect(f_img.size()) aspect = self.getAspect(f_img.size())
return f_img.scaled(self.size(), aspect, transform) return f_img.scaled(self.size(), aspect, transform)
@ -489,8 +489,6 @@ class AOCharMovie(QtGui.QLabel):
f_img = self.getScaledImage(self.mMovie.currentImage().mirrored(self.mFlipped, False)) f_img = self.getScaledImage(self.mMovie.currentImage().mirrored(self.mFlipped, False))
fPixmap = QtGui.QPixmap.fromImage(f_img) fPixmap = QtGui.QPixmap.fromImage(f_img)
if not fPixmap or fPixmap.isNull():
return
self.setPixmap(fPixmap) self.setPixmap(fPixmap)
if self.mMovie.frameCount() - 1 == nFrame and self.playOnce: if self.mMovie.frameCount() - 1 == nFrame and self.playOnce:
@ -516,8 +514,6 @@ class AOCharMovie(QtGui.QLabel):
f_img = self.getScaledImage(self.pillowFrames[self.pillowFrame][0].mirrored(self.mFlipped, False)) f_img = self.getScaledImage(self.pillowFrames[self.pillowFrame][0].mirrored(self.mFlipped, False))
fPixmap = QtGui.QPixmap.fromImage(f_img) fPixmap = QtGui.QPixmap.fromImage(f_img)
if not fPixmap or fPixmap.isNull():
return
self.setPixmap(fPixmap) self.setPixmap(fPixmap)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
@ -649,13 +645,11 @@ class AOMovie(QtGui.QLabel):
if not self.pillowFrames: return if not self.pillowFrames: return
f_img = self.pillowFrames[self.pillowFrame][0] f_img = self.pillowFrames[self.pillowFrame][0]
if not f_img or f_img.isNull(): if not f_img.isNull() and (f_img.size().width() != self.size().width() or f_img.size().height() != self.size().height()):
return
if (f_img.size().width() != self.size().width() or f_img.size().height() != self.size().height()):
f_img = f_img.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation) f_img = f_img.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)
self.pillowLabel.setPixmap(QtGui.QPixmap.fromImage(f_img)) fPixmap = QtGui.QPixmap.fromImage(f_img)
self.pillowLabel.setPixmap(fPixmap)
class ZoomLines(QtGui.QLabel): class ZoomLines(QtGui.QLabel):
def __init__(self, parent): def __init__(self, parent):
@ -703,7 +697,7 @@ class WTCEView(QtGui.QLabel):
return return
img = self.movie.currentImage() img = self.movie.currentImage()
pixmap = QtGui.QPixmap.fromImage(img) pixmap = QtGui.QPixmap.fromImage(img)
if pixmap and not pixmap.isNull(): if not pixmap.isNull():
self.setPixmap(pixmap.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) self.setPixmap(pixmap.scaled(self.size().width(), self.size().height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
if self.movie.currentFrameNumber() == self.movie.frameCount() - 1: if self.movie.currentFrameNumber() == self.movie.frameCount() - 1:
self.finalframeTimer.start(self.movie.nextFrameDelay()) self.finalframeTimer.start(self.movie.nextFrameDelay())
@ -1857,7 +1851,6 @@ class GUI(QtGui.QWidget):
else: else:
self.chatboxWidth = self.chatbox.width() self.chatboxWidth = self.chatbox.width()
self.chatboxHeight = self.chatbox.height() self.chatboxHeight = self.chatbox.height()
if chatboxPixmap and not chatboxPixmap.isNull():
self.chatbox.setPixmap(chatboxPixmap.scaled(self.chatboxWidth, self.chatboxHeight, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) self.chatbox.setPixmap(chatboxPixmap.scaled(self.chatboxWidth, self.chatboxHeight, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
# Theme background # Theme background
@ -2334,17 +2327,13 @@ class GUI(QtGui.QWidget):
def setEvidenceImage(self, guiobj, image, scale=False): def setEvidenceImage(self, guiobj, image, scale=False):
if exists(BASE_PATH + 'evidence/' + image): if exists(BASE_PATH + 'evidence/' + image):
img = QtGui.QPixmap(BASE_PATH + "evidence/%s" % image) img = QtGui.QPixmap(BASE_PATH + "evidence/%s" % image)
if not img or img.isNull(): if not img.isNull() and scale:
return
if scale:
guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
else: else:
guiobj.setPixmap(img) guiobj.setPixmap(img)
else: else:
img = QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png') img = QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png')
if not img or img.isNull(): if not img.isNull() and scale:
return
if scale:
guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
else: else:
guiobj.setPixmap(img) guiobj.setPixmap(img)
@ -2558,17 +2547,14 @@ class GUI(QtGui.QWidget):
else: else:
image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_off.png') image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(nRealEmote + 1) + '_off.png')
self.emoteButtons[nEmote].show() if not image.isNull() and not image.width() == 40:
self.emoteButtons[nEmote].setToolTip(self.charEmotes[nEmote + self.currentEmotePage * self.maxEmotesOnPage][0])
if not image or image.isNull():
return
if not image.width() == 40:
self.emoteButtons[nEmote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) self.emoteButtons[nEmote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
else: else:
self.emoteButtons[nEmote].setPixmap(image) self.emoteButtons[nEmote].setPixmap(image)
self.emoteButtons[nEmote].show()
self.emoteButtons[nEmote].setToolTip(self.charEmotes[nEmote + self.currentEmotePage * self.maxEmotesOnPage][0])
def iniSwapIndexChange(self, ind): def iniSwapIndexChange(self, ind):
self.iniSwapIndex = ind self.iniSwapIndex = ind
@ -2901,10 +2887,7 @@ class GUI(QtGui.QWidget):
else: else:
image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) + '_off.png') image = QtGui.QPixmap(BASE_PATH + 'characters/' + self.charName + '/emotions/button' + str(button.emoteid + self.currentEmotePage * self.maxEmotesOnPage + 1) + '_off.png')
if not image or image.isNull(): if not image.isNull() and not image.width() == 40:
return
if not image.width() == 40:
button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation)) button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation))
else: else:
button.setPixmap(image) button.setPixmap(image)
@ -3208,9 +3191,8 @@ class GUI(QtGui.QWidget):
if bgimg.size().width() != self.viewport.width() or bgimg.size().height() != self.viewport.height(): if bgimg.size().width() != self.viewport.width() or bgimg.size().height() != self.viewport.height():
if "bench" in bgfile[0]: if "bench" in bgfile[0]:
_scale = self.viewport.height() / float(bgimg.size().height()) _scale = self.viewport.height() / float(bgimg.size().height())
if bgimg and not bgimg.isNull():
setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg.scaled(bgimg.size().width() * _scale, bgimg.size().height() * _scale, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))) setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg.scaled(bgimg.size().width() * _scale, bgimg.size().height() * _scale, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)))
elif bgimg and not bgimg.isNull(): else:
setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg.scaled(self.viewport.width(), self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))) setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg.scaled(self.viewport.width(), self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)))
else: else:
setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg)) setattr(self, bgfile[0], QtGui.QPixmap.fromImage(bgimg))
@ -3222,17 +3204,15 @@ class GUI(QtGui.QWidget):
if self.slideAvailable: if self.slideAvailable:
slide = QtGui.QPixmap(court) slide = QtGui.QPixmap(court)
slideWidth = slide.width() * 2 slide_width = slide.width() * 2
self.slideBg.resize(slideWidth, self.viewport.height()) self.slideBg.resize(slide_width, self.viewport.height())
if slide and not slide.isNull():
self.slideBg.setPixmap(slide.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) self.slideBg.setPixmap(slide.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
courtOverlay = BASE_PATH + 'background/' + bg + '/courtOverlay.png' courtOverlay = BASE_PATH + 'background/' + bg + '/courtOverlay.png'
if exists(courtOverlay): if exists(courtOverlay):
slideOverlay = QtGui.QPixmap(courtOverlay) slideOverlay = QtGui.QPixmap(courtOverlay)
self.slideOverlay.resize(slideWidth, self.viewport.height()) self.slideOverlay.resize(slide_width, self.viewport.height())
if slideOverlay and not slideOverlay.isNull():
self.slideOverlay.setPixmap(slideOverlay.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)) self.slideOverlay.setPixmap(slideOverlay.scaled(slide.width() * 2, self.viewport.height(), QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
self.slideHasOverlay = True self.slideHasOverlay = True
else: else: