-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplits.py
28 lines (24 loc) · 867 Bytes
/
splits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from typing import List
from itertools import count
from dataclasses import dataclass, field
from dataclass_wizard import JSONWizard, json_field
from PySide6.QtCore import QObject
import datetime
from utils import Utils
@dataclass
class Split(QObject):
title: str
split_time: str
best_time: str
best_segment: str
identifier: int = json_field("identifier", default_factory=count().__next__, dump=False)
delta: float = json_field("delta", default=0, dump=False)
time_this_run: datetime.timedelta = json_field("time_this_run", default=datetime.timedelta(), dump=False)
time_this_run_str: str = json_field("time_this_run_str", default="", dump=False) # thanks, Qt
@dataclass
class Splits(JSONWizard):
title: str
category: str
attempt_count: int
finished_count: int
splits: List[Split] = field(default_factory=list)