improve unicode shownames

This commit is contained in:
cidoku 2025-02-22 20:25:25 -03:00
parent 82e71272fe
commit 357e369559

View File

@ -277,7 +277,7 @@ class AOCharMovie(QtGui.QLabel):
self.scaling = scaling self.scaling = scaling
p_char = p_char.lower().decode('utf-8') p_char = p_char.lower()
p_emote = p_emote.lower() p_emote = p_emote.lower()
original_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif", AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif"]) original_path = self.test_path([AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif", AOpath+"characters/"+p_char+"/"+emote_prefix+p_emote+".gif"])
@ -2019,7 +2019,7 @@ class gui(QtGui.QWidget):
msg += str(self.mychatcolor)+"#" msg += str(self.mychatcolor)+"#"
if "cccc_ic_support" in self.features: if "cccc_ic_support" in self.features:
showname = self.showname showname = self.showname.decode('utf-8')
if self.showname == "" and not self.charshowname == "": if self.showname == "" and not self.charshowname == "":
showname = self.charshowname showname = self.charshowname
msg += showname+"#" # custom showname msg += showname+"#" # custom showname
@ -2162,18 +2162,22 @@ class gui(QtGui.QWidget):
if self.additivebtn.isChecked(): if self.additivebtn.isChecked():
self.icchatinput.insert(" ") self.icchatinput.insert(" ")
f_char = self.m_chatmessage[CHARNAME].decode("utf-8") self.m_chatmessage[CHARNAME] = self.m_chatmessage[CHARNAME].decode("utf-8")
self.m_chatmessage[SHOWNAME] = self.m_chatmessage[SHOWNAME].decode('utf-8')
f_char = self.m_chatmessage[CHARNAME]
evidence = int(self.m_chatmessage[EVIDENCE])-1 evidence = int(self.m_chatmessage[EVIDENCE])-1
t = time.localtime() t = time.localtime()
logcharname = f_char logcharname = f_char
#TODO: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal #TODO: UnicodeWarning: Unicode unequal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
#if f_char.lower() != self.charlist[f_char_id][0].lower(): if f_char.lower() != self.charlist[f_char_id][0].lower():
# logcharname = self.charlist[f_char_id][0] + ' (' + f_char.decode("utf-8") + ')' logcharname = self.charlist[f_char_id][0] + ' (' + f_char.decode("utf-8") + ')'
if self.m_chatmessage[SHOWNAME] and self.m_chatmessage[SHOWNAME].lower() != f_char.lower(): if self.m_chatmessage[SHOWNAME] and self.m_chatmessage[SHOWNAME].lower() != f_char.lower():
try: try:
logcharname += " ("+self.m_chatmessage[SHOWNAME].decode('utf-8')+")" logcharname += " ("+self.m_chatmessage[SHOWNAME]+")"
except: except:
logcharname += " (???)" logcharname += " (???)"
@ -2306,9 +2310,9 @@ class gui(QtGui.QWidget):
self.effectview.stop() self.effectview.stop()
if not self.m_chatmessage[SHOWNAME]: if not self.m_chatmessage[SHOWNAME]:
self.name.setText(self.m_chatmessage[CHARNAME].decode("utf-8")) self.name.setText(self.m_chatmessage[CHARNAME])
else: else:
self.name.setText(self.m_chatmessage[SHOWNAME].decode("utf-8")) self.name.setText(self.m_chatmessage[SHOWNAME])
self.chatbox.hide() self.chatbox.hide()