sample_queue_model.py: added to_state and from_state functions WIP
This commit is contained in:
@@ -116,4 +116,19 @@ class SampleQueueSpreadsheet(QAbstractTableModel):
|
||||
def clearSamples(self):
|
||||
self.beginResetModel()
|
||||
self.samples = []
|
||||
self.endResetModel()
|
||||
|
||||
def to_state(self) -> dict:
|
||||
return {
|
||||
"samples": [s.to_dict() for s in self.samples],
|
||||
}
|
||||
|
||||
def from_state(self, state: dict):
|
||||
self.beginResetModel()
|
||||
|
||||
self.samples = [
|
||||
SampleShortInfo.from_dict(d)
|
||||
for d in state.get("samples", [])
|
||||
]
|
||||
|
||||
self.endResetModel()
|
||||
Reference in New Issue
Block a user