-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor_samples.py
More file actions
38 lines (27 loc) · 1.11 KB
/
color_samples.py
File metadata and controls
38 lines (27 loc) · 1.11 KB
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
29
30
31
32
33
34
35
36
37
38
import traceback
from PyQt6.QtCore import QObject
from debug_print_mixin import DebugPrintMixin
from color_sample import ColorSample
class ColorSamples(QObject, DebugPrintMixin):
def __init__(self, project):
QObject.__init__(self)
DebugPrintMixin.__init__(self)
self.project = project
def save_to_dict(self, dict : dict):
"""Save in dictionary."""
try:
color_samples = list()
for color_sample in ColorSample.color_samples:
color_samples.append(color_sample.save_to_dict())
dict["ColorSamples"] = color_samples
except Exception as e:
print(f"Unable to save color samples to dictionary: {e}")
traceback.print_exc()
def load_from_dict(self, dict : dict):
"""Load from dictionary."""
try:
for color_sample_dict in dict["ColorSamples"]:
ColorSample.create_from_dict(self.project, color_sample_dict)
except Exception as e:
print(f"Unable to load color samples from dictionary: {e}")
traceback.print_exc()