kindle manager

This commit is contained in:
gavin
2020-06-07 17:48:28 +08:00
parent 76cc0d8c6d
commit 32d9f53897
7 changed files with 324 additions and 63 deletions

25
x Normal file
View File

@@ -0,0 +1,25 @@
class TableModel(QAbstractTableModel):
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
def data(self, index, role):
if role == Qt.DisplayRole:
value = self._data.iloc[index.row(), index.column()]
return str(value)
def rowCount(self, index):
return self._data.shape[0]
def columnCount(self, index):
return self._data.shape[1]
def headerData(self, section, orientation, role):
# section is the index of the column/row.
if role == Qt.DisplayRole:
if orientation == Qt.Horizontal:
return str(self._data.columns[section])
if orientation == Qt.Vertical:
return str(self._data.index[section])