implement skinning effect and shout buttons and ao2xp background
This commit is contained in:
parent
b3fd870981
commit
9fd8abcc30
@ -1,28 +1,8 @@
|
||||
with open(AO2XPpath + "ao2xp_themes/default/theme.py") as t:
|
||||
exec t
|
||||
|
||||
self.gamewindow.setObjectName("main")
|
||||
self.lblMusicVolume.setObjectName("musiclabel")
|
||||
self.lblSoundVolume.setObjectName("sfxlabel")
|
||||
self.lblBlipsVolume.setObjectName("blipslabel")
|
||||
self.lblNotMuted.setObjectName("lblNotMuted")
|
||||
self.lblMuted.setObjectName("lblMuted")
|
||||
self.lblIniSwapInfo.setObjectName("lblIniSwapInfo")
|
||||
self.lblPairOffset.setObjectName("lblPairOffset")
|
||||
self.lblPairOffsetY.setObjectName("lblPairOffsetY")
|
||||
self.lblPairOrder.setObjectName("lblPairOrder")
|
||||
self.tabLog.setObjectName("tabLog")
|
||||
self.tabEvidence.setObjectName("tabEvidence")
|
||||
self.tabMute.setObjectName("tabMute")
|
||||
self.tabIniSwap.setObjectName("tabIniSwap")
|
||||
self.tabPair.setObjectName("tabPair")
|
||||
self.tabMisc.setObjectName("tabMisc")
|
||||
self.tabQueue.setObjectName("tabQueue")
|
||||
self.tabMusic.setObjectName("tabMusic")
|
||||
self.tabPlayers.setObjectName("gameTab_player")
|
||||
|
||||
self.gamewindow.setStyleSheet("""
|
||||
QWidget#main, QSlider, QCheckBox, QLabel#musiclabel, QLabel#sfxlabel, QLabel#blipslabel, QLabel#lblNotMuted, QLabel#lblMuted, QLabel#lblIniSwapInfo, QLabel#lblPairOffset, QLabel#lblPairOffsetY, QLabel#lblPairOrder, QWidget#tabLog, QWidget#tabEvidence, QWidget#tabMute, QWidget#tabIniSwap, QWidget#tabPair, QWidget#tabMisc, QWidget#tabQueue, QWidget#tabMusic, QWidget#gameTab_player
|
||||
self.style = """
|
||||
QWidget#mainWindow, QSlider, QCheckBox, QLabel#lblMusicVolume, QLabel#lblSoundVolume, QLabel#lblBlipsVolume, QLabel#lblNotMuted, QLabel#lblMuted, QLabel#lblIniSwapInfo, QLabel#lblPairOffset, QLabel#lblPairOffsetY, QLabel#lblPairOrder, QWidget#tabLog, QWidget#tabEvidence, QWidget#tabMute, QWidget#tabIniSwap, QWidget#tabPair, QWidget#tabMisc, QWidget#tabQueue, QWidget#tabMusic, QWidget#tabPlayers
|
||||
{
|
||||
color: #eeeeee;
|
||||
background: #111111;
|
||||
@ -33,6 +13,5 @@ self.gamewindow.setStyleSheet("""
|
||||
background: #222222;
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
self.foundSongItemColor = "#444444"
|
||||
@ -1,16 +1,12 @@
|
||||
self.gamewindow.setStyleSheet("")
|
||||
|
||||
# Because it depends on the positions and sizes of other widgets, the main
|
||||
# window size is defined at the end of the file
|
||||
|
||||
# IC viewport
|
||||
_scale = 2
|
||||
self.viewport.move(0, 0)
|
||||
self.viewport.resize(256 * _scale, 192 * _scale)
|
||||
self.viewport.setGeometry(0, 0, 256 * _scale, 192 * _scale)
|
||||
|
||||
# Textbox
|
||||
self.name.move(8 * _scale, -15 + 7 * _scale)
|
||||
self.name.resize(248, 32)
|
||||
self.name.setGeometry(8 * _scale, -15 + 7 * _scale, 248, 32)
|
||||
self.name.setStyleSheet('color: white')
|
||||
self.text.setGeometry(8 * _scale, 16 * _scale, self.viewport.width() - 32, 56 * _scale)
|
||||
self.text.setStyleSheet("background-color: rgba(0, 0, 0, 0); color: white;")
|
||||
@ -41,8 +37,7 @@ self.btnChangeChar.setGeometry(10, viewportBottom + 7, self.btnCallMod.size().wi
|
||||
self.shownameEdit.move(self.boxPositions.x() + self.boxPositions.width() + 4, self.boxPositions.y())
|
||||
self.shownameEdit.resize(viewportRight - self.shownameEdit.x(), 20)
|
||||
|
||||
self.gameTabs.move(8, viewportBottom + 61)
|
||||
self.gameTabs.resize(viewportRight - 102, 256)
|
||||
self.gameTabs.setGeometry(8, viewportBottom + 61, viewportRight - 102, 256)
|
||||
|
||||
leftSideHeight = self.gameTabs.y() + self.gameTabs.height() + 6
|
||||
|
||||
@ -154,24 +149,24 @@ self.btnObjection.move(self.btnHoldIt.x() + 70, self.btnHoldIt.y())
|
||||
self.btnTakeThat.move(self.btnObjection.x() + 70, self.btnHoldIt.y())
|
||||
self.btnCustomObjection.move(self.btnTakeThat.x() + 70, self.btnHoldIt.y())
|
||||
|
||||
self.emotePageGeometry = (viewportRight + 14, oocBottom + 116, 288, 98)
|
||||
self.emotePageGeometry = (viewportRight + 14, oocBottom + 116, 288, 98, 1, 1)
|
||||
self.btnPrevEmotePage.move(viewportRight + 8, oocBottom + 147)
|
||||
self.btnNextEmotePage.move(viewportRight + 286, self.btnPrevEmotePage.y())
|
||||
|
||||
# Server tabs
|
||||
self.serverTabs.setGeometry(viewportRight + 14, oocBottom + 200, 288, 258)
|
||||
|
||||
self.musicItems.setGeometry(8, 8, 268, 184)
|
||||
self.musicItems.setGeometry(8, 8, self.serverTabs.width() - 20, 184)
|
||||
self.btnMusicOptions.setGeometry(self.musicItems.x() + self.musicItems.width() - self.btnMusicOptions.sizeHint().width(), self.musicItems.size().height() + 16, self.btnMusicOptions.sizeHint().width(), self.musicSearch.sizeHint().height())
|
||||
self.musicSearch.setGeometry(8, self.btnMusicOptions.y(), self.musicItems.width() - self.btnMusicOptions.width() - 4, self.musicSearch.sizeHint().height())
|
||||
self.foundSongItemColor = "#80ff80"
|
||||
|
||||
self.backgroundItems.setGeometry(8, 8, 268, 184)
|
||||
self.backgroundSearch.setGeometry(8, self.musicItems.size().height() + 16, 268 - self.btnBackgroundsRefresh.sizeHint().width() - 20, self.backgroundSearch.sizeHint().height())
|
||||
self.backgroundItems.setGeometry(8, 8, self.serverTabs.width() - 20, 184)
|
||||
self.backgroundSearch.setGeometry(8, self.musicItems.size().height() + 16, self.serverTabs.width() - 20 - self.btnBackgroundsRefresh.sizeHint().width() - 20, self.backgroundSearch.sizeHint().height())
|
||||
self.btnBackgroundsRefresh.resize(self.btnBackgroundsRefresh.sizeHint().width(), self.backgroundSearch.height())
|
||||
self.btnBackgroundsRefresh.move(self.backgroundItems.width() - self.btnBackgroundsRefresh.width(), self.backgroundItems.size().height() + 16)
|
||||
|
||||
self.playerItems.setGeometry(8, 8, 268, 180)
|
||||
self.playerItems.setGeometry(8, 8, self.serverTabs.width() - 20, 180)
|
||||
self.btnPlayerPair.resize(self.btnPlayerPair.sizeHint())
|
||||
self.btnPlayerKick.resize(self.btnPlayerKick.sizeHint())
|
||||
self.btnPlayerBan.resize(self.btnPlayerBan.sizeHint())
|
||||
|
||||
59
buttons.py
59
buttons.py
@ -2,17 +2,35 @@ from PyQt4 import QtCore, QtGui
|
||||
import os
|
||||
from constants import *
|
||||
|
||||
def testPath(*args):
|
||||
for path in args:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
return False
|
||||
|
||||
class AOToggleButton(QtGui.QLabel):
|
||||
pressed = False
|
||||
clicked = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, parent, btnname):
|
||||
super(AOToggleButton, self).__init__(parent)
|
||||
self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/%s.png" % btnname)
|
||||
self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/%s_pressed.png" % btnname)
|
||||
self.setPixmap(self.notpressed_pix)
|
||||
self.notpressed_pix = None
|
||||
self.pressed_pix = None
|
||||
self.name = btnname
|
||||
self.show()
|
||||
|
||||
def setPixmaps(self, theme):
|
||||
print self.name
|
||||
self.pressed_pix = QtGui.QPixmap(testPath(
|
||||
AO2XPpath + "ao2xp_themes/%s/%s_pressed.png" % (theme, self.name),
|
||||
AO2XPpath + "themes/default/%s_pressed.png" % self.name,
|
||||
))
|
||||
self.notpressed_pix = QtGui.QPixmap(testPath(
|
||||
AO2XPpath + "ao2xp_themes/%s/%s.png" % (theme, self.name),
|
||||
AO2XPpath + "themes/default/%s.png" % self.name,
|
||||
))
|
||||
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())
|
||||
|
||||
@ -86,19 +104,32 @@ class Objections(QtGui.QLabel):
|
||||
super(Objections, self).__init__(parent)
|
||||
self.parent = parent
|
||||
self.type = type
|
||||
self.resize(76, 28)
|
||||
if type == 1:
|
||||
self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/holdit.png")
|
||||
self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/holdit_selected.png")
|
||||
elif type == 2:
|
||||
self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/objection.png")
|
||||
self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/objection_selected.png")
|
||||
elif type == 3:
|
||||
self.notpressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/takethat.png")
|
||||
self.pressed_pix = QtGui.QPixmap(AO2XPpath + "themes/default/takethat_selected.png")
|
||||
self.setPixmap(self.notpressed_pix)
|
||||
self.notpressed_pix = None
|
||||
self.pressed_pix = None
|
||||
self.show()
|
||||
|
||||
def setPixmaps(self, theme):
|
||||
name = ""
|
||||
if self.type == 1:
|
||||
name = "holdit"
|
||||
elif self.type == 2:
|
||||
name = "objection"
|
||||
elif self.type == 3:
|
||||
name = "takethat"
|
||||
|
||||
self.pressed_pix = QtGui.QPixmap(testPath(
|
||||
AO2XPpath + "ao2xp_themes/%s/%s_selected.png" % (theme, name),
|
||||
AO2XPpath + "themes/default/%s_selected.png" % name,
|
||||
))
|
||||
self.notpressed_pix = QtGui.QPixmap(testPath(
|
||||
AO2XPpath + "ao2xp_themes/%s/%s.png" % (theme, name),
|
||||
AO2XPpath + "themes/default/%s.png" % name,
|
||||
))
|
||||
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
|
||||
if on:
|
||||
|
||||
102
gameview.py
102
gameview.py
@ -1012,6 +1012,21 @@ class TCPThread(QtCore.QThread):
|
||||
def stop(self):
|
||||
self.stop_now = True
|
||||
|
||||
class Chatbox(QtGui.QLabel):
|
||||
def __init__(self, parent):
|
||||
QtGui.QLabel.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.geometrySet = False
|
||||
|
||||
def setGeometry(self, x, y, w, h):
|
||||
if self.geometrySet:
|
||||
return
|
||||
self.geometrySet = True
|
||||
super(Chatbox, self).setGeometry(x - self.parent.x(), y - self.parent.y(), w, h)
|
||||
|
||||
def resetGeometry(self):
|
||||
self.geometrySet = False
|
||||
|
||||
class GUI(QtGui.QWidget):
|
||||
gamewindow = None
|
||||
sound = None
|
||||
@ -1116,7 +1131,7 @@ class GUI(QtGui.QWidget):
|
||||
self.effectView = AOMovie(self.viewport)
|
||||
self.effectView.setScaledContents(True)
|
||||
|
||||
self.chatbox = QtGui.QLabel(self.viewport)
|
||||
self.chatbox = Chatbox(self.viewport)
|
||||
self.chatbox.setScaledContents(True)
|
||||
|
||||
self.text = QtGui.QTextEdit(self.chatbox)
|
||||
@ -1541,10 +1556,13 @@ class GUI(QtGui.QWidget):
|
||||
self.btnCustomObjection.clicked.connect(self.ICChatFocus)
|
||||
self.btnTakeThat = buttons.Objections(self, 3)
|
||||
self.btnTakeThat.clicked.connect(self.ICChatFocus)
|
||||
self.btnTakeThat.setToolTip("Take that!")
|
||||
self.btnObjection = buttons.Objections(self, 2)
|
||||
self.btnObjection.clicked.connect(self.ICChatFocus)
|
||||
self.btnObjection.setToolTip("Objection!")
|
||||
self.btnHoldIt = buttons.Objections(self, 1)
|
||||
self.btnHoldIt.clicked.connect(self.ICChatFocus)
|
||||
self.btnHoldIt.setToolTip("Hold it!")
|
||||
self.sndObjection = 0
|
||||
|
||||
# Judge buttons
|
||||
@ -1568,7 +1586,11 @@ class GUI(QtGui.QWidget):
|
||||
self.btnGuilty.show()
|
||||
self.presenting = -1
|
||||
|
||||
# Volume sliders, etc.
|
||||
# Volume sliders and their labels
|
||||
self.lblMusicVolume = QtGui.QLabel("Music", self)
|
||||
self.lblSoundVolume = QtGui.QLabel("SFX", self)
|
||||
self.lblBlipsVolume = QtGui.QLabel("Blips", self)
|
||||
self.lblPing = QtGui.QLabel(self)
|
||||
self.sliMusicVolume = QtGui.QSlider(QtCore.Qt.Horizontal, self)
|
||||
self.sliSoundVolume = QtGui.QSlider(QtCore.Qt.Horizontal, self)
|
||||
self.sliBlipsVolume = QtGui.QSlider(QtCore.Qt.Horizontal, self)
|
||||
@ -1578,10 +1600,6 @@ class GUI(QtGui.QWidget):
|
||||
self.sliMusicVolume.valueChanged.connect(self.changeMusicVolume)
|
||||
self.sliSoundVolume.valueChanged.connect(self.changeSoundVolume)
|
||||
self.sliBlipsVolume.valueChanged.connect(self.changeBlipVolume)
|
||||
self.lblMusicVolume = QtGui.QLabel("Music", self)
|
||||
self.lblSoundVolume = QtGui.QLabel("SFX", self)
|
||||
self.lblBlipsVolume = QtGui.QLabel("Blips", self)
|
||||
self.lblPing = QtGui.QLabel(self)
|
||||
|
||||
# Demo playback seekbar
|
||||
self.sliDemoSeekbar = QtGui.QSlider(QtCore.Qt.Horizontal, self)
|
||||
@ -1589,6 +1607,27 @@ class GUI(QtGui.QWidget):
|
||||
self.sliDemoSeekbar.setVisible(False)
|
||||
self.sliDemoSeekbar.setMinimum(0)
|
||||
|
||||
self.style = ""
|
||||
self.gamewindow.setObjectName("mainWindow")
|
||||
self.lblMusicVolume.setObjectName("lblMusicVolume")
|
||||
self.lblSoundVolume.setObjectName("lblSoundVolume")
|
||||
self.lblBlipsVolume.setObjectName("lblBlipsVolume")
|
||||
self.lblNotMuted.setObjectName("lblNotMuted")
|
||||
self.lblMuted.setObjectName("lblMuted")
|
||||
self.lblIniSwapInfo.setObjectName("lblIniSwapInfo")
|
||||
self.lblPairOffset.setObjectName("lblPairOffset")
|
||||
self.lblPairOffsetY.setObjectName("lblPairOffsetY")
|
||||
self.lblPairOrder.setObjectName("lblPairOrder")
|
||||
self.tabLog.setObjectName("tabLog")
|
||||
self.tabEvidence.setObjectName("tabEvidence")
|
||||
self.tabMute.setObjectName("tabMute")
|
||||
self.tabIniSwap.setObjectName("tabIniSwap")
|
||||
self.tabPair.setObjectName("tabPair")
|
||||
self.tabMisc.setObjectName("tabMisc")
|
||||
self.tabQueue.setObjectName("tabQueue")
|
||||
self.tabMusic.setObjectName("tabMusic")
|
||||
self.tabPlayers.setObjectName("tabPlayers")
|
||||
|
||||
# GUI end
|
||||
|
||||
self.name.show()
|
||||
@ -1671,7 +1710,17 @@ class GUI(QtGui.QWidget):
|
||||
def loadTheme(self, switching=False):
|
||||
theme = getOption("General", "theme", "default")
|
||||
try:
|
||||
with open(AO2XPpath + "ao2xp_themes/"+theme+"/theme.py") as t:
|
||||
self.style = ""
|
||||
self.gamewindow.setStyleSheet(self.style)
|
||||
self.chatbox.resetGeometry()
|
||||
|
||||
self.btnRealization.setPixmaps(theme)
|
||||
self.btnShake.setPixmaps(theme)
|
||||
self.btnObjection.setPixmaps(theme)
|
||||
self.btnTakeThat.setPixmaps(theme)
|
||||
self.btnHoldIt.setPixmaps(theme)
|
||||
|
||||
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
|
||||
@ -1693,19 +1742,37 @@ class GUI(QtGui.QWidget):
|
||||
self.ao2text.setGeometry(self.text.geometry())
|
||||
self.ao2text.setStyleSheet(self.text.styleSheet())
|
||||
|
||||
chatboxPixmap = QtGui.QPixmap(AO2XPpath + 'themes/default/chatmed.png')
|
||||
chatboxWidth = self.viewport.width() #chatboxPixmap.size().width() * self.viewportScale
|
||||
# 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.setPixmap(chatboxPixmap.scaled(chatboxWidth, self.chatboxHeight, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
self.chatbox.resize(chatboxWidth, self.chatboxHeight)
|
||||
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):
|
||||
self.style += "QWidget#mainWindow { background-image: url(./" + courtroomBackground + ");}"
|
||||
courtroomBackground = QtGui.QPixmap(courtroomBackground)
|
||||
self.width = courtroomBackground.size().width()
|
||||
self.height = courtroomBackground.size().height()
|
||||
|
||||
self.gamewindow.setStyleSheet(self.style)
|
||||
|
||||
self.presentedEvidence.setGeometry(self.viewport.x() + 16, self.viewport.y() + 16, 70 * self.viewportScale, 70 * self.viewportScale)
|
||||
|
||||
# Theme fonts
|
||||
fontDb = None
|
||||
nameFont = None
|
||||
textFont = None
|
||||
|
||||
fontDb = QtGui.QFontDatabase()
|
||||
fontDb.addApplicationFont(AO2XPpath + 'font/Igiari.ttf')
|
||||
fontDb.addApplicationFont(AO2XPpath + 'font/Ace_Name_Regular.ttf')
|
||||
@ -1721,11 +1788,10 @@ class GUI(QtGui.QWidget):
|
||||
label.resize(self.viewport.width(), label.sizeHint().height())
|
||||
label.setFont(nameFont)
|
||||
|
||||
spacing = 1
|
||||
xMod_count = yMod_count = 0
|
||||
left, top, width, height = self.emotePageGeometry
|
||||
columns = (width - 40) / (spacing + 40) + 1
|
||||
rows = (height - 40) / (spacing + 40) + 1
|
||||
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:
|
||||
@ -1737,8 +1803,8 @@ class GUI(QtGui.QWidget):
|
||||
self.emoteButtons = []
|
||||
|
||||
for i in range(self.maxEmotesOnPage):
|
||||
xPos = (40 + spacing) * xMod_count
|
||||
yPos = (40 + spacing) * yMod_count
|
||||
xPos = (40 + hSpacing) * xMod_count
|
||||
yPos = (40 + vSpacing) * yMod_count
|
||||
xMod_count += 1
|
||||
if xMod_count == columns:
|
||||
xMod_count = 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user