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