rainbow color reborn
This commit is contained in:
parent
59f5ebdc1b
commit
246f4545a8
66
gameview.py
66
gameview.py
@ -62,6 +62,7 @@ C_YELLOW = 5
|
|||||||
C_PINK = 6
|
C_PINK = 6
|
||||||
C_CYAN = 7
|
C_CYAN = 7
|
||||||
C_GRAY = 8
|
C_GRAY = 8
|
||||||
|
C_RAINBOW = 9 # proprietary
|
||||||
|
|
||||||
DOWNLOAD_BLACKLIST = []
|
DOWNLOAD_BLACKLIST = []
|
||||||
|
|
||||||
@ -758,9 +759,13 @@ class gui(QtGui.QWidget):
|
|||||||
self.chatbox.setPixmap(chatbox)
|
self.chatbox.setPixmap(chatbox)
|
||||||
self.chatbox.move(0, VIEWPORT_H - self.chatboxheight)
|
self.chatbox.move(0, VIEWPORT_H - self.chatboxheight)
|
||||||
|
|
||||||
self.text = QtGui.QLabel(self.chatbox)
|
self.text = QtGui.QTextEdit(self.chatbox)
|
||||||
self.text.setWordWrap(True)
|
self.text.setFrameStyle(QtGui.QFrame.NoFrame)
|
||||||
self.text.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
|
self.text.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.text.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
|
self.text.setReadOnly(True)
|
||||||
|
self.text.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
||||||
|
self.text.setFont(ao2text_font)
|
||||||
|
|
||||||
self.ao2text = QtGui.QTextEdit(self.chatbox)
|
self.ao2text = QtGui.QTextEdit(self.chatbox)
|
||||||
self.ao2text.setFrameStyle(QtGui.QFrame.NoFrame)
|
self.ao2text.setFrameStyle(QtGui.QFrame.NoFrame)
|
||||||
@ -1995,7 +2000,6 @@ class gui(QtGui.QWidget):
|
|||||||
fx = self.effectdropdown.currentText() if self.effectdropdown.currentIndex() > 0 else ""
|
fx = self.effectdropdown.currentText() if self.effectdropdown.currentIndex() > 0 else ""
|
||||||
fx_sound = ini.get_effect_sound(fx, self.charname)
|
fx_sound = ini.get_effect_sound(fx, self.charname)
|
||||||
p_effect = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "effects")
|
p_effect = ini.read_ini(AOpath+"characters/"+self.charname+"/char.ini", "options", "effects")
|
||||||
# I have to encode it because otherwise accented characters make the client crash
|
|
||||||
msg += str(fx + "|" + p_effect + "|" + fx_sound + "#").encode('utf-8')
|
msg += str(fx + "|" + p_effect + "|" + fx_sound + "#").encode('utf-8')
|
||||||
self.effectdropdown.setCurrentIndex(0)
|
self.effectdropdown.setCurrentIndex(0)
|
||||||
|
|
||||||
@ -2142,7 +2146,7 @@ class gui(QtGui.QWidget):
|
|||||||
def set_text_color(self):
|
def set_text_color(self):
|
||||||
textcolor = int(self.m_chatmessage[TEXT_COLOR])
|
textcolor = int(self.m_chatmessage[TEXT_COLOR])
|
||||||
|
|
||||||
#is_rainbow = textcolor == 6
|
is_rainbow = textcolor == C_RAINBOW
|
||||||
|
|
||||||
if textcolor == 0:
|
if textcolor == 0:
|
||||||
color = QtGui.QColor(255, 255, 255)
|
color = QtGui.QColor(255, 255, 255)
|
||||||
@ -2162,13 +2166,15 @@ class gui(QtGui.QWidget):
|
|||||||
color = QtGui.QColor(0, 255, 255)
|
color = QtGui.QColor(0, 255, 255)
|
||||||
elif textcolor == 8:
|
elif textcolor == 8:
|
||||||
color = QtGui.QColor(200, 200, 200)
|
color = QtGui.QColor(200, 200, 200)
|
||||||
|
else:
|
||||||
|
color = QtGui.QColor(255, 255, 255)
|
||||||
|
|
||||||
# if is_rainbow:
|
if is_rainbow:
|
||||||
# self.text.show()
|
self.text.show()
|
||||||
# self.ao2text.hide()
|
self.ao2text.hide()
|
||||||
# else:
|
else:
|
||||||
self.text.hide()
|
self.text.hide()
|
||||||
self.ao2text.show()
|
self.ao2text.show()
|
||||||
|
|
||||||
style = "background-color: rgba(0, 0, 0, 0);\n"
|
style = "background-color: rgba(0, 0, 0, 0);\n"
|
||||||
style += "color: rgb("+str(color.red())+", "+str(color.green())+", "+str(color.blue())+")"
|
style += "color: rgb("+str(color.red())+", "+str(color.green())+", "+str(color.blue())+")"
|
||||||
@ -2558,11 +2564,11 @@ class gui(QtGui.QWidget):
|
|||||||
f_character = QtCore.QString(f_character2)
|
f_character = QtCore.QString(f_character2)
|
||||||
|
|
||||||
if f_character == " ":
|
if f_character == " ":
|
||||||
self.text.setText(self.text.text() + " ")
|
self.text.insertPlainText(" ")
|
||||||
self.ao2text.insertPlainText(" ")
|
self.ao2text.insertPlainText(" ")
|
||||||
|
|
||||||
elif f_character == "\n" or f_character == "\r":
|
elif f_character == "\n" or f_character == "\r":
|
||||||
self.text.setText(self.text.text() + "\n")
|
self.text.insertPlainText("\n")
|
||||||
self.ao2text.insertPlainText("\n")
|
self.ao2text.insertPlainText("\n")
|
||||||
|
|
||||||
elif f_character == "\\" and not self.next_character_is_not_special:
|
elif f_character == "\\" and not self.next_character_is_not_special:
|
||||||
@ -2676,10 +2682,10 @@ class gui(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
self.ao2text.insertHtml(f_character)
|
self.ao2text.insertHtml(f_character)
|
||||||
else:
|
else:
|
||||||
# if int(self.m_chatmessage[TEXT_COLOR]) == C_RAINBOW:
|
if int(self.m_chatmessage[TEXT_COLOR]) == C_RAINBOW:
|
||||||
# self.text.setText(self.text.text() + f_character)
|
self.text.insertHtml(f_character)
|
||||||
# else:
|
else:
|
||||||
self.ao2text.insertHtml(f_character)
|
self.ao2text.insertHtml(f_character)
|
||||||
|
|
||||||
if self.message_is_centered:
|
if self.message_is_centered:
|
||||||
self.ao2text.setAlignment(QtCore.Qt.AlignCenter)
|
self.ao2text.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
@ -2891,7 +2897,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.colordropdown.clear()
|
self.colordropdown.clear()
|
||||||
self.colordropdown.addItems(['white', 'green', 'red', 'orange', 'blue'])
|
self.colordropdown.addItems(['white', 'green', 'red', 'orange', 'blue'])
|
||||||
if "yellowtext" in features:
|
if "yellowtext" in features:
|
||||||
self.colordropdown.addItems(['yellow', 'pink', 'cyan', 'gray'])
|
self.colordropdown.addItems(['yellow', 'pink', 'cyan', 'gray', 'rainbow'])
|
||||||
self.colordropdown.setCurrentIndex(self.mychatcolor)
|
self.colordropdown.setCurrentIndex(self.mychatcolor)
|
||||||
|
|
||||||
for hp in hplist:
|
for hp in hplist:
|
||||||
@ -2960,7 +2966,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.tcpthread.showCharSelect.connect(self.charselect.show)
|
self.tcpthread.showCharSelect.connect(self.charselect.show)
|
||||||
self.tcpthread.allEvidence.connect(self.allEvidence)
|
self.tcpthread.allEvidence.connect(self.allEvidence)
|
||||||
self.tcpthread.updatePlayerList.connect(self.updatePlayerList)
|
self.tcpthread.updatePlayerList.connect(self.updatePlayerList)
|
||||||
#self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
|
self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
|
||||||
self.tcpthread.start()
|
self.tcpthread.start()
|
||||||
|
|
||||||
def allEvidence(self, evi):
|
def allEvidence(self, evi):
|
||||||
@ -3247,7 +3253,7 @@ class TCP_Thread(QtCore.QThread):
|
|||||||
charSlots = QtCore.pyqtSignal()
|
charSlots = QtCore.pyqtSignal()
|
||||||
showCharSelect = QtCore.pyqtSignal()
|
showCharSelect = QtCore.pyqtSignal()
|
||||||
allEvidence = QtCore.pyqtSignal(list)
|
allEvidence = QtCore.pyqtSignal(list)
|
||||||
#rainbowColor = QtCore.pyqtSignal(str)
|
rainbowColor = QtCore.pyqtSignal(str)
|
||||||
updatePlayerList = QtCore.pyqtSignal(str, int, int, str)
|
updatePlayerList = QtCore.pyqtSignal(str, int, int, str)
|
||||||
|
|
||||||
send_attempts = 0
|
send_attempts = 0
|
||||||
@ -3259,12 +3265,12 @@ class TCP_Thread(QtCore.QThread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pingtimer = 150
|
pingtimer = 150
|
||||||
#rainbow = 0
|
rainbow = 0
|
||||||
sendtick = 0
|
sendtick = 0
|
||||||
tempdata = ""
|
tempdata = ""
|
||||||
color = QtGui.QColor()
|
color = QtGui.QColor()
|
||||||
#color.setHsv(rainbow, 255, 255)
|
color.setHsv(rainbow, 255, 255)
|
||||||
color.setHsv(0, 255, 255)
|
#color.setHsv(0, 255, 255)
|
||||||
while True:
|
while True:
|
||||||
if self.parent.disconnectnow:
|
if self.parent.disconnectnow:
|
||||||
self.parent.disconnectCommon()
|
self.parent.disconnectCommon()
|
||||||
@ -3276,13 +3282,13 @@ class TCP_Thread(QtCore.QThread):
|
|||||||
self.parent.tcp.send('CH#%')
|
self.parent.tcp.send('CH#%')
|
||||||
pingtimer = 150
|
pingtimer = 150
|
||||||
|
|
||||||
# if self.parent.m_chatmessage[TEXT_COLOR] == "6":
|
if self.parent.m_chatmessage[TEXT_COLOR] == str(C_RAINBOW):
|
||||||
# color.setHsv(rainbow, 255, 255)
|
color.setHsv(rainbow, 255, 255)
|
||||||
# rainbow += 5
|
rainbow += 5
|
||||||
# if rainbow > 255:
|
if rainbow > 255:
|
||||||
# rainbow = 0
|
rainbow = 0
|
||||||
# #self.parent.text.setStyleSheet('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
|
#self.parent.text.setStyleSheet('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
|
||||||
# self.rainbowColor.emit('color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
|
self.rainbowColor.emit('background-color: rgba(0, 0, 0, 0); color: rgb(' + str(color.red()) + ', ' + str(color.green()) + ', ' + str(color.blue()) + ')')
|
||||||
|
|
||||||
if sendtick:
|
if sendtick:
|
||||||
sendtick -= 1
|
sendtick -= 1
|
||||||
|
Loading…
Reference in New Issue
Block a user