1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
def hhmmss(ms):
# s = 1000
# m = 60000
# h = 360000
h, r = divmod(ms, 36000)
m, r = divmod(r, 60000)
s, _ = divmod(r, 1000)
return ("%d:%02d:%02d" % (h,m,s)) if h else ("%d:%02d" % (m,s))
class AbListModel(QAbstractListModel):
def __init__(self, *args, **kwargs):
super(AbListModel, self).__init__(*args, **kwargs)
self.abList = list()
def data(self, index, role):
if role == Qt.DisplayRole:
ab = self.abList[index.row()]
return f"{hhmmss(ab[0])} - {hhmmss(ab[1])}"
def rowCount(self, index):
return len(self.abList)
|