make judge buttons and health bars skinnable

This commit is contained in:
cidoku 2025-10-11 20:44:57 -03:00
parent 8d3272f90b
commit 6289b2a834
3 changed files with 348 additions and 297 deletions

View File

@ -2,7 +2,7 @@
# window size is defined at the end of the file
# IC viewport
_scale = 2
_scale = 2.5
self.viewport.setGeometry(0, 0, 256 * _scale, 192 * _scale)
# Textbox
@ -110,10 +110,14 @@ self.cbSpacing.move(self.cbMockText.x(), self.cbMockText.y()+24)
self.cbAutoCaps.move(self.cbSpacing.x(), self.cbSpacing.y()+24)
# Judge options
self.btnDefenseBar.moveBar(self.gameTabs.x() + self.gameTabs.width() + 11, viewportBottom + 61)
self.btnProsecutionBar.moveBar(self.btnDefenseBar.x(), viewportBottom + 75)
self.btnDefenseBar.setGeometry(self.gameTabs.x() + self.gameTabs.width() + 11, viewportBottom + 61, 84, 14)
self.btnProsecutionBar.setGeometry(self.btnDefenseBar.x(), viewportBottom + 75, 84, 14)
self.btnRealization.move(self.btnDefenseBar.x(), viewportBottom + 89)
self.btnShake.move(self.btnRealization.x() + self.btnRealization.width(), self.btnRealization.y())
self.btnDefenseBar.btnMinus.move(self.btnDefenseBar.x() - (9/2), self.btnDefenseBar.y() + (14/2) - (9/2))
self.btnDefenseBar.btnPlus.move(self.btnDefenseBar.x() + 84 - (9/2), self.btnDefenseBar.y() + (14/2) - (9/2))
self.btnProsecutionBar.btnMinus.move(self.btnProsecutionBar.x() - (9/2), self.btnProsecutionBar.y() + (14/2) - (9/2))
self.btnProsecutionBar.btnPlus.move(self.btnProsecutionBar.x() + 84 - (9/2), self.btnProsecutionBar.y() + (14/2) - (9/2))
self.btnWitnessTestimony.move(self.btnDefenseBar.x(), viewportBottom + 137)
self.btnCrossExamination.move(self.btnWitnessTestimony.x(), self.btnWitnessTestimony.y() + self.btnWitnessTestimony.size().height())

View File

