def setData(self, index, value, role): if index.isValid() and role == Qt.EditRole: row, col = index.row(), index.column() ch = self._mp3.chapters[row] if col == 0: ch.title = value elif col == 1: ch.start = Timestamp.from_string(value) elif col == 2: ch.end = Timestamp.from_string(value) self.dataChanged.emit(index, index, [role]) return True else: return False
def from_xml(cls, xml_txt: str): markers = [] root = ET.fromstring(xml_txt) for marker in root.iter('Marker'): name = marker.find('Name') time = marker.find('Time') if name is not None and time is not None: markers.append(cls(name.text, Timestamp.from_string(time.text))) return markers