Serialize Python types to their __name__ attribute
This commit is contained in:
parent
3e214dc26b
commit
08694388dd
|
@ -106,7 +106,7 @@ class UploadStatus(AutoStrEnum):
|
||||||
Caching = auto()
|
Caching = auto()
|
||||||
UploadingThumbnail = auto()
|
UploadingThumbnail = auto()
|
||||||
CachingThumbnail = auto()
|
CachingThumbnail = auto()
|
||||||
Failure = auto() # TODO
|
Failure = auto()
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -182,11 +182,11 @@ class Event(ModelItem):
|
||||||
return self.date > other.date
|
return self.date > other.date
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event_type(self) -> str:
|
def event_type(self) -> Type:
|
||||||
if self.local_event_type:
|
if self.local_event_type:
|
||||||
return self.local_event_type.__name__
|
return self.local_event_type
|
||||||
|
|
||||||
return type(self.source).__name__
|
return type(self.source)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def links(self) -> List[str]:
|
def links(self) -> List[str]:
|
||||||
|
|
|
@ -136,6 +136,9 @@ def serialize_value_for_qml(value: Any) -> Any:
|
||||||
if isinstance(value, Path):
|
if isinstance(value, Path):
|
||||||
return f"file://{value!s}"
|
return f"file://{value!s}"
|
||||||
|
|
||||||
|
if inspect.isclass(value):
|
||||||
|
return value.__name__
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user