mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Browser introduce method time_format
I expect to use this in my add-on 1243668133 (by monkey patching in this case) where it would allow to show hours/minutes/seconds... in browser
This commit is contained in:
parent
e3a57a4193
commit
97225a0364
1 changed files with 7 additions and 4 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue