transparent backgrounds now?

This commit is contained in:
cidoku 2025-10-11 18:44:51 -03:00
parent fbaeccdb50
commit 5abf0f2ba0

View File

@ -1712,6 +1712,7 @@ class GUI(QtGui.QWidget):
self.viewportScale = 1
self.nameFontPointSize = 12
self.textFontPointSize = 24
self.defaultStyle = QtGui.QApplication.style().objectName()
self.loadTheme()
def loadTheme(self, switching=False):
@ -1724,6 +1725,11 @@ class GUI(QtGui.QWidget):
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)
self.btnRealization.setPixmaps(theme)
self.btnShake.setPixmaps(theme)
@ -1742,94 +1748,103 @@ class GUI(QtGui.QWidget):
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,
"pre": self.cbPreanim,
"flip": self.cbFlip,
"additive": self.cbAdditive,
"slide_enable": self.cbSlide,
"pre_no_interrupt": self.cbNoInterrupt,
"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,
}
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]])
move = {
"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,
}
for e in move.keys():
if e in design:
move[e].move(*[int(x) for x in design[e]][0:2])
bars = {
"defense_bar": self.btnDefenseBar,
"prosecution_bar": self.btnProsecutionBar
}
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]
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])
for e in bars.keys():
if e in design:
bars[e].moveBar(*[int(x) for x in design[e]][0:2])
if "emote_button_spacing" in design:
self.emotePageGeometry += [int(x) for x in design["emote_button_spacing"]]
else:
self.emotePageGeometry += [1, 1]
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)
if "found_song_color" in design:
self.foundSongItemColor = QtGui.QColor(*[int(x) for x in design["found_song_color"]])
# TODO: Load script common to all themes
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:
# Try to load ao2xp theme
pass
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
@ -1872,7 +1887,7 @@ class GUI(QtGui.QWidget):
# Theme background
courtroomBackground = AO2XPpath + "ao2xp_themes/" + theme + '/courtroombackground.png'
if exists(courtroomBackground):
stylesheet += "QMainWindow { background-image: url(./" + 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()
@ -1882,6 +1897,7 @@ class GUI(QtGui.QWidget):
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)