Bug fixes

* Fixed string encoding/decoding issues with non-latin languages
* Fixed expression editor crash on copy/pasting
* Fixed expression editor crash caused by inserted None value choices for expression that don't support it
This commit is contained in:
LoafyLemon 2023-04-22 16:39:15 +01:00
parent a0d8ed6bfd
commit 1d2e46b909
3 changed files with 7 additions and 4 deletions

View File

@ -86,12 +86,12 @@ init python early:
def set_clipboard(txt): def set_clipboard(txt):
txt = str(txt) txt = str(txt)
pygame.scrap.put(pygame.scrap.SCRAP_TEXT, txt.encode("utf-8")) pygame.scrap.put(pygame.scrap.SCRAP_TEXT, txt.encode())
def get_clipboard(): def get_clipboard():
clipboard = pygame.scrap.get(pygame.scrap.SCRAP_TEXT) clipboard = pygame.scrap.get(pygame.scrap.SCRAP_TEXT)
if clipboard: if clipboard:
return clipboard return clipboard.decode()
return None return None
def evaluate(txt): def evaluate(txt):

View File

@ -6,7 +6,7 @@ init -999 python early:
def get_gpu_info(): def get_gpu_info():
try: try:
info = "\n".join([glGetString(GL_VENDOR).decode("utf-8"), glGetString(GL_RENDERER).decode("utf-8"), glGetString(GL_VERSION).decode("utf-8")]) info = "\n".join([glGetString(GL_VENDOR).decode(), glGetString(GL_RENDERER).decode(), glGetString(GL_VERSION).decode()])
except: except:
info = "ERR: Unknown or incompatible driver." info = "ERR: Unknown or incompatible driver."
return info return info

View File

@ -275,7 +275,10 @@ init python:
if not fp.startswith(path) or not ext in extensions: if not fp.startswith(path) or not ext in extensions:
continue continue
if part in ("cheeks", "tears"):
expressions = d.setdefault(charname[:3], OrderedDict()).setdefault(part, _list((None,))) expressions = d.setdefault(charname[:3], OrderedDict()).setdefault(part, _list((None,)))
else:
expressions = d.setdefault(charname[:3], OrderedDict()).setdefault(part, _list())
if not expression in expressions: if not expression in expressions:
expressions.append(expression) expressions.append(expression)