Merge pull request #518 from Arthur-Milchior/time_format_in_browser

Browser introduce method time_format
This commit is contained in:
Damien Elmes 2020-03-20 20:37:57 +10:00 committed by GitHub
commit 7538ebcdf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -275,6 +275,9 @@ class DataModel(QAbstractTableModel):
def columnType(self, column): def columnType(self, column):
return self.activeCols[column] return self.activeCols[column]
def time_format(self):
return "%Y-%m-%d"
def columnData(self, index): def columnData(self, index):
row = index.row() row = index.row()
col = index.column() col = index.column()
@ -302,11 +305,11 @@ class DataModel(QAbstractTableModel):
t = "(" + t + ")" t = "(" + t + ")"
return t return t
elif type == "noteCrt": elif type == "noteCrt":
return time.strftime("%Y-%m-%d", time.localtime(c.note().id / 1000)) return time.strftime(self.time_format(), time.localtime(c.note().id / 1000))
elif type == "noteMod": elif type == "noteMod":
return time.strftime("%Y-%m-%d", time.localtime(c.note().mod)) return time.strftime(self.time_format(), time.localtime(c.note().mod))
elif type == "cardMod": elif type == "cardMod":
return time.strftime("%Y-%m-%d", time.localtime(c.mod)) return time.strftime(self.time_format(), time.localtime(c.mod))
elif type == "cardReps": elif type == "cardReps":
return str(c.reps) return str(c.reps)
elif type == "cardLapses": elif type == "cardLapses":
@ -363,7 +366,7 @@ class DataModel(QAbstractTableModel):
date = time.time() + ((c.due - self.col.sched.today) * 86400) date = time.time() + ((c.due - self.col.sched.today) * 86400)
else: else:
return "" return ""
return time.strftime("%Y-%m-%d", time.localtime(date)) return time.strftime(self.time_format(), time.localtime(date))
def isRTL(self, index): def isRTL(self, index):
col = index.column() col = index.column()