@ -50,11 +50,23 @@ class CustomObjection(QtGui.QLabel):
def __init__(self, parent):
super(CustomObjection, self).__init__(parent)
self.parent = parent
self.resize(76, 28)
self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/custom.png")
self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/custom_selected.png")
self.setPixmap(self.notpressed_pix)
self.notpressed_pix = None
self.pressed_pix = None
self.show()
def setPixmaps(self, theme):
self.pressed_pix = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/custom_selected.png" % theme,
AO2XPpath + "themes/default/custom_selected.png",
))
self.notpressed_pix = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/custom.png" % theme,
AO2XPpath + "themes/default/custom.png",
))
self.setPixmap(self.pressed_pix if self.pressed else self.notpressed_pix)
def move(self, x, y):
self.setGeometry(x, y, self.notpressed_pix.size().width(), self.notpressed_pix.size().height())
def setPressed(self, on):
self.pressed = on
@ -79,18 +91,30 @@ class WTCEbuttons(QtGui.QLabel):
variant = 0
def __init__(self, parent, type, variant=0):
super(WTCEbuttons, self).__init__(parent)
self.resize(85, 42)
if type == 0:
self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/witnesstestimony.png"))
elif type == 1:
self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/crossexamination.png"))
elif type == 2:
if variant == 0:
self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/notguilty.png"))
elif variant == 1:
self.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/guilty.png"))
self.type = type
self.variant = variant
self.pix = None
def setPixmaps(self, theme):
name = ""
if self.type == 0:
name = "witnesstestimony"
elif self.type == 1:
name = "crossexamination"
elif self.type == 2:
if self.variant == 0:
name = "notguilty"
else:
name = "guilty"
self.pix = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/%s.png" % (theme, name),
AO2XPpath + "themes/default/%s.png" % name,
))
self.setPixmap(self.pix)
def move(self, x, y):
self.setGeometry(x, y, self.pix.size().width(), self.pix.size().height())
def mousePressEvent(self, event):
self.clicked.emit(self.type, self.variant)
@ -154,7 +178,7 @@ class Objections(QtGui.QLabel):
self.clicked.emit()
class PixmapButton(QtGui.QAbstractButton):
def __init__(self, parent, pixmap):
def __init__(self, parent, pixmap = None):
super(PixmapButton, self).__init__(parent)
self.pixmap = pixmap
@ -162,8 +186,11 @@ class PixmapButton(QtGui.QAbstractButton):
painter = QtGui.QPainter(self)
painter.drawPixmap(event.rect(), self.pixmap)
def sizeHint(self):
return self.pixmap.size()
# def sizeHint(self):
# return self.pixmap.size() if self.pixmap else None
def move(self, x, y):
self.setGeometry(x, y, self.pixmap.size().width(), self.pixmap.size().height())
def setPixmap(self, pixmap):
self.pixmap = pixmap
@ -192,29 +219,50 @@ class PenaltyBars(QtGui.QLabel):
self.penaltybars = []
self.type = type
self.health = 10
self.resize(84, 14)
if type == 1: #defense bar.
for i in range(11):
self.penaltybars.append(QtGui.QPixmap(AO2XPpath + "themes/default/defensebar"+str(i)+".png"))
side = "def"
elif type == 2: #prosecution bar
for i in range(11):
self.penaltybars.append(QtGui.QPixmap(AO2XPpath + "themes/default/prosecutionbar"+str(i)+".png"))
side = "pro"
self.side = side
self.minusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath + "themes/default/" + side + "minus.png"))
self.plusbtn = PixmapButton(parent, QtGui.QPixmap(AO2XPpath + "themes/default/" + side + "plus.png"))
self.minusbtn.clicked.connect(self.minusClick)
self.plusbtn.clicked.connect(self.plusClick)
self.setPixmap(self.penaltybars[10])
self.minusbtn.show()
self.plusbtn.show()
self.side = "def" if self.type == 1 else "pro"
self.btnMinus = PixmapButton(parent)
self.btnPlus = PixmapButton(parent)
self.btnMinus.clicked.connect(self.minusClick)
self.btnPlus.clicked.connect(self.plusClick)
self.btnMinus.show()
self.btnPlus.show()
self.pixMinus = None
self.pixPlus = None
self.setScaledContents(True)
self.show()
def setPixmaps(self, theme):
del self.penaltybars[:]
self.penaltybars = []
if self.type == 1:
for i in range(11):
pix = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/defensebar%s.png" % (theme, i),
AO2XPpath + "themes/default/defensebar%s.png" % i
))
self.penaltybars.append(pix)
elif self.type == 2:
for i in range(11):
pix = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/prosecutionbar%s.png" % (theme, i),
AO2XPpath + "themes/default/prosecutionbar%s.png" % i
))
self.penaltybars.append(pix)
self.setPixmap(self.penaltybars[self.health])
self.pixMinus = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/%sminus.png" % (theme, self.side),
AO2XPpath + "themes/default/%sminus.png" % self.side
))
self.pixPlus = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/%splus.png" % (theme, self.side),
AO2XPpath + "themes/default/%splus.png" % self.side
))
self.btnMinus.setPixmap(self.pixMinus)
self.btnPlus.setPixmap(self.pixPlus)
def moveBar(self, x, y):
self.move(x, y)
self.minusbtn.move(x-(9/2), y+(14/2)-(9/2))
self.plusbtn.move(x+84-(9/2), y+(14/2)-(9/2))
# def setGeometry(self, x, y):
# super(PenaltyBars, self).setGeometry(x, y, self.penaltybars[0].size().width(), self.penaltybars[0].size().height())
def plusClick(self):
self.plusClicked.emit(self.type)
@ -223,8 +271,8 @@ class PenaltyBars(QtGui.QLabel):
self.minusClicked.emit(self.type)
def setHealth(self, health):
self.minusbtn.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/"+self.side+"minus.png"))
self.plusbtn.setPixmap(QtGui.QPixmap(AO2XPpath + "themes/default/"+self.side+"plus.png"))
self.btnMinus.setPixmap(self.pixMinus)
self.btnPlus.setPixmap(self.pixPlus)
self.setPixmap(self.penaltybars[health])
self.health = health

