Serialize Python UUIDs to strings for QML

This commit is contained in:
miruka 2019-12-02 04:40:29 -04:00
parent bbb872e5dc
commit ae009c7412

View File

@ -12,6 +12,7 @@ from enum import auto as autostr
from pathlib import Path
from types import ModuleType
from typing import Any, Callable, Dict, Tuple, Type
from uuid import UUID
import filetype
from aiofiles.threadpool.binary import AsyncBufferedReader
@ -136,6 +137,9 @@ def serialize_value_for_qml(value: Any) -> Any:
if isinstance(value, Path):
return f"file://{value!s}"
if isinstance(value, UUID):
return str(value)
if inspect.isclass(value):
return value.__name__