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
def evaluate(txt):
return __import__('ast').literal_eval(txt)
try:
return __import__('ast').literal_eval(txt)
except Exception as e:
print("Error evaluating clipboard data:")
print(e)
def reset_variables(*args):
"""Resets the given variables to their default values."""

View File

@ -520,9 +520,10 @@ screen colorpickerscreen(item=None):
text "Alpha:[cp.alpha]"
if item:
textbutton "Colour code: [item.color]":
action Function(set_clipboard, str(item.color))
#alternate [Function(item.set_color, evaluate(get_clipboard()))]
$ colorcode = [i.hexcode for i in item.color]
textbutton "Colour code: [colorcode]":
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"]
#alternate_keysym ["ctrl_K_v"]