user_sample_model.py: added to_list and from_list functions for Qsettings functionality
This commit is contained in:
@@ -61,6 +61,13 @@ class UserSampleSpreadsheet(QAbstractTableModel):
|
||||
|
||||
self._sort()
|
||||
|
||||
def to_list(self) -> list[dict]:
|
||||
return [sample.to_dict() for sample in self.samples]
|
||||
|
||||
def from_list(self, data: list[dict]):
|
||||
self.beginResetModel()
|
||||
self.samples = [SampleShortInfo.from_dict(d) for d in data]
|
||||
self.endResetModel()
|
||||
|
||||
def rowCount(self, parent=None):
|
||||
return len(self.__sorted_samples)
|
||||
|
||||
Reference in New Issue
Block a user