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)
@ -1758,11 +1764,6 @@ class GUI(QtGui.QWidget):
"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,
@ -1776,6 +1777,11 @@ class GUI(QtGui.QWidget):
}
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,
@ -1822,14 +1828,23 @@ class GUI(QtGui.QWidget):
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
else:
# Try to load ao2xp theme
pass
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
@ -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)