Bug fixes

* Fixed traceback crash (doh!) caused by uncaught ast eval exception
* Fixed dev colour code info screen
This commit is contained in:
LoafyLemon 2023-02-09 19:35:52 +00:00
parent dcdd54cdfe
commit 5fdf1e87fe
2 changed files with 9 additions and 4 deletions

View File

@ -94,7 +94,11 @@ init -1 python:
return None return None
def evaluate(txt): def evaluate(txt):
try:
return __import__('ast').literal_eval(txt) return __import__('ast').literal_eval(txt)
except Exception as e:
print("Error evaluating clipboard data:")
print(e)
def reset_variables(*args): def reset_variables(*args):
"""Resets the given variables to their default values.""" """Resets the given variables to their default values."""

View File

@ -520,9 +520,10 @@ screen colorpickerscreen(item=None):
text "Alpha:[cp.alpha]" text "Alpha:[cp.alpha]"
if item: if item:
textbutton "Colour code: [item.color]": $ colorcode = [i.hexcode for i in item.color]
action Function(set_clipboard, str(item.color)) textbutton "Colour code: [colorcode]":
#alternate [Function(item.set_color, evaluate(get_clipboard()))] action [Function(set_clipboard, json.dumps(colorcode)), Notify("Colorcode copied to clipboard.")]
#alternate [Function(item.set_color, evaluate(str(get_clipboard())))]
keysym ["ctrl_K_c"] keysym ["ctrl_K_c"]
#alternate_keysym ["ctrl_K_v"] #alternate_keysym ["ctrl_K_v"]