View File

@ -1717,264 +1717,263 @@ class GUI(QtGui.QWidget):
def loadTheme(self, switching=False):
theme = getOption("General", "theme", "default")
try:
stylesheet = ""
self.emotePageGeometry = []
self.gamewindow.setStyleSheet("")
self.chatbox.resetGeometry()
self.btnReloadTheme.setVisible(False)
self.cbBench.setVisible(True)
self.cbSlide.setVisible(True)
# try:
stylesheet = ""
self.emotePageGeometry = []
self.gamewindow.setStyleSheet("")
self.chatbox.resetGeometry()
self.btnReloadTheme.setVisible(False)
self.cbBench.setVisible(True)
self.cbSlide.setVisible(True)
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
stack.setAutoFillBackground(False)
stack.setAttribute(QtCore.Qt.WA_NoSystemBackground, True)
for btn in [self.btnRealization, self.btnShake,
self.btnCustomObjection, self.btnObjection,
self.btnTakeThat, self.btnHoldIt, self.btnGuilty,
self.btnNotGuilty, self.btnWitnessTestimony,
self.btnCrossExamination, self.btnDefenseBar,
self.btnProsecutionBar]:
btn.setPixmaps(theme)
# Design
courtroomDesign = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_design.ini'
if exists(courtroomDesign):
design = {}
with open(courtroomDesign) as f:
for keys in f.read().split("\n"):
if not keys or "=" not in keys or keys[0] == ";": continue
key, value = keys.split("=")
design[key.strip()] = value.replace(" ", "").split(',')
geometry = {
"viewport": self.viewport,
"ic_chatlog": self.gameTabs,
"server_chatlog": self.OOCLog,
"ooc_chat_name": self.OOCNameInput,
"ooc_chat_message": self.OOCInput,
"music_label": self.lblMusicVolume,
"sfx_label": self.lblSoundVolume,
"blip_label": self.lblBlipsVolume,
"music_slider": self.sliMusicVolume,
"sfx_slider": self.sliSoundVolume,
"blip_slider": self.sliBlipsVolume,
"emote_dropdown": self.boxEmotes,
"effects_dropdown": self.boxEffects,
"pos_dropdown": self.boxPositions,
"text_color": self.boxColors,
"change_character": self.btnChangeChar,
"call_mod": self.btnCallMod,
"reload_theme": self.btnReloadTheme,
"ic_chat_name": self.shownameEdit,
"settings": self.btnSettings,
"ao2_chatbox": self.chatbox,
"ao2_ic_chat_message": self.ICChatInput,
"message": self.text,
"showname": self.name,
"music_list": self.serverTabs,
"defense_bar": self.btnDefenseBar,
"prosecution_bar": self.btnProsecutionBar,
}
move = {
"pre": self.cbPreanim,
"flip": self.cbFlip,
"additive": self.cbAdditive,
"slide_enable": self.cbSlide,
"pre_no_interrupt": self.cbNoInterrupt,
"hold_it": self.btnHoldIt,
"objection": self.btnObjection,
"take_that": self.btnTakeThat,
"custom_objection": self.btnCustomObjection,
"emote_left": self.btnPrevEmotePage,
"emote_right": self.btnNextEmotePage,
"realization": self.btnRealization,
"screenshake": self.btnShake,
"not_guilty": self.btnNotGuilty,
"guilty": self.btnGuilty,
"witness_testimony": self.btnWitnessTestimony,
"cross_examination": self.btnCrossExamination,
"defense_plus": self.btnDefenseBar.btnPlus,
"defense_minus": self.btnDefenseBar.btnMinus,
"prosecution_plus": self.btnProsecutionBar.btnPlus,
"prosecution_minus": self.btnProsecutionBar.btnMinus,
}
for e in geometry.keys():
if e in design:
geometry[e].setGeometry(*[int(x) for x in design[e]])
for e in move.keys():
if e in design:
move[e].move(*[int(x) for x in design[e]][0:2])
if "emotes" in design:
self.emotePageGeometry = [int(x) for x in design["emotes"]]
else:
self.emotePageGeometry = [0, 0, 0, 0]
if "emote_button_spacing" in design:
self.emotePageGeometry += [int(x) for x in design["emote_button_spacing"]]
else:
self.emotePageGeometry += [1, 1]
if "found_song_color" in design:
self.foundSongItemColor = QtGui.QColor(*[int(x) for x in design["found_song_color"]])
self.cbSlide.setVisible("slide_enable" in design)
self.cbBench.setVisible("ao2xp_desk" in design)
self.btnReloadTheme.setVisible(True)
# TODO: Load script common to all themes
QtGui.QApplication.setStyle('plastique')
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
stack.setAutoFillBackground(False)
stack.setAttribute(QtCore.Qt.WA_NoSystemBackground, True)
self.btnRealization.setPixmaps(theme)
self.btnShake.setPixmaps(theme)
self.btnObjection.setPixmaps(theme)
self.btnTakeThat.setPixmaps(theme)
self.btnHoldIt.setPixmaps(theme)
# Design
courtroomDesign = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_design.ini'
if exists(courtroomDesign):
design = {}
with open(courtroomDesign) as f:
for keys in f.read().split("\n"):
if not keys or "=" not in keys or keys[0] == ";": continue
else:
QtGui.QApplication.setStyle(self.defaultStyle)
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
stack.setAutoFillBackground(True)
stack.setAttribute(QtCore.Qt.WA_NoSystemBackground, False)
key, value = keys.split("=")
design[key.strip()] = value.replace(" ", "").split(',')
geometry = {
"viewport": self.viewport,
"ic_chatlog": self.gameTabs,
"server_chatlog": self.OOCLog,
"ooc_chat_name": self.OOCNameInput,
"ooc_chat_message": self.OOCInput,
"music_label": self.lblMusicVolume,
"sfx_label": self.lblSoundVolume,
"blip_label": self.lblBlipsVolume,
"music_slider": self.sliMusicVolume,
"sfx_slider": self.sliSoundVolume,
"blip_slider": self.sliBlipsVolume,
"emote_dropdown": self.boxEmotes,
"effects_dropdown": self.boxEffects,
"pos_dropdown": self.boxPositions,
"text_color": self.boxColors,
"change_character": self.btnChangeChar,
"call_mod": self.btnCallMod,
"reload_theme": self.btnReloadTheme,
"ic_chat_name": self.shownameEdit,
"settings": self.btnSettings,
"ao2_chatbox": self.chatbox,
"ao2_ic_chat_message": self.ICChatInput,
"message": self.text,
"showname": self.name,
"music_list": self.serverTabs,
}
move = {
"pre": self.cbPreanim,
"flip": self.cbFlip,
"additive": self.cbAdditive,
"slide_enable": self.cbSlide,
"pre_no_interrupt": self.cbNoInterrupt,
"hold_it": self.btnHoldIt,
"objection": self.btnObjection,
"take_that": self.btnTakeThat,
"custom_objection": self.btnCustomObjection,
"emote_left": self.btnPrevEmotePage,
"emote_right": self.btnNextEmotePage,
"realization": self.btnRealization,
"screenshake": self.btnShake,
"not_guilty": self.btnNotGuilty,
"guilty": self.btnGuilty,
"witness_testimony": self.btnWitnessTestimony,
"cross_examination": self.btnCrossExamination,
}
bars = {
"defense_bar": self.btnDefenseBar,
"prosecution_bar": self.btnProsecutionBar
}
for e in geometry.keys():
if e in design:
geometry[e].setGeometry(*[int(x) for x in design[e]])
with open(AO2XPpath + "ao2xp_themes/" + theme + "/theme.py") as t:
exec t
if switching:
# This is to reset the colors on the music list. Not necessary on startup
self.onMusicSearch("")
for e in move.keys():
if e in design:
move[e].move(*[int(x) for x in design[e]][0:2])
for e in bars.keys():
if e in design:
bars[e].moveBar(*[int(x) for x in design[e]][0:2])
if "emotes" in design:
self.emotePageGeometry = [int(x) for x in design["emotes"]]
else:
self.emotePageGeometry = [0, 0, 0, 0]
if "emote_button_spacing" in design:
self.emotePageGeometry += [int(x) for x in design["emote_button_spacing"]]
else:
self.emotePageGeometry += [1, 1]
if "found_song_color" in design:
self.foundSongItemColor = QtGui.QColor(*[int(x) for x in design["found_song_color"]])
self.cbSlide.setVisible("slide_enable" in design)
self.cbBench.setVisible("ao2xp_desk" in design)
self.btnReloadTheme.setVisible(True)
# TODO: Load script common to all themes
QtGui.QApplication.setStyle('plastique')
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
stack.setAutoFillBackground(False)
stack.setAttribute(QtCore.Qt.WA_NoSystemBackground, True)
else:
QtGui.QApplication.setStyle(self.defaultStyle)
for w in [self.gameTabs, self.serverTabs]:
stack = w.findChild(QtGui.QStackedWidget)
if stack:
stack.setAutoFillBackground(True)
stack.setAttribute(QtCore.Qt.WA_NoSystemBackground, False)
with open(AO2XPpath + "ao2xp_themes/" + theme + "/theme.py") as t:
exec t
if switching:
# This is to reset the colors on the music list. Not necessary on startup
self.onMusicSearch("")
self.viewportScale = self.viewport.height() / float(192)
self.viewportScale = self.viewport.height() / float(192)
self.court.resize(self.viewport.size())
self.bench.resize(self.viewport.size())
self.effectView.resize()
self.objectionView.resize()
self.zoom.resize()
self.wtceView.resize()
self.char.resize()
self.sideChar.resize()
self.slideWitness.resize()
self.slideSpeaker.resize()
self.court.resize(self.viewport.size())
self.bench.resize(self.viewport.size())
self.effectView.resize()
self.objectionView.resize()
self.zoom.resize()
self.wtceView.resize()
self.char.resize()
self.sideChar.resize()
self.slideWitness.resize()
self.slideSpeaker.resize()
self.ao2text.setGeometry(self.text.geometry())
self.ao2text.setStyleSheet(self.text.styleSheet())
self.sliDemoSeekbar.setGeometry(self.ICChatInput.geometry())
# Theme chatbox
chatboxPixmap = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/chat.png" % theme,
AO2XPpath + 'themes/default/chatmed.png'
))
if not self.chatbox.geometrySet:
self.chatboxWidth = self.viewport.width()
self.chatboxHeight = chatboxPixmap.size().height() * self.viewportScale
self.chatbox.resize(self.chatboxWidth, self.chatboxHeight)
self.chatbox.move(0, self.viewport.height() - self.chatboxHeight)
else:
self.chatboxWidth = self.chatbox.width()
self.chatboxHeight = self.chatbox.height()
self.chatbox.setPixmap(chatboxPixmap.scaled(self.chatboxWidth, self.chatboxHeight, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
# Theme background
courtroomBackground = AO2XPpath + "ao2xp_themes/" + theme + '/courtroombackground.png'
if exists(courtroomBackground):
stylesheet += "QTabWidget {background-color: transparent;} QMainWindow { background-image: url(./" + courtroomBackground + ");}"
courtroomBackground = QtGui.QPixmap(courtroomBackground)
self.width = courtroomBackground.size().width()
self.height = courtroomBackground.size().height()
# Stylesheet
courtroomStylesheets = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_stylesheets.css'
if exists(courtroomStylesheets):
with open(courtroomStylesheets) as f:
stylesheet += f.read()
self.ao2text.setGeometry(self.text.geometry())
self.ao2text.setStyleSheet(self.text.styleSheet())
self.sliDemoSeekbar.setGeometry(self.ICChatInput.geometry())
# Theme chatbox
chatboxPixmap = QtGui.QPixmap(testPath(
AO2XPpath + "ao2xp_themes/%s/chat.png" % theme,
AO2XPpath + 'themes/default/chatmed.png'
))
if not self.chatbox.geometrySet:
self.chatboxWidth = self.viewport.width()
self.chatboxHeight = chatboxPixmap.size().height() * self.viewportScale
self.chatbox.resize(self.chatboxWidth, self.chatboxHeight)
self.chatbox.move(0, self.viewport.height() - self.chatboxHeight)
else:
self.chatboxWidth = self.chatbox.width()
self.chatboxHeight = self.chatbox.height()
self.chatbox.setPixmap(chatboxPixmap.scaled(self.chatboxWidth, self.chatboxHeight, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
# Theme background
courtroomBackground = AO2XPpath + "ao2xp_themes/" + theme + '/courtroombackground.png'
if exists(courtroomBackground):
stylesheet += "QTabWidget {background-color: transparent;} QMainWindow { background-image: url(./" + courtroomBackground + ");}"
courtroomBackground = QtGui.QPixmap(courtroomBackground)
self.width = courtroomBackground.size().width()
self.height = courtroomBackground.size().height()
# Stylesheet
courtroomStylesheets = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_stylesheets.css'
if exists(courtroomStylesheets):
with open(courtroomStylesheets) as f:
stylesheet += f.read()
self.gamewindow.setStyleSheet(stylesheet)
self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale)
# Theme fonts
courtroomFonts = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_fonts.ini'
if exists(courtroomFonts):
fonts = {}
with open(courtroomDesign) as f:
for keys in f.read().split("\n"):
if not keys or "=" not in keys or keys[0] == ";": continue
self.gamewindow.setStyleSheet(stylesheet)
self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale)
# Theme fonts
courtroomFonts = AO2XPpath + "ao2xp_themes/" + theme + '/courtroom_fonts.ini'
if exists(courtroomFonts):
fonts = {}
with open(courtroomDesign) as f:
for keys in f.read().split("\n"):
if not keys or "=" not in keys or keys[0] == ";": continue
key, value = keys.split("=")
fonts[key.strip()] = value.replace(" ", "").split(',')
key, value = keys.split("=")
fonts[key.strip()] = value.replace(" ", "").split(',')
fontDb = None
nameFont = None
textFont = None
fontDb = QtGui.QFontDatabase()
fontDb.addApplicationFont(AO2XPpath + 'font/Igiari.ttf')
fontDb.addApplicationFont(AO2XPpath + 'font/Ace_Name_Regular.ttf')
nameFont = QtGui.QFont("Ace Name")
textFont = QtGui.QFont("Igiari")
nameFont.setPointSize(self.nameFontPointSize)
textFont.setPointSize(self.textFontPointSize)
self.text.setFont(textFont)
self.ao2text.setFont(textFont)
self.name.setFont(nameFont)
for label in self.onscreenTimerLabels:
label.resize(self.viewport.width(), label.sizeHint().height())
label.setFont(nameFont)
fontDb = None
nameFont = None
textFont = None
fontDb = QtGui.QFontDatabase()
fontDb.addApplicationFont(AO2XPpath + 'font/Igiari.ttf')
fontDb.addApplicationFont(AO2XPpath + 'font/Ace_Name_Regular.ttf')
nameFont = QtGui.QFont("Ace Name")
textFont = QtGui.QFont("Igiari")
nameFont.setPointSize(self.nameFontPointSize)
textFont.setPointSize(self.textFontPointSize)
self.text.setFont(textFont)
self.ao2text.setFont(textFont)
self.name.setFont(nameFont)
# Load emote buttons
# TODO: Buggy on theme switch / reload
xMod_count = yMod_count = 0
left, top, width, height, hSpacing, vSpacing = self.emotePageGeometry
columns = (width - 40) / (hSpacing + 40) + 1
rows = (height - 40) / (vSpacing + 40) + 1
self.maxEmotesOnPage = columns * rows
if len(self.emoteButtons) > 0:
for button in self.emoteButtons:
button.setParent(None)
button.deleteLater()
button = None
self.emoteButtons = []
for i in range(self.maxEmotesOnPage):
xPos = (40 + hSpacing) * xMod_count
yPos = (40 + vSpacing) * yMod_count
xMod_count += 1
if xMod_count == columns:
xMod_count = 0
yMod_count += 1
for label in self.onscreenTimerLabels:
label.resize(self.viewport.width(), label.sizeHint().height())
label.setFont(nameFont)
# Load emote buttons
# TODO: Buggy on theme switch / reload
xMod_count = yMod_count = 0
left, top, width, height, hSpacing, vSpacing = self.emotePageGeometry
columns = (width - 40) / (hSpacing + 40) + 1
rows = (height - 40) / (vSpacing + 40) + 1
self.maxEmotesOnPage = columns * rows
button = buttons.EmoteButton(self, i)
button.move(left + xPos, top + yPos)
button.clicked.connect(self.ICChatFocus)
button.show()
button.lower()
self.emoteButtons.append(button)
if len(self.emoteButtons) > 0:
for button in self.emoteButtons:
button.setParent(None)
button.deleteLater()
button = None
self.btnPrevEmotePage.raise_()
self.btnNextEmotePage.raise_()
self.emoteButtons = []
for i in range(self.maxEmotesOnPage):
xPos = (40 + hSpacing) * xMod_count
yPos = (40 + vSpacing) * yMod_count
xMod_count += 1
if xMod_count == columns:
xMod_count = 0
yMod_count += 1
button = buttons.EmoteButton(self, i)
button.move(left + xPos, top + yPos)
button.clicked.connect(self.ICChatFocus)
button.show()
button.lower()
self.emoteButtons.append(button)
self.btnPrevEmotePage.raise_()
self.btnNextEmotePage.raise_()
if switching:
self.setBackground()
self.setScene()
self.boxEmotes.setCurrentIndex(0)
self.setEmotePage()
self.gamewindow.setFixedSize(self.width, self.height)
self.gamewindow.center()
except Exception as e:
QtGui.QMessageBox.critical(None, "Unable to load theme", "There was a problem loading the current theme \"%s\":\n\n%s." % (theme, e))
os._exit(-2)
if switching:
self.setBackground()
self.setScene()
self.boxEmotes.setCurrentIndex(0)
self.setEmotePage()
self.gamewindow.setFixedSize(self.width, self.height)
self.gamewindow.center()
# except Exception as e:
# QtGui.QMessageBox.critical(None, "Unable to load theme", "There was a problem loading the current theme \"%s\":\n\n%s." % (theme, e))
# os._exit(-2)
def resetPairOffsets(self):
self.sliPairOffset.setValue(0)
@ -2072,19 +2071,19 @@ class GUI(QtGui.QWidget):
def setJudgeButtons(self):
if self.charSide == 'jud':
self.btnDefenseBar.minusbtn.show()
self.btnDefenseBar.plusbtn.show()
self.btnProsecutionBar.minusbtn.show()
self.btnProsecutionBar.plusbtn.show()
self.btnDefenseBar.btnMinus.show()
self.btnDefenseBar.btnPlus.show()
self.btnProsecutionBar.btnMinus.show()
self.btnProsecutionBar.btnPlus.show()
self.btnWitnessTestimony.show()
self.btnCrossExamination.show()
self.btnNotGuilty.show()
self.btnGuilty.show()
else:
self.btnDefenseBar.minusbtn.hide()
self.btnDefenseBar.plusbtn.hide()
self.btnProsecutionBar.minusbtn.hide()
self.btnProsecutionBar.plusbtn.hide()
self.btnDefenseBar.btnMinus.hide()
self.btnDefenseBar.btnPlus.hide()
self.btnProsecutionBar.btnMinus.hide()
self.btnProsecutionBar.btnPlus.hide()
self.btnWitnessTestimony.hide()
self.btnCrossExamination.hide()
self.btnNotGuilty.hide()
@ -4520,8 +4519,8 @@ class GUI(QtGui.QWidget):
self.cbFlip, self.cbPreanim, self.cbNoInterrupt,
self.boxEffects, self.cbSlide, self.cbBench,
self.cbAdditive, self.areaItems, self.shownameEdit,
self.boxColors, self.btnDefenseBar.minusbtn, self.btnProsecutionBar.minusbtn,
self.btnDefenseBar.plusbtn, self.btnProsecutionBar.plusbtn, self.btnWitnessTestimony,
self.boxColors, self.btnDefenseBar.btnMinus, self.btnProsecutionBar.btnMinus,
self.btnDefenseBar.btnPlus, self.btnProsecutionBar.btnPlus, self.btnWitnessTestimony,
self.btnCrossExamination, self.btnNotGuilty, self.btnGuilty,
self.btnRealization, self.btnShake,
]: