support unicode in ooc and evidence
This commit is contained in:
parent
7fbe61954c
commit
448dbeb63e
25
gameview.py
25
gameview.py
@ -1587,10 +1587,12 @@ class gui(QtGui.QWidget):
|
||||
if self.ooclog.verticalScrollBar().value() == self.ooclog.verticalScrollBar().maximum(): self.ooclog.verticalScrollBar().setValue(self.ooclog.verticalScrollBar().maximum())
|
||||
|
||||
def sendOOCchat(self, name, text):
|
||||
print type(name)
|
||||
print type(text)
|
||||
self.tcp.send('CT#' + name + '#' + text + '#%')
|
||||
|
||||
def onOOCreturn(self):
|
||||
text = self.oocinput.text().toUtf8().replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>').replace('\\n', '\n')
|
||||
text = self.oocinput.text().replace('#', '<num>').replace('%', '<percent>').replace('&', '<and>').replace('$', '<dollar>').replace('\\n', '\n')
|
||||
if text.startsWith('//'):
|
||||
code = str(self.oocinput.text()).replace('//', '', 1).replace('\\NEWLINE', '\n')
|
||||
try:
|
||||
@ -1835,7 +1837,9 @@ class gui(QtGui.QWidget):
|
||||
|
||||
if self.msgqueue:
|
||||
chatmsgcomp = (self.msgqueue[0].split('#')[5]).replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#')
|
||||
if (f_char_id == self.mychar and self.m_chatmessage[CHATMSG] == chatmsgcomp): # our message showed up
|
||||
examine = chatmsgcomp == ">" or chatmsgcomp == "<"
|
||||
special = not chatmsgcomp or chatmsgcomp.isspace()
|
||||
if examine or (f_char_id == self.mychar and (special or self.m_chatmessage[CHATMSG] == chatmsgcomp)): # our message showed up
|
||||
del self.msgqueue[0]
|
||||
self.msgqueueList.takeItem(0)
|
||||
if self.additivebtn.isChecked():
|
||||
@ -2218,12 +2222,9 @@ class gui(QtGui.QWidget):
|
||||
self.playSound(fx_sound)
|
||||
|
||||
if "effects" not in self.features: return
|
||||
#print "effect", repr(effect)
|
||||
|
||||
self.effectview.set_play_once(True)
|
||||
#try:
|
||||
self.effectview.play(effect)
|
||||
#except: pass # Windows XP webp error with Pillow
|
||||
|
||||
def start_chat_ticking(self):
|
||||
if self.text_state != 0:
|
||||
@ -2852,8 +2853,8 @@ class EditEvidenceDialog(QtGui.QDialog):
|
||||
self.evipicture.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png'))
|
||||
|
||||
def onSave(self):
|
||||
name = encode_ao_str(self.eviname.text().toUtf8())
|
||||
desc = encode_ao_str(self.evidesc.toPlainText().toUtf8())
|
||||
name = encode_ao_str(self.eviname.text())
|
||||
desc = encode_ao_str(self.evidesc.toPlainText())
|
||||
|
||||
if self.editing:
|
||||
self.gamegui.tcp.send('EE#' + str(self.edit_ind) + '#' + name + '#' + desc + '#' + self.filename + '#%')
|
||||
@ -2988,6 +2989,9 @@ class TCP_Thread(QtCore.QThread):
|
||||
#rainbowColor = QtCore.pyqtSignal(str)
|
||||
updatePlayerList = QtCore.pyqtSignal(str, int, int, str)
|
||||
|
||||
send_attempts = 0
|
||||
max_attempts = 5
|
||||
|
||||
def __init__(self, parent):
|
||||
super(TCP_Thread, self).__init__(parent)
|
||||
self.parent = parent
|
||||
@ -3032,7 +3036,10 @@ class TCP_Thread(QtCore.QThread):
|
||||
if error == -2:
|
||||
# if the message can't be sent, discard it
|
||||
if sendtick == 4:
|
||||
print '[warning] The server rejected the message'
|
||||
self.send_attempts += 1
|
||||
if self.send_attempts >= self.max_attempts:
|
||||
self.send_attempts = 0
|
||||
print "[warning] message discarded"
|
||||
del self.parent.msgqueue[0]
|
||||
self.parent.msgqueueList.takeItem(0)
|
||||
continue
|
||||
@ -3041,6 +3048,8 @@ class TCP_Thread(QtCore.QThread):
|
||||
self.parent.willDisconnect = True
|
||||
self.quit()
|
||||
return
|
||||
else:
|
||||
self.send_attempts = 0
|
||||
|
||||
for network in total:
|
||||
header = network[0]
|
||||
|
Loading…
Reference in New Issue
Block